Entity in player sight

Started by Superkota on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Entity in player sight

How do I check if an entity is in the player's view.

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This plugin has a block for…
Sun, 09/24/2023 - 17:38

This plugin has a block for raytracing to test if the player is looking at the entity - https://mcreator.net/plugin/99695/typecast

 

If you're looking for something broader, like if the entity is just on the player's screen, that's significantly more difficult, as you would have to do math to get the player's rotation, and then an "arc" in that direction, and then test if the entity is within that arc. This would require a lot of circle math, which I am not personally fond of.