How to have a procedure that is run by an entity but damages the player?

Started by Sharpblade1 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to have a procedure that is run by an entity but damages the player?

Is there a way to create create a procedure so that if the player is at a distance from an entity the player is damaged?

Joined Mar 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You could use the "get…
Sat, 04/26/2025 - 18:57

You could use the "get nearest entity at xyz in square cube of type" procedure block to get the nearest player in a given radius, and then deal damage to that player.

Of course, you may want to first check that a player actually does exist within that radius, to avoid trying to deal damage to a null entity.