How do I make Right click on block despawn nearest specific entity

Started by lawpash on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make Right click on block despawn nearest specific entity

I’ve tried everything and can’t figure it out.

Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Go to the block you want to…
Mon, 05/22/2023 - 11:20

Go to the block you want to right click on, after go to ''triggers'', find ''On block right clicked'', click the plus to make a new procedure.

After, do this:

Despawn [Get nearest entity at x: x y: y z : z in square cube with size (from how far away you want your block to be able to despawn the entity) of type (your entity)]

Despawn can be found in the ''Entity Management'' tab and ''Get nearest entity'' at the bottom of the ''World Data'' tab.

Should work like a charm ;)

Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm not sure if that…
Mon, 05/22/2023 - 13:35

I'm not sure if that procedure will give a "null" error, but if it does, there is a procedure block that will check if your entity exists within the area, and that will fix a "null" error