Hello, I am kind of new to creating plugins as I only started today, so this may have an obvious answer, but I am trying to check whether or not the player is looking at a specific mob. I have already stumbled across the 'hasLineOfSight' method and I tried to implement it, but it did not work and said this: Any suggestions?
Is there not a way to just put in which mob I want it to check into the hasLineOfSight method? I would imagine that would be a faster and easier way of doing it, considering that the method does exactly what is detailed in its documentation, but I'm just really confused as to how I can put anything that works in there.
Player#hasLineOfSight is based off of the player's look direction and a specified mob's location, you need to specify a specific entity with a location attached to it, not a vague entity type. So to achieve what you're trying to do, you would need to loop through all mobs around the player (Player#getNearbyEntities), and if the mob is an enderman, check if the player has line of sight with it.