mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 03:48:01 +01:00
Add more line of sight methods
This commit is contained in:
parent
efcb04d753
commit
0f0e14fad5
@ -461,5 +461,13 @@ public interface RegionAccessor extends Keyed { // Paper
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
NamespacedKey getKey();
|
NamespacedKey getKey();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tell whether a line of sight exists between the given locations
|
||||||
|
* @param from Location to start at
|
||||||
|
* @param to target Location
|
||||||
|
* @return whether a line of sight exists between {@code from} and {@code to}
|
||||||
|
*/
|
||||||
|
public boolean lineOfSightExists(@NotNull Location from, @NotNull Location to);
|
||||||
// Paper end
|
// Paper end
|
||||||
}
|
}
|
||||||
|
@ -622,6 +622,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
|||||||
*/
|
*/
|
||||||
public boolean hasLineOfSight(@NotNull Entity other);
|
public boolean hasLineOfSight(@NotNull Entity other);
|
||||||
|
|
||||||
|
// Paper start
|
||||||
|
/**
|
||||||
|
* Checks whether the living entity has block line of sight to the given block.
|
||||||
|
* <p>
|
||||||
|
* This uses the same algorithm that hostile mobs use to find the closest
|
||||||
|
* player.
|
||||||
|
*
|
||||||
|
* @param location the location to determine line of sight to
|
||||||
|
* @return true if there is a line of sight, false if not
|
||||||
|
*/
|
||||||
|
public boolean hasLineOfSight(@NotNull Location location);
|
||||||
|
// Paper end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the living entity despawns when away from players or not.
|
* Returns if the living entity despawns when away from players or not.
|
||||||
* <p>
|
* <p>
|
||||||
|
Loading…
Reference in New Issue
Block a user