Blocks Tied Together

Started by GamesOfLife on

Topic category: Help with Minecraft modding (Java Edition)

Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Blocks Tied Together

I want to create multi-block objects that, when one part is broken, every other block in the object breaks as well. (Similar to doors/beds)
I figure this could be done with blockstates(on tick update check if specific neighbors exist, depending on the blockstate).
For example the top-right blockstate will update and check if the top-left or bottom-right blocks still exist. If not, it will break itself.

Is this the best way to accomplish this? Any more efficient methods?

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I guess it depends on theā€¦
Sun, 04/13/2025 - 10:53

I guess it depends on the scale of your "multi-block objects", if a player can make them as big as they want then you'd need to do on block broken procedure break the same block if it is at any position around the first block, that creates a chain of blocks breaking until all of them do.

Otherwise it would depend on how big the object is, 2x2 or 3x3 or whatever. If it's all one block with different blockstates you could do it how you suggested. If block at x y z is bottom left, then check block at x y+1 z is middle left else replace block at x y z air and check block at x+-1 y z is bottom middle else replace x y z air etc. You would probably first check the rotation of the block to see which way it's facing to see whether you need to check for blocks in the x or z axis, depending on if it's facing north/south or east/west. Of course if the object is 3 dimensional then you'd just check for both x and z on each block.