PositionCache

public class PositionCache

Class PositionCache. Provides positioncache functionality for the Hytale server.

java.lang.Object > PositionCache

Field Summary

maxDroppedItemDistance

private double maxDroppedItemDistance

Field maxDroppedItemDistance.

maxSpawnMarkerDistance

private double maxSpawnMarkerDistance

Field maxSpawnMarkerDistance.

maxSpawnBeaconDistance

private int maxSpawnBeaconDistance

Field maxSpawnBeaconDistance.

opaqueBlockSet

private int opaqueBlockSet

Field opaqueBlockSet.

players

protected EntityList players

Field players.

npcs

protected EntityList npcs

Field npcs.

cacheTTL

private float cacheTTL

Field cacheTTL.

positionCacheNextUpdate

private float positionCacheNextUpdate

Field positionCacheNextUpdate.

isBenchmarking

private boolean isBenchmarking

Field isBenchmarking.

isConfiguring

private boolean isConfiguring

Field isConfiguring.

couldBreathe

private boolean couldBreathe

Field couldBreathe.

roleStats

final RoleStats roleStats

Field roleStats.

droppedItemsSize

final int droppedItemsSize

Field droppedItemsSize.

transformComponent

final TransformComponent transformComponent

Field transformComponent.

position

final Vector3d position

Field position.

itemEntityRef

final Ref itemEntityRef

Field itemEntityRef.

itemComponent

final ItemComponent itemComponent

Field itemComponent.

itemEntityTransformComponent

final TransformComponent itemEntityTransformComponent

Field itemEntityTransformComponent.

squaredDistance

final double squaredDistance

Field squaredDistance.

value

final int value

Field value.

modelComponent

final ModelComponent modelComponent

Field modelComponent.

eyeHeight

final float eyeHeight

Field eyeHeight.

sx

final double sx

Field sx.

sy

final double sy

Field sy.

sz

final double sz

Field sz.

targetTransformComponent

final TransformComponent targetTransformComponent

Field targetTransformComponent.

targetPosition

final Vector3d targetPosition

Field targetPosition.

tx

final double tx

Field tx.

ty

final double ty

Field ty.

tz

final double tz

Field tz.

targetModelComponent

final ModelComponent targetModelComponent

Field targetModelComponent.

boundingBoxComponent

final BoundingBox boundingBoxComponent

Field boundingBoxComponent.

boundingBox

final Box boundingBox

Field boundingBox.

world

final World world

Field world.

blockSets

final Int2ObjectMap blockSets

Field blockSets.

opaqueSet

final IntSet opaqueSet

Field opaqueSet.

blockId

final int blockId

Field blockId.

blockType

final BlockType blockType

Field blockType.

cached

final boolean cached

Field cached.

start

final long start

Field start.

hasLineOfSight

final boolean hasLineOfSight

Field hasLineOfSight.

blocking

final boolean blocking

Field blocking.

squaredLength

final double squaredLength

Field squaredLength.

px

final double px

Field px.

py

final double py

Field py.

pz

final double pz

Field pz.

dx

final double dx

Field dx.

dy

final double dy

Field dy.

dz

final double dz

Field dz.

dotProduct

final double dotProduct

Field dotProduct.

dist2

final double dist2

Field dist2.

playerComponent

final Player playerComponent

Field playerComponent.

playerSettingsComponent

final PlayerSettings playerSettingsComponent

Field playerSettingsComponent.

chunk

public WorldChunk chunk

Field chunk.

result

public boolean result

Field result.

Method Detail

PositionCache

public public PositionCache (@Nonnull final Role role)

Method PositionCache.

Parameters:
@Nonnull final Role role

isBenchmarking

public boolean isBenchmarking ()

Method isBenchmarking.

setBenchmarking

public void setBenchmarking (final boolean benchmarking)

Method setBenchmarking.

Parameters:
final boolean benchmarking

setCouldBreathe

public void setCouldBreathe (final boolean couldBreathe)

Method setCouldBreathe.

Parameters:
final boolean couldBreathe

getPlayers

public EntityList getPlayers ()

Method getPlayers.

getNpcs

public EntityList getNpcs ()

Method getNpcs.

tickPositionCacheNextUpdate

