Check for block in front of another block

Started by myxical on Sat, 06/12/2021 - 20:26

Topic category: Help with modding (Java Edition)

Last seen on 10:04, 18. Jul 2021
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Check for block in front of another block
Sat, 06/12/2021 - 20:26

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