How do I make a block breakable with only a specific tool?

Started by DodoNoobLORD on

Topic category: Help with Minecraft modding (Java Edition)

Joined Dec 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make a block breakable with only a specific tool?

So what I want to do is make a block only be able to be broken with a specific tool, and not be able to be mined at all by others.

I thought of 3 ways this could be done:

1. Make the block unbreakable, but if the item in the main hand is the tool, make it breakable

2. Check the item in the main hand is the tool, if it's not when the block is broken, the block will just be placed back.

3. Make the block unbreakable, and if the item in the main hand is the tool change the block to another block that isn't unbreakable, then after a bit of time change it back to the other block.

I have done number three:


 

However I would like to know if there is a way to do numbers 1 or 2
 

Joined Dec 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok so i immediately realised…
Sun, 12/04/2022 - 12:18

Ok so i immediately realised number 3 kind of doesn't work as the block just comes back, so make it so it only comes back if the block is not broken