Started by
BeanieBoiGaming
on
Topic category: Help with Minecraft modding (Java Edition)
I'm trying to make a mob that only moves when you are not looking directly at it and teleports away when you look away completely. I'm not very experienced with coding.
Any solutions?
You can't to get one target for checking the visibility of the mob, and you can't check all the players, so, there is no solution for this problem. I tried to create reputation system and get the same problem, tring to make the mob attack player if it's reputation is lower then 0.
But you can try get all players in some radius and then check visibility:
get reletive vector (mob position - player position) and if the angle between this vector and player look vector is higher then 70 degrees (normal field of view), allow mob to move. But there is no procedure block for angles between two vectors so you need some maths.