Help detect blocks between entity and player

Started by ManuehTheModder405 on

Topic category: Help with modding (Java Edition)

Last seen on 16:12, 23. Apr 2024
Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help detect blocks between entity and player

I don't know if this is possible but i need to know if i can do this (idc if i have to do it with locked code)

I have an entity that reacts whenever you look at him, but i'd like to do if there are blocks between the player and the entity he doesn't react (Because you aren't really watching him).

 

I've tried with a lot of things, the only thing that i didn't try was the procedures "Look X/Y/Z position of [...] with raytrace distance..." because i think i need to structurate this first.
And if you're wondering, the way that i've make the entity know when im looking it is because im using an execute command that changes a boolean so in that case im covered.

 

Hope someone knows something.