functions to use lines of sight
LadyCailinBot opened this issue ยท 8 comments
CMDHELPER-2787 - Reported by Hekta
entity_line_of_sight(entityID, [maxDistance, [transparent]])
http://jd.bukkit.org/dev/apidocs/org/bukkit/entity/LivingEntity.html#getLineOfSight(java.util.HashSet, int)
has_entity_in_line_of_sight(entityID, otherEntityID)
[http://jd.bukkit.org/dev/apidocs/org/bukkit/entity/LivingEntity.html#hasLineOfSight(org.bukkit.entity.Entity)]
Comment by EntityReborn
You are aware this is only pertinent to blocks, correct?
Comment by Hekta
Maybe I misunderstood, I understand that getLineOfSight returns an array of all blocks along the living entity's line of sight, and that hasLineOfSight returns an boolean, checking if an other entity is in the line of sight of a living entity, I'm wrong?
In fact, I search a way to find which entity is on a player's cursor, I thought that one of these functions could be helpful?
Comment by EntityReborn
As far as I am aware, there is no known way to know which entity is under the cursor, without a large and inaccurate calculation. This has been brought up several times.
Comment by Hekta
Finally I found [what I need|https://github.com/ACzChef/CHDangerous/blob/master/src/main/java/com/brothercraft/chdangerous/functions/CHdPlayer.java#L88-90] in the CHDangerous extension.
Thanks.
Comment by jb_aero
Yeah that doesn't sound anything like what you requested here lol
Comment by Hekta
I was thinking that this functions could be helpful to write a script to find the entity on a player's cursor, as it seems there is no direct way to do this directly in bukkit, this is why I requested them, but apparently I misunderstood their descriptions.
Comment by jb_aero
I'm still going to add them because they're useful anyway. Think laser vision.