Class EntityUtil

java.lang.Object
kr.toxicity.model.api.util.EntityUtil

@Internal public final class EntityUtil extends Object
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 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 location
      target - 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 location
      target - 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 location
      target - the target entity's location
      Returns:
      true if the target is in the player's point of view
      Since:
      2.0.0