Check for block in front of another block

Started by myxical on

Topic category: Help with modding (Java Edition)

Last seen on 23:47, 20. Jan 2024
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Check for block in front of another block

Let's say there's a custom block that you can activate. The block can be rotated. Also, let's say that there's a "lock" block in front of it.

I want to make it so if there's a lock in front of the block you have to first unlock it with a key (then the lock gets removed) and only then you can activate the block. Basically if the block is right clicked but there's some specific block in front of it, don't do the action it's supposed to do.

And yes, IN FRONT OF IT. Not to the side, or on it, it must be where it's front is located. Because you can rotate the block.

You can check direction of…
Mon, 06/14/2021 - 07:20

You can check direction of block with rotation and based on direction offset location in "front" direction to check for it