Class InteractionManager
java.lang.Object
com.hypixel.hytale.server.core.entity.InteractionManager
- All Implemented Interfaces:
Component<EntityStore>,Cloneable
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Predicate<InteractionChain> private final it.unimi.dsi.fastutil.ints.Int2ObjectMap<InteractionChain> private final it.unimi.dsi.fastutil.objects.ObjectList<InteractionChain> protected CommandBuffer<EntityStore> private final CooldownHandlerstatic final float[]private final LivingEntityprivate final float[]private final boolean[]private booleanprivate final IInteractionSimulationHandlerprivate intprivate intprivate static final com.hypixel.hytale.logger.HytaleLoggerstatic final doubleprivate longprivate final PlayerRefprivate final it.unimi.dsi.fastutil.objects.ObjectList<SyncInteractionChain> private final it.unimi.dsi.fastutil.objects.ObjectList<InteractionSyncData> private booleanprivate final it.unimi.dsi.fastutil.ints.Int2ObjectMap<InteractionChain> Fields inherited from interface com.hypixel.hytale.component.Component
EMPTY_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionInteractionManager(LivingEntity entity, PlayerRef playerRef, IInteractionSimulationHandler simulationHandler) -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleanapplyRules(InteractionChainData data, InteractionType type, int heldItemSlot, RootInteraction rootInteraction, Map<?, InteractionChain> chains, List<InteractionChain> chainsToCancel) booleanapplyRules(InteractionContext context, InteractionChainData data, InteractionType type, RootInteraction rootInteraction) voidcancelChains(InteractionChain chain) booleancanRun(InteractionType type, short equipSlot, RootInteraction rootInteraction) booleancanRun(InteractionType type, RootInteraction rootInteraction) voidclear()voidclearAllGlobalTimeShift(float dt) clone()voidcopyFrom(InteractionManager interactionManager) Deprecated.private voiddoTickChain(Ref<EntityStore> ref, InteractionChain chain) voidexecuteChain(Ref<EntityStore> ref, CommandBuffer<EntityStore> commandBuffer, InteractionChain chain) private voidexecuteChain0(Ref<EntityStore> ref, InteractionChain chain) <T> TforEachInteraction(TriFunction<InteractionChain, Interaction, T, T> func, T val) private static <T> TforEachInteraction(Map<?, InteractionChain> chains, TriFunction<InteractionChain, Interaction, T, T> func, T val) private InteractionChaingetChain(int chainId, ForkedChainId forkedChainId) it.unimi.dsi.fastutil.ints.Int2ObjectMap<InteractionChain> floatprivate longit.unimi.dsi.fastutil.objects.ObjectList<SyncInteractionChain> private voidhandleCancelledChain(Ref<EntityStore> ref, InteractionChain chain) initChain(InteractionChainData data, InteractionType type, InteractionContext context, RootInteraction rootInteraction, Runnable onCompletion, boolean forceRemoteSync) initChain(InteractionType type, InteractionContext context, RootInteraction rootInteraction, boolean forceRemoteSync) initChain(InteractionType type, InteractionContext context, RootInteraction rootInteraction, int entityId, BlockPosition blockPosition, boolean forceRemoteSync) private booleanisOnCooldown(Ref<EntityStore> ref, InteractionType type, RootInteraction root, boolean remote) private static SyncInteractionChainmakeSyncPacket(InteractionChain chain, int operationBaseIndex, List<InteractionSyncData> interactionData) voidprivate voidremoveInteractionIfFinished(Ref<EntityStore> ref, InteractionChain chain, InteractionEntry entry) voidsendCancelPacket(int chainId, ForkedChainId forkedChainId) private voidsendCancelPacket(InteractionChain chain) voidsendSyncPacket(InteractionChain chain, int operationBaseIndex, List<InteractionSyncData> interactionData) private InteractionSyncDataserverTick(Ref<EntityStore> ref, InteractionChain chain, long tickTime) voidsetGlobalTimeShift(InteractionType type, float shift) voidsetHasRemoteClient(boolean hasRemoteClient) Deprecated, for removal: This API element is subject to removal in a future version.private voidsimulationTick(Ref<EntityStore> ref, InteractionChain chain, long tickTime) voidstartChain(Ref<EntityStore> ref, CommandBuffer<EntityStore> commandBuffer, InteractionType type, InteractionContext context, RootInteraction rootInteraction) voidsync(Ref<EntityStore> ref, ChainSyncStorage chainSyncStorage, SyncInteractionChain packet) private booleansyncStart(Ref<EntityStore> ref, SyncInteractionChain packet) voidtick(Ref<EntityStore> ref, CommandBuffer<EntityStore> commandBuffer, float dt) private booleantickChain(InteractionChain chain) private booleantryConsumePacketQueue(Ref<EntityStore> ref, Deque<SyncInteractionChain> packetQueue) voidtryRunHeldInteraction(Ref<EntityStore> ref, CommandBuffer<EntityStore> commandBuffer, InteractionType type) voidtryRunHeldInteraction(Ref<EntityStore> ref, CommandBuffer<EntityStore> commandBuffer, InteractionType type, short equipSlot) booleantryStartChain(Ref<EntityStore> ref, CommandBuffer<EntityStore> commandBuffer, InteractionType type, InteractionContext context, RootInteraction rootInteraction) private booleanwaitingForClient(Ref<EntityStore> ref) voidwalkChain(Ref<EntityStore> ref, Collector collector, InteractionType type, ComponentAccessor<EntityStore> componentAccessor) voidwalkChain(Ref<EntityStore> ref, Collector collector, InteractionType type, RootInteraction rootInteraction, ComponentAccessor<EntityStore> componentAccessor) static voidwalkChain(Collector collector, InteractionType type, InteractionContext context, RootInteraction rootInteraction) static booleanwalkInteraction(Collector collector, InteractionContext context, CollectorTag tag, String id) static booleanwalkInteractions(Collector collector, InteractionContext context, CollectorTag tag, String[] interactionIds) Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.hypixel.hytale.component.Component
cloneSerializable
-
Field Details
-
MAX_REACH_DISTANCE
public static final double MAX_REACH_DISTANCE- See Also:
-
DEFAULT_CHARGE_TIMES
public static final float[] DEFAULT_CHARGE_TIMES -
LOGGER
private static final com.hypixel.hytale.logger.HytaleLogger LOGGER -
chains
-
unmodifiableChains
@Nonnull private final it.unimi.dsi.fastutil.ints.Int2ObjectMap<InteractionChain> unmodifiableChains -
cooldownHandler
-
entity
-
playerRef
-
hasRemoteClient
private boolean hasRemoteClient -
interactionSimulationHandler
-
tempSyncDataList
@Nonnull private final it.unimi.dsi.fastutil.objects.ObjectList<InteractionSyncData> tempSyncDataList -
lastServerChainId
private int lastServerChainId -
lastClientChainId
private int lastClientChainId -
packetQueueTime
private long packetQueueTime -
globalTimeShift
private final float[] globalTimeShift -
globalTimeShiftDirty
private final boolean[] globalTimeShiftDirty -
timeShiftsDirty
private boolean timeShiftsDirty -
syncPackets
-
chainStartQueue
-
cachedTickChain
-
commandBuffer
-
-
Constructor Details
-
InteractionManager
public InteractionManager(@Nonnull LivingEntity entity, @Nullable PlayerRef playerRef, @Nonnull IInteractionSimulationHandler simulationHandler)
-
-
Method Details
-
getChains
-
getInteractionSimulationHandler
-
getOperationTimeoutThreshold
private long getOperationTimeoutThreshold() -
waitingForClient
-
setHasRemoteClient
Deprecated, for removal: This API element is subject to removal in a future version. -
copyFrom
Deprecated. -
tick
public void tick(@Nonnull Ref<EntityStore> ref, @Nonnull CommandBuffer<EntityStore> commandBuffer, float dt) -
tryConsumePacketQueue
private boolean tryConsumePacketQueue(@Nonnull Ref<EntityStore> ref, @Nonnull Deque<SyncInteractionChain> packetQueue) -
getChain
-
tickChain
-
handleCancelledChain
-
doTickChain
-
serverTick
@Nullable private InteractionSyncData serverTick(@Nonnull Ref<EntityStore> ref, @Nonnull InteractionChain chain, long tickTime) -
removeInteractionIfFinished
private void removeInteractionIfFinished(@Nonnull Ref<EntityStore> ref, @Nonnull InteractionChain chain, @Nonnull InteractionEntry entry) -
simulationTick
private void simulationTick(@Nonnull Ref<EntityStore> ref, @Nonnull InteractionChain chain, long tickTime) -
syncStart
-
sync
public void sync(@Nonnull Ref<EntityStore> ref, @Nonnull ChainSyncStorage chainSyncStorage, @Nonnull SyncInteractionChain packet) -
canRun
-
canRun
public boolean canRun(@Nonnull InteractionType type, short equipSlot, @Nonnull RootInteraction rootInteraction) -
applyRules
public boolean applyRules(@Nonnull InteractionContext context, @Nonnull InteractionChainData data, @Nonnull InteractionType type, @Nonnull RootInteraction rootInteraction) -
cancelChains
-
applyRules
private static boolean applyRules(@Nullable InteractionChainData data, @Nonnull InteractionType type, int heldItemSlot, @Nullable RootInteraction rootInteraction, @Nonnull Map<?, InteractionChain> chains, @Nullable List<InteractionChain> chainsToCancel) -
tryStartChain
public boolean tryStartChain(@Nonnull Ref<EntityStore> ref, @Nonnull CommandBuffer<EntityStore> commandBuffer, @Nonnull InteractionType type, @Nonnull InteractionContext context, @Nonnull RootInteraction rootInteraction) -
startChain
public void startChain(@Nonnull Ref<EntityStore> ref, @Nonnull CommandBuffer<EntityStore> commandBuffer, @Nonnull InteractionType type, @Nonnull InteractionContext context, @Nonnull RootInteraction rootInteraction) -
initChain
@Nonnull public InteractionChain initChain(@Nonnull InteractionType type, @Nonnull InteractionContext context, @Nonnull RootInteraction rootInteraction, boolean forceRemoteSync) -
initChain
@Nonnull public InteractionChain initChain(@Nonnull InteractionType type, @Nonnull InteractionContext context, @Nonnull RootInteraction rootInteraction, int entityId, @Nullable BlockPosition blockPosition, boolean forceRemoteSync) -
initChain
@Nonnull public InteractionChain initChain(@Nonnull InteractionChainData data, @Nonnull InteractionType type, @Nonnull InteractionContext context, @Nonnull RootInteraction rootInteraction, @Nullable Runnable onCompletion, boolean forceRemoteSync) -
queueExecuteChain
-
executeChain
public void executeChain(@Nonnull Ref<EntityStore> ref, @Nonnull CommandBuffer<EntityStore> commandBuffer, @Nonnull InteractionChain chain) -
executeChain0
-
isOnCooldown
private boolean isOnCooldown(@Nonnull Ref<EntityStore> ref, @Nonnull InteractionType type, @Nonnull RootInteraction root, boolean remote) -
tryRunHeldInteraction
public void tryRunHeldInteraction(@Nonnull Ref<EntityStore> ref, @Nonnull CommandBuffer<EntityStore> commandBuffer, @Nonnull InteractionType type) -
tryRunHeldInteraction
public void tryRunHeldInteraction(@Nonnull Ref<EntityStore> ref, @Nonnull CommandBuffer<EntityStore> commandBuffer, @Nonnull InteractionType type, short equipSlot) -
sendSyncPacket
public void sendSyncPacket(@Nonnull InteractionChain chain, int operationBaseIndex, @Nullable List<InteractionSyncData> interactionData) -
makeSyncPacket
@Nonnull private static SyncInteractionChain makeSyncPacket(@Nonnull InteractionChain chain, int operationBaseIndex, @Nullable List<InteractionSyncData> interactionData) -
sendCancelPacket
-
sendCancelPacket
-
clear
public void clear() -
clearAllGlobalTimeShift
public void clearAllGlobalTimeShift(float dt) -
setGlobalTimeShift
-
getGlobalTimeShift
-
forEachInteraction
public <T> T forEachInteraction(@Nonnull TriFunction<InteractionChain, Interaction, T, T> func, @Nonnull T val) -
forEachInteraction
private static <T> T forEachInteraction(@Nonnull Map<?, InteractionChain> chains, @Nonnull TriFunction<InteractionChain, Interaction, T, T> func, @Nonnull T val) -
walkChain
public void walkChain(@Nonnull Ref<EntityStore> ref, @Nonnull Collector collector, @Nonnull InteractionType type, @Nonnull ComponentAccessor<EntityStore> componentAccessor) -
walkChain
public void walkChain(@Nonnull Ref<EntityStore> ref, @Nonnull Collector collector, @Nonnull InteractionType type, @Nullable RootInteraction rootInteraction, @Nonnull ComponentAccessor<EntityStore> componentAccessor) -
walkChain
public static void walkChain(@Nonnull Collector collector, @Nonnull InteractionType type, @Nonnull InteractionContext context, @Nullable RootInteraction rootInteraction) -
walkInteractions
public static boolean walkInteractions(@Nonnull Collector collector, @Nonnull InteractionContext context, @Nonnull CollectorTag tag, @Nonnull String[] interactionIds) -
walkInteraction
public static boolean walkInteraction(@Nonnull Collector collector, @Nonnull InteractionContext context, @Nonnull CollectorTag tag, @Nullable String id) -
getSyncPackets
-
clone
- Specified by:
clonein interfaceComponent<EntityStore>- Overrides:
clonein classObject
-