public boolean tickPositionCacheNextUpdate (final float dt)

Method tickPositionCacheNextUpdate.

Parameters:
final float dt

resetPositionCacheNextUpdate

public void resetPositionCacheNextUpdate ()

Method resetPositionCacheNextUpdate.

getMaxDroppedItemDistance

public double getMaxDroppedItemDistance ()

Method getMaxDroppedItemDistance.

getMaxSpawnMarkerDistance

public double getMaxSpawnMarkerDistance ()

Method getMaxSpawnMarkerDistance.

getMaxSpawnBeaconDistance

public int getMaxSpawnBeaconDistance ()

Method getMaxSpawnBeaconDistance.

addExternalPositionCacheRegistration

public void addExternalPositionCacheRegistration (final Consumer registration)

Method addExternalPositionCacheRegistration.

Parameters:
final Consumer registration

getExternalRegistrations

public List> getExternalRegistrations ()

Method getExternalRegistrations.

reset

public void reset (final boolean isConfiguring)

Method reset.

Parameters:
final boolean isConfiguring

finalizeConfiguration

public void finalizeConfiguration ()

Method finalizeConfiguration.

clear

public void clear (final double tickTime)

Method clear.

Parameters:
final double tickTime

couldBreatheCached

public boolean couldBreatheCached ()

Method couldBreatheCached.

forEachPlayer

public void forEachPlayer (@Nonnull final DoubleQuadObjectConsumer, T, U, V> consumer, final T t, final U u, final V v, final double d, final ComponentAccessor componentAccessor)

Method forEachPlayer.

Parameters:
@Nonnull final DoubleQuadObjectConsumer, T, U, V> consumer
final T t
final U u
final V v
final double d
final ComponentAccessor componentAccessor

getClosestPlayerInRange

public Ref getClosestPlayerInRange (final double minRange, final double maxRange, @Nonnull final ComponentAccessor componentAccessor)

Method getClosestPlayerInRange.

Parameters:
final double minRange
final double maxRange
@Nonnull final ComponentAccessor componentAccessor

getClosestNPCInRange

public Ref getClosestNPCInRange (final double minRange, final double maxRange, @Nonnull final Predicate> filter, @Nonnull final ComponentAccessor componentAccessor)

Method getClosestNPCInRange.

Parameters:
final double minRange
final double maxRange
@Nonnull final Predicate> filter
@Nonnull final ComponentAccessor componentAccessor

processNPCsInRange

public void processNPCsInRange (@Nonnull final Ref ref, final double minRange, final double maxRange, final boolean useProjectedDistance, final Ref ignoredEntityReference, @Nonnull final Role role, @Nonnull final QuadPredicate, Role, T> filter, final S s, final T t, @Nonnull final ComponentAccessor componentAccessor)

Method processNPCsInRange.

Parameters:
@Nonnull final Ref ref
final double minRange
final double maxRange
final boolean useProjectedDistance
final Ref ignoredEntityReference
@Nonnull final Role role
@Nonnull final QuadPredicate, Role, T> filter
final S s
final T t
@Nonnull final ComponentAccessor componentAccessor

processPlayersInRange

public void processPlayersInRange (@Nonnull final Ref ref, final double minRange, final double maxRange, final boolean useProjectedDistance, final Ref ignoredEntityReference, @Nonnull final Role role, @Nonnull final QuadPredicate, Role, T> filter, final S s, final T t, @Nonnull final ComponentAccessor componentAccessor)

Method processPlayersInRange.

Parameters:
@Nonnull final Ref ref
final double minRange
final double maxRange
final boolean useProjectedDistance
final Ref ignoredEntityReference
@Nonnull final Role role
@Nonnull final QuadPredicate, Role, T> filter
final S s
final T t
@Nonnull final ComponentAccessor componentAccessor

processEntitiesInRange

public void processEntitiesInRange (@Nonnull final Ref ref, @Nonnull final EntityList entities, final double minRange, final double maxRange, final boolean useProjectedDistance, final Ref ignoredEntityReference, @Nonnull final Role role, @Nonnull final QuadPredicate, Role, T> filter, final S s, final T t, @Nonnull final ComponentAccessor componentAccessor)

Method processEntitiesInRange.

