Class EntityUtil
java.lang.Object
kr.toxicity.model.api.util.EntityUtil
Utility class for entity-related calculations, primarily visibility checks.
This class provides methods to determine if an entity is within a player's field of view or render distance, optimizing client-side rendering performance.
- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanSee(@NotNull PlatformLocation player, @NotNull PlatformLocation target) Checks if a player can see a target entity based on sight tracing configuration.static floatCalculates the entity model view radius based on the server's view distance.static booleanisCustomNameVisible(@NotNull PlatformLocation player, @NotNull PlatformLocation target) Checks if a target entity's custom name is visible to a player.static booleanisInPoint(@NotNull PlatformLocation player, @NotNull PlatformLocation target) Checks if a target entity is directly in the player's crosshair (point of view).static doubleCalculates the render distance in blocks based on the server's view distance.
-
Method Details
-
renderDistance
public static double renderDistance()Calculates the render distance in blocks based on the server's view distance.- Returns:
- the render distance
- Since:
- 2.0.0
-
entityModelViewRadius
public static float entityModelViewRadius()Calculates the entity model view radius based on the server's view distance.- Returns:
- the view radius
- Since:
- 2.0.0
-
canSee
public static boolean canSee(@NotNull @NotNull PlatformLocation player, @NotNull @NotNull PlatformLocation target) Checks if a player can see a target entity based on sight tracing configuration.- Parameters:
player- the player's locationtarget- the target entity's location- Returns:
- true if the target is visible, false otherwise
- Since:
- 2.0.0
-
isCustomNameVisible
public static boolean isCustomNameVisible(@NotNull @NotNull PlatformLocation player, @NotNull @NotNull PlatformLocation target) Checks if a target entity's custom name is visible to a player.- Parameters:
player- the player's locationtarget- the target entity's location- Returns:
- true if the custom name is visible, false otherwise
- Since:
- 2.0.0
-
isInPoint
public static boolean isInPoint(@NotNull @NotNull PlatformLocation player, @NotNull @NotNull PlatformLocation target) Checks if a target entity is directly in the player's crosshair (point of view).- Parameters:
player- the player's locationtarget- the target entity's location- Returns:
- true if the target is in the player's point of view
- Since:
- 2.0.0
-