Contents
- Description
- Nested Class Summary
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- getComponentType()
- get(Ref, ComponentAccessor)
- setRoleIndex(int)
- getRoleIndex()
- getRoleStats()
- isBenchmarking()
- setBenchmarking(boolean)
- setCouldBreathe(boolean)
- getPlayers()
- getNpcs()
- tickPositionCacheNextUpdate(float)
- resetPositionCacheNextUpdate()
- getMaxDroppedItemDistance()
- getMaxSpawnMarkerDistance()
- getMaxSpawnBeaconDistance()
- addExternalPositionCacheRegistration(Consumer)
- getExternalRegistrations()
- reset(boolean)
- finalizeConfiguration()
- clear(double)
- couldBreatheCached()
- forEachPlayer(DoubleQuadObjectConsumer, T, U, V, double, ComponentAccessor)
- getClosestPlayerInRange(double, double, ComponentAccessor)
- getClosestPlayerInRange(double, double, Predicate, ComponentAccessor)
- getClosestNPCInRange(double, double, Predicate, ComponentAccessor)
- processNPCsInRange(Ref, double, double, boolean, Ref, ExecutionSupport, QuadPredicate, S, T, ComponentAccessor)
- processPlayersInRange(Ref, double, double, boolean, Ref, ExecutionSupport, QuadPredicate, S, T, ComponentAccessor)
- processEntitiesInRange(Ref, EntityList, double, double, boolean, Ref, ExecutionSupport, QuadPredicate, S, T, ComponentAccessor)
- getClosestDroppedItemInRange(Ref, double, double, TriPredicate, S, ComponentAccessor)
- isEntityCountInRange(double, double, int, int, boolean, int, QuadPredicate, S, ComponentAccessor)
- countEntitiesInRange(double, double, boolean, QuadPredicate, S, T, ComponentAccessor)
- requirePlayerDistanceSorted(double)
- requirePlayerDistanceUnsorted(double)
- requirePlayerDistanceAvoidance(double)
- requireEntityDistanceSorted(double)
- requireEntityDistanceUnsorted(double)
- requireEntityDistanceAvoidance(double)
- requireDroppedItemDistance(double)
- requireSpawnMarkerDistance(double)
- requireSpawnBeaconDistance(int)
- forEachNPCUnordered(double, QuadPredicate, QuadConsumer, T, U, V, R, ComponentAccessor)
- forEachEntityInAvoidanceRange(Set, TriConsumer, T, CommandBuffer)
- forEachEntityInAvoidanceRange(Set, QuadConsumer, T, U, CommandBuffer)
- setOpaqueBlockSet(int)
- hasLineOfSight(Ref, Ref, ComponentAccessor)
- hasInverseLineOfSight(Ref, Ref, ComponentAccessor)
- isFriendlyBlockingLineOfSight(Ref, Ref, ComponentAccessor)
- getDroppedItemList()
- getSpawnMarkerList()
- getSpawnBeaconList()
- clone()
Class PositionCache
java.lang.Object
com.hypixel.hytale.server.npc.role.support.PositionCache
- All Implemented Interfaces:
Component<EntityStore>, Cloneable
PositionCache is updated at least once per tick and caches information which might be accessed by multiple sensors like
entity and player lists.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final BiPredicate<Ref<EntityStore>, ComponentAccessor<EntityStore>> static final BiPredicate<Ref<EntityStore>, ComponentAccessor<EntityStore>> static final doublestatic final floatFields inherited from interface Component
EMPTY_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExternalPositionCacheRegistration(Consumer<ExecutionSupport> registration) Should be used to register methods by which external systems and components want to update aspects of the PositionCache that are only modifiable during initialisation (e.g. distance ranges).voidclear(double tickTime) clone()boolean<S,T> int countEntitiesInRange(double minRange, double maxRange, boolean findPlayers, QuadPredicate<S, Ref<EntityStore>, T, ComponentAccessor<EntityStore>> filter, S s, T t, ComponentAccessor<EntityStore> componentAccessor) void<T,U> void forEachEntityInAvoidanceRange(Set<Ref<EntityStore>> ignoredEntitiesForAvoidance, QuadConsumer<Ref<EntityStore>, T, U, CommandBuffer<EntityStore>> consumer, T t, U u, CommandBuffer<EntityStore> commandBuffer) <T> voidforEachEntityInAvoidanceRange(Set<Ref<EntityStore>> ignoredEntitiesForAvoidance, TriConsumer<Ref<EntityStore>, T, CommandBuffer<EntityStore>> consumer, T t, CommandBuffer<EntityStore> commandBuffer) <T,U, V, R> void forEachNPCUnordered(double maxDistance, QuadPredicate<Ref<EntityStore>, T, U, ComponentAccessor<EntityStore>> predicate, QuadConsumer<Ref<EntityStore>, T, V, R> consumer, T t, U u, V v, R r, ComponentAccessor<EntityStore> componentAccessor) <T,U, V> void forEachPlayer(DoubleQuadObjectConsumer<Ref<EntityStore>, T, U, V> consumer, T t, U u, V v, double d, ComponentAccessor<EntityStore> componentAccessor) static PositionCacheget(Ref<EntityStore> ref, ComponentAccessor<EntityStore> accessor) <S> Ref<EntityStore> getClosestDroppedItemInRange(Ref<EntityStore> ref, double minRange, double maxRange, TriPredicate<S, Ref<EntityStore>, ComponentAccessor<EntityStore>> filter, S s, ComponentAccessor<EntityStore> componentAccessor) getClosestNPCInRange(double minRange, double maxRange, Predicate<Ref<EntityStore>> filter, ComponentAccessor<EntityStore> componentAccessor) getClosestPlayerInRange(double minRange, double maxRange, ComponentAccessor<EntityStore> componentAccessor) getClosestPlayerInRange(double minRange, double maxRange, Predicate<Ref<EntityStore>> filter, ComponentAccessor<EntityStore> componentAccessor) static ComponentType<EntityStore, PositionCache> doubleintdoublegetNpcs()intbooleanhasInverseLineOfSight(Ref<EntityStore> ref, Ref<EntityStore> targetRef, ComponentAccessor<EntityStore> componentAccessor) booleanhasLineOfSight(Ref<EntityStore> ref, Ref<EntityStore> targetRef, ComponentAccessor<EntityStore> componentAccessor) boolean<S> booleanisEntityCountInRange(double minRange, double maxRange, int minCount, int maxCount, boolean findPlayers, int roleIndex, QuadPredicate<S, Ref<EntityStore>, Integer, ComponentAccessor<EntityStore>> filter, S s, ComponentAccessor<EntityStore> componentAccessor) booleanisFriendlyBlockingLineOfSight(Ref<EntityStore> ref, Ref<EntityStore> targetRef, ComponentAccessor<EntityStore> componentAccessor) <S,T> void processEntitiesInRange(Ref<EntityStore> ref, EntityList entities, double minRange, double maxRange, boolean useProjectedDistance, Ref<EntityStore> ignoredEntityReference, ExecutionSupport executionSupport, QuadPredicate<S, Ref<EntityStore>, ExecutionSupport, T> filter, S s, T t, ComponentAccessor<EntityStore> componentAccessor) <S,T> void processNPCsInRange(Ref<EntityStore> ref, double minRange, double maxRange, boolean useProjectedDistance, Ref<EntityStore> ignoredEntityReference, ExecutionSupport executionSupport, QuadPredicate<S, Ref<EntityStore>, ExecutionSupport, T> filter, S s, T t, ComponentAccessor<EntityStore> componentAccessor) <S,T> void processPlayersInRange(Ref<EntityStore> ref, double minRange, double maxRange, boolean useProjectedDistance, Ref<EntityStore> ignoredEntityReference, ExecutionSupport executionSupport, QuadPredicate<S, Ref<EntityStore>, ExecutionSupport, T> filter, S s, T t, ComponentAccessor<EntityStore> componentAccessor) voidrequireDroppedItemDistance(double value) voidrequireEntityDistanceAvoidance(double v) voidrequireEntityDistanceSorted(double v) voidrequireEntityDistanceUnsorted(double v) voidrequirePlayerDistanceAvoidance(double v) voidrequirePlayerDistanceSorted(double v) voidrequirePlayerDistanceUnsorted(double v) voidrequireSpawnBeaconDistance(int value) voidrequireSpawnMarkerDistance(double value) voidreset(boolean isConfiguring) voidvoidsetBenchmarking(boolean benchmarking) voidsetCouldBreathe(boolean couldBreathe) voidsetOpaqueBlockSet(int blockSet) voidsetRoleIndex(int roleIndex) Set the owning Role's index for benchmark counter attribution.booleantickPositionCacheNextUpdate(float dt) Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Component
cloneSerializable
-
Field Details
-
IS_VALID_PLAYER
-
IS_VALID_NPC
-
MIN_LOS_BLOCKING_DISTANCE_SQUARED
public static final double MIN_LOS_BLOCKING_DISTANCE_SQUARED- See Also:
-
FUNCTION_CAN_BE_ONLY_CALLED_WHILE_CONFIGURING_POSITION_CACHE
- See Also:
-
POSITION_CACHE_TTL_SECONDS
public static final float POSITION_CACHE_TTL_SECONDS- See Also:
-
-
Constructor Details
-
PositionCache
-
PositionCache
public PositionCache()
-
-
Method Details
-
getComponentType
-
get
@Nonnull public static PositionCache get(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> accessor) -
setRoleIndex
public void setRoleIndex(int roleIndex) Set the owning Role's index for benchmark counter attribution. -
getRoleIndex
public int getRoleIndex() -
getRoleStats
-
isBenchmarking
public boolean isBenchmarking() -
setBenchmarking
public void setBenchmarking(boolean benchmarking) -
setCouldBreathe
public void setCouldBreathe(boolean couldBreathe) -
getPlayers
-
getNpcs
-
tickPositionCacheNextUpdate
public boolean tickPositionCacheNextUpdate(float dt) -
resetPositionCacheNextUpdate
public void resetPositionCacheNextUpdate() -
getMaxDroppedItemDistance
public double getMaxDroppedItemDistance() -
getMaxSpawnMarkerDistance
public double getMaxSpawnMarkerDistance() -
getMaxSpawnBeaconDistance
public int getMaxSpawnBeaconDistance() -
addExternalPositionCacheRegistration
Should be used to register methods by which external systems and components want to update aspects of the PositionCache that are only modifiable during initialisation (e.g. distance ranges).- Parameters:
registration- the registration method.
-
getExternalRegistrations
-
reset
public void reset(boolean isConfiguring) -
finalizeConfiguration
public void finalizeConfiguration() -
clear
public void clear(double tickTime) -
couldBreatheCached
public boolean couldBreatheCached() -
forEachPlayer
public <T,U, void forEachPlayerV> (@Nonnull DoubleQuadObjectConsumer<Ref<EntityStore>, T, U, V> consumer, T t, U u, V v, double d, ComponentAccessor<EntityStore> componentAccessor) -
getClosestPlayerInRange
@Nullable public Ref<EntityStore> getClosestPlayerInRange(double minRange, double maxRange, @Nonnull ComponentAccessor<EntityStore> componentAccessor) -
getClosestPlayerInRange
@Nullable public Ref<EntityStore> getClosestPlayerInRange(double minRange, double maxRange, @Nonnull Predicate<Ref<EntityStore>> filter, @Nonnull ComponentAccessor<EntityStore> componentAccessor) -
getClosestNPCInRange
@Nullable public Ref<EntityStore> getClosestNPCInRange(double minRange, double maxRange, @Nonnull Predicate<Ref<EntityStore>> filter, @Nonnull ComponentAccessor<EntityStore> componentAccessor) -
processNPCsInRange
public <S,T> void processNPCsInRange(@Nonnull Ref<EntityStore> ref, double minRange, double maxRange, boolean useProjectedDistance, Ref<EntityStore> ignoredEntityReference, @Nonnull ExecutionSupport executionSupport, @Nonnull QuadPredicate<S, Ref<EntityStore>, ExecutionSupport, T> filter, S s, T t, @Nonnull ComponentAccessor<EntityStore> componentAccessor) -
processPlayersInRange
public <S,T> void processPlayersInRange(@Nonnull Ref<EntityStore> ref, double minRange, double maxRange, boolean useProjectedDistance, Ref<EntityStore> ignoredEntityReference, @Nonnull ExecutionSupport executionSupport, @Nonnull QuadPredicate<S, Ref<EntityStore>, ExecutionSupport, T> filter, S s, T t, @Nonnull ComponentAccessor<EntityStore> componentAccessor) -
processEntitiesInRange
public <S,T> void processEntitiesInRange(@Nonnull Ref<EntityStore> ref, @Nonnull EntityList entities, double minRange, double maxRange, boolean useProjectedDistance, Ref<EntityStore> ignoredEntityReference, @Nonnull ExecutionSupport executionSupport, @Nonnull QuadPredicate<S, Ref<EntityStore>, ExecutionSupport, T> filter, S s, T t, @Nonnull ComponentAccessor<EntityStore> componentAccessor) -
getClosestDroppedItemInRange
@Nullable public <S> Ref<EntityStore> getClosestDroppedItemInRange(@Nonnull Ref<EntityStore> ref, double minRange, double maxRange, @Nonnull TriPredicate<S, Ref<EntityStore>, ComponentAccessor<EntityStore>> filter, S s, @Nonnull ComponentAccessor<EntityStore> componentAccessor) -
isEntityCountInRange
public <S> boolean isEntityCountInRange(double minRange, double maxRange, int minCount, int maxCount, boolean findPlayers, int roleIndex, @Nonnull QuadPredicate<S, Ref<EntityStore>, Integer, ComponentAccessor<EntityStore>> filter, S s, ComponentAccessor<EntityStore> componentAccessor) -
countEntitiesInRange
public <S,T> int countEntitiesInRange(double minRange, double maxRange, boolean findPlayers, @Nonnull QuadPredicate<S, Ref<EntityStore>, T, ComponentAccessor<EntityStore>> filter, S s, T t, ComponentAccessor<EntityStore> componentAccessor) -
requirePlayerDistanceSorted
public void requirePlayerDistanceSorted(double v) -
requirePlayerDistanceUnsorted
public void requirePlayerDistanceUnsorted(double v) -
requirePlayerDistanceAvoidance
public void requirePlayerDistanceAvoidance(double v) -
requireEntityDistanceSorted
public void requireEntityDistanceSorted(double v) -
requireEntityDistanceUnsorted
public void requireEntityDistanceUnsorted(double v) -
requireEntityDistanceAvoidance
public void requireEntityDistanceAvoidance(double v) -
requireDroppedItemDistance
public void requireDroppedItemDistance(double value) -
requireSpawnMarkerDistance
public void requireSpawnMarkerDistance(double value) -
requireSpawnBeaconDistance
public void requireSpawnBeaconDistance(int value) -
forEachNPCUnordered
public <T,U, void forEachNPCUnorderedV, R> (double maxDistance, @Nonnull QuadPredicate<Ref<EntityStore>, T, U, ComponentAccessor<EntityStore>> predicate, @Nonnull QuadConsumer<Ref<EntityStore>, T, V, R> consumer, T t, U u, V v, R r, ComponentAccessor<EntityStore> componentAccessor) -
forEachEntityInAvoidanceRange
public <T> void forEachEntityInAvoidanceRange(@Nonnull Set<Ref<EntityStore>> ignoredEntitiesForAvoidance, @Nonnull TriConsumer<Ref<EntityStore>, T, CommandBuffer<EntityStore>> consumer, T t, CommandBuffer<EntityStore> commandBuffer) -
forEachEntityInAvoidanceRange
public <T,U> void forEachEntityInAvoidanceRange(@Nonnull Set<Ref<EntityStore>> ignoredEntitiesForAvoidance, @Nonnull QuadConsumer<Ref<EntityStore>, T, U, CommandBuffer<EntityStore>> consumer, T t, U u, CommandBuffer<EntityStore> commandBuffer) -
setOpaqueBlockSet
public void setOpaqueBlockSet(int blockSet) -
hasLineOfSight
public boolean hasLineOfSight(@Nonnull Ref<EntityStore> ref, @Nonnull Ref<EntityStore> targetRef, @Nonnull ComponentAccessor<EntityStore> componentAccessor) -
hasInverseLineOfSight
public boolean hasInverseLineOfSight(@Nonnull Ref<EntityStore> ref, @Nonnull Ref<EntityStore> targetRef, @Nonnull ComponentAccessor<EntityStore> componentAccessor) -
isFriendlyBlockingLineOfSight
public boolean isFriendlyBlockingLineOfSight(@Nonnull Ref<EntityStore> ref, @Nonnull Ref<EntityStore> targetRef, @Nonnull ComponentAccessor<EntityStore> componentAccessor) -
getDroppedItemList
-
getSpawnMarkerList
-
getSpawnBeaconList
-
clone
- Specified by:
clonein interfaceComponent<EntityStore>- Returns:
- a clone instance of the original component instance.
-