Class EntityDetectionUtil

java.lang.Object
com.hypixel.hytale.server.npc.util.EntityDetectionUtil

public final class EntityDetectionUtil extends Object
Shared rule for whether an entity can be sensed, targeted, or remembered by NPCs.
  • Method Details

    • isDetectableByNPCs

      public static boolean isDetectableByNPCs(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Whether the entity is detectable by NPCs.
      • Intangible entities are never detectable.
      • Non-player entities are otherwise always detectable.
      • Spectating players are never detectable.
      • Creative mode players are detectable only when their allowNPCDetection setting is enabled.
      • All other players are detectable.
      Parameters:
      ref - The entity reference to check.
      componentAccessor - The ComponentAccessor for component access.
      Returns:
      true if NPCs may detect the entity.
    • isDetectableByNPCs

      public static boolean isDetectableByNPCs(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nonnull Player playerComponent)
      Whether the player entity is detectable by NPCs, for callers that already hold the Player component.
      Parameters:
      ref - The entity reference to check.
      componentAccessor - The ComponentAccessor for component access.
      playerComponent - The player component of the entity.
      Returns:
      true if NPCs may detect the entity.