Contents
Class EntityDetectionUtil
java.lang.Object
com.hypixel.hytale.server.npc.util.EntityDetectionUtil
Shared rule for whether an entity can be sensed, targeted, or remembered by NPCs.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisDetectableByNPCs(Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor) Whether the entity is detectable by NPCs.static booleanisDetectableByNPCs(Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor, Player playerComponent) Whether the player entity is detectable by NPCs, for callers that already hold thePlayercomponent.
-
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
allowNPCDetectionsetting is enabled. - All other players are detectable.
- Parameters:
ref- The entity reference to check.componentAccessor- TheComponentAccessorfor component access.- Returns:
trueif 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 thePlayercomponent.- Parameters:
ref- The entity reference to check.componentAccessor- TheComponentAccessorfor component access.playerComponent- The player component of the entity.- Returns:
trueif NPCs may detect the entity.
-