CommandHelper

CommandHelper

46.5k Downloads

functions to use lines of sight

LadyCailinBot opened this issue ยท 8 comments

commented

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)]

commented

Comment by EntityReborn

You are aware this is only pertinent to blocks, correct?

commented

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?

commented

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.

commented

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.

commented

Comment by jb_aero

Yeah that doesn't sound anything like what you requested here lol

commented

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.

commented

Comment by jb_aero

I'm still going to add them because they're useful anyway. Think laser vision.

commented

Comment by Hekta

Added