Parameters:
@Nonnull final Ref ref
@Nonnull final EntityList entities
final double minRange
final double maxRange
final boolean useProjectedDistance
final Ref ignoredEntityReference
@Nonnull final Role role
@Nonnull final QuadPredicate, Role, T> filter
final S s
final T t
@Nonnull final ComponentAccessor componentAccessor

getClosestDroppedItemInRange

public Ref getClosestDroppedItemInRange (@Nonnull final Ref ref, double minRange, double maxRange, @Nonnull final QuadPredicate, Role, ComponentAccessor> filter, final Role role, final S s, @Nonnull final ComponentAccessor componentAccessor)

Method getClosestDroppedItemInRange.

Parameters:
@Nonnull final Ref ref
double minRange
double maxRange
@Nonnull final QuadPredicate, Role, ComponentAccessor> filter
final Role role
final S s
@Nonnull final ComponentAccessor componentAccessor

isEntityCountInRange

public boolean isEntityCountInRange (final double minRange, final double maxRange, final int minCount, final int maxCount, final boolean findPlayers, final Role role, @Nonnull final QuadPredicate, Role, ComponentAccessor> filter, final S s, final ComponentAccessor componentAccessor)

Method isEntityCountInRange.

Parameters:
final double minRange
final double maxRange
final int minCount
final int maxCount
final boolean findPlayers
final Role role
@Nonnull final QuadPredicate, Role, ComponentAccessor> filter
final S s
final ComponentAccessor componentAccessor

countEntitiesInRange

public int countEntitiesInRange (final double minRange, final double maxRange, final boolean findPlayers, @Nonnull final QuadPredicate, T, ComponentAccessor> filter, final S s, final T t, final ComponentAccessor componentAccessor)

Method countEntitiesInRange.

Parameters:
final double minRange
final double maxRange
final boolean findPlayers
@Nonnull final QuadPredicate, T, ComponentAccessor> filter
final S s
final T t
final ComponentAccessor componentAccessor

requirePlayerDistanceSorted

public void requirePlayerDistanceSorted (final double v)

Method requirePlayerDistanceSorted.

Parameters:
final double v

requirePlayerDistanceUnsorted

public void requirePlayerDistanceUnsorted (final double v)

Method requirePlayerDistanceUnsorted.

Parameters:
final double v

requirePlayerDistanceAvoidance

public void requirePlayerDistanceAvoidance (final double v)

Method requirePlayerDistanceAvoidance.

Parameters:
final double v

requireEntityDistanceSorted

public void requireEntityDistanceSorted (final double v)

Method requireEntityDistanceSorted.

Parameters:
final double v

requireEntityDistanceUnsorted

public void requireEntityDistanceUnsorted (final double v)

Method requireEntityDistanceUnsorted.

Parameters:
final double v

requireEntityDistanceAvoidance

public void requireEntityDistanceAvoidance (final double v)

Method requireEntityDistanceAvoidance.

Parameters:
final double v

requireDroppedItemDistance

public void requireDroppedItemDistance (final double value)

Method requireDroppedItemDistance.

Parameters:
final double value

requireSpawnMarkerDistance

public void requireSpawnMarkerDistance (final double value)

Method requireSpawnMarkerDistance.

Parameters:
final double value

requireSpawnBeaconDistance

public void requireSpawnBeaconDistance (final int value)

Method requireSpawnBeaconDistance.

Parameters:
final int value

getRole

public Role getRole ()

Method getRole.

forEachNPCUnordered

public void forEachNPCUnordered (final double maxDistance, @Nonnull final QuadPredicate, T, U, ComponentAccessor> predicate, @Nonnull final QuadConsumer, T, V, R> consumer, final T t, final U u, final V v, final R r, final ComponentAccessor componentAccessor)

Method forEachNPCUnordered.

Parameters:
final double maxDistance
@Nonnull final QuadPredicate, T, U, ComponentAccessor> predicate
@Nonnull final QuadConsumer, T, V, R> consumer
final T t
final U u
final V v
final R r
final ComponentAccessor componentAccessor

forEachEntityInAvoidanceRange

public void forEachEntityInAvoidanceRange (@Nonnull final Set> ignoredEntitiesForAvoidance, @Nonnull final TriConsumer, T, CommandBuffer> consumer, final T t, final CommandBuffer commandBuffer)

