Started by
HappyFew09
on
Topic category: Help with Minecraft modding (Java Edition)
I want to make a structure with vanilla blocks, but if you break a block you get damage. Idk how to do it. Does anyone have a idea?
Topic category: Help with Minecraft modding (Java Edition)
I want to make a structure with vanilla blocks, but if you break a block you get damage. Idk how to do it. Does anyone have a idea?
You'd need to have some way to detect if the blocks are part of your structure or not.
This could be done with just one modded block and a status effect. Put that block in the middle of your structure, and use procedures to make it give the status effect to nearby players every update tick. Set it's tick rate to 20.
Then, make a procedure with global trigger "block broken." Do "if event/target entity has <the status effect>, do <pick a number> damage event/target entity type <pick a type; I recommend magic so armor doesn't work>." Optionally, you can include a cancel event trigger to make the block fix itself.
Also, if you have problems with the status effect sticking around at 0:00 forever, change the "give player status effect" block to "execute command '/effect give @s <mod_namespace>:<status_effect> 1' in the name of event/target entity"
thnx, this helped me alot!