Prevent Player from Breaking Certain Blocks

Started by halfanatom on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Prevent Player from Breaking Certain Blocks

Hiya, is there any way I can prevent the player from breaking certain blocks like logs or stone with their main hand? By preventing I mean dealing damage or something, and if there is any way can you send me a screenshot of how to do it? Thanks!

Joined Apr 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I can't send a screen shot,…
Sun, 02/01/2026 - 13:59

I can't send a screen shot, but you could do a "when block is broken" procedure, and, for instance, make it stone. When block is broken, if block at XYZ= stone, deal x damage to source entity (or event/target I am not sure which), replace block at XYZ with lava (to incinerate the drop from the block), then replace block at XYZ with stone. I think that will work but no promises.

 

Joined Jun 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
thanks, I managed to do…
Mon, 02/02/2026 - 19:34

thanks, I managed to do what I wanted but now i'd like it to deal damage every 20 ticks while breaking block

Joined Apr 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Unfortunately, I cannot see…
Mon, 02/02/2026 - 20:51

Unfortunately, I cannot see the link properly either, but I can walk you through part of the process: What you need is a variable, that when variable is at 20, it resets to 0 and does damage to the player. However, I am not rue how to make the variable go up by one every tick as they try to break the block.