How to detect entities touching the side of a block?

Started by EbonyCrow on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to detect entities touching the side of a block?

I made a block that is supposed to function like a cactus. I added a procedure that damages entities, and it triggers when an entity walks on the block. But I cannot figure out how to get the block to damage entities if they touch it on the side. Is there some way to do this?

Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
ahznb, I tried that, but it…
Sat, 07/25/2020 - 16:48

ahznb, I tried that, but it didn't work. Probably has something to do with the fact that my block uses the normal block model instead of the smaller model the cactus uses.

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you can try 2 things. one is…
Sat, 07/25/2020 - 18:32

you can try 2 things. one is adding chat text to see if that procedure is being triggered and print out the target entity.

or try creating a new single texture block with a black texture or something with all the defaults and make a procedure just for the "when entity collides with block" event. put in code blocks to damage target entity and test it out.

Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes, this procedure seems to…
Sat, 07/25/2020 - 19:14

Yes, this procedure seems to trigger ONLY when you are IN the block, so the easiest fix would be to make a custom model even one pixel smaller but centered so it is only off by 1/2 a pixel on each side, though I understand this may not work with what you wanted. You could also run test in player tick to see if you are next to the block, but this might make the ENTIRE air block next to the "cactus" block hurt you.

 

I don't know if this will help, but I made a backwards version of this, where I wanted to activate a procedure when I was only touching a certain edge of a block. I used the "when entity collides in block" trigger saying:

IF the block if facing north

AND the z position of the entity is > Z+0.625

DO the procedure