Method forEachEntityInAvoidanceRange.

Parameters:
@Nonnull final Set> ignoredEntitiesForAvoidance
@Nonnull final TriConsumer, T, CommandBuffer> consumer
final T t
final CommandBuffer commandBuffer

setOpaqueBlockSet

public void setOpaqueBlockSet (final int blockSet)

Method setOpaqueBlockSet.

Parameters:
final int blockSet

testLineOfSightRays

static boolean testLineOfSightRays (@Nonnull final Ref ref, @Nonnull final Ref targetRef, @Nonnull final RayPredicate predicate, @Nonnull final T t, @Nonnull final ComponentAccessor componentAccessor)

Method testLineOfSightRays.

Parameters:
@Nonnull final Ref ref
@Nonnull final Ref targetRef
@Nonnull final RayPredicate predicate
@Nonnull final T t
@Nonnull final ComponentAccessor componentAccessor

hasLineOfSightInternal

private boolean hasLineOfSightInternal (@Nonnull final Ref ref, @Nonnull final Ref targetRef, @Nonnull final ComponentAccessor componentAccessor)

Method hasLineOfSightInternal.

Parameters:
@Nonnull final Ref ref
@Nonnull final Ref targetRef
@Nonnull final ComponentAccessor componentAccessor

hasLineOfSight

public boolean hasLineOfSight (@Nonnull final Ref ref, @Nonnull final Ref targetRef, @Nonnull final ComponentAccessor componentAccessor)

Method hasLineOfSight.

Parameters:
@Nonnull final Ref ref
@Nonnull final Ref targetRef
@Nonnull final ComponentAccessor componentAccessor

hasInverseLineOfSight

public boolean hasInverseLineOfSight (@Nonnull final Ref ref, @Nonnull final Ref targetRef, @Nonnull final ComponentAccessor componentAccessor)

Method hasInverseLineOfSight.

Parameters:
@Nonnull final Ref ref
@Nonnull final Ref targetRef
@Nonnull final ComponentAccessor componentAccessor

isFriendlyBlockingLineOfSight

public boolean isFriendlyBlockingLineOfSight (@Nonnull final Ref ref, @Nonnull final Ref targetRef, @Nonnull final ComponentAccessor componentAccessor)

Method isFriendlyBlockingLineOfSight.

Parameters:
@Nonnull final Ref ref
@Nonnull final Ref targetRef
@Nonnull final ComponentAccessor componentAccessor

testLineOfSightEntity

private boolean testLineOfSightEntity (@Nonnull final Ref ref, @Nonnull final Ref targetRef, @Nonnull final LineOfSightEntityBuffer buffer, @Nonnull final ComponentAccessor componentAccessor, final double length2)

Method testLineOfSightEntity.

Parameters:
@Nonnull final Ref ref
@Nonnull final Ref targetRef
@Nonnull final LineOfSightEntityBuffer buffer
@Nonnull final ComponentAccessor componentAccessor
final double length2

clearLineOfSightCache

private void clearLineOfSightCache (final double tickTime)

Method clearLineOfSightCache.

Parameters:
final double tickTime

rayIsIntersectingEntity

static boolean rayIsIntersectingEntity (@Nonnull final Ref ref, @Nonnull final Vector3d pos, @Nonnull final Vector3d dir, @Nonnull final Vector2d minMax, final double length2, @Nonnull final ComponentAccessor componentAccessor)

Method rayIsIntersectingEntity.

Parameters:
@Nonnull final Ref ref
@Nonnull final Vector3d pos
@Nonnull final Vector3d dir
@Nonnull final Vector2d minMax
final double length2
@Nonnull final ComponentAccessor componentAccessor

getDroppedItemList

public List> getDroppedItemList ()

Method getDroppedItemList.

getSpawnMarkerList

public List> getSpawnMarkerList ()

Method getSpawnMarkerList.

getSpawnBeaconList

public List> getSpawnBeaconList ()

Method getSpawnBeaconList.

if

public else if (playerComponent.getGameMode()

Method if.

Parameters:
playerComponent.getGameMode( playerComponent.getGameMode(

clearRefs

public void clearRefs ()

Method clearRefs.