InteractionManager

public class InteractionManager implements Component

Class InteractionManager. Provides interactionmanager functionality for the Hytale server.

java.lang.Object > InteractionManager

Field Summary

hasRemoteClient

private boolean hasRemoteClient

Field hasRemoteClient.

lastServerChainId

private int lastServerChainId

Field lastServerChainId.

lastClientChainId

private int lastClientChainId

Field lastClientChainId.

packetQueueTime

private long packetQueueTime

Field packetQueueTime.

timeShiftsDirty

private boolean timeShiftsDirty

Field timeShiftsDirty.

commandBuffer

protected CommandBuffer commandBuffer

Field commandBuffer.

world

final World world

Field world.

playerComponent

final Player playerComponent

Field playerComponent.

it

final Iterator it

Field it.

packet

final SyncInteractionChain packet

Field packet.

context

final HytaleLogger.Api context

Field context.

subChain

final InteractionChain subChain

Field subChain.

ctx

final HytaleLogger.Api ctx

Field ctx.

shouldRemove

final boolean shouldRemove

Field shouldRemove.

ctx3

final HytaleLogger.Api ctx3

Field ctx3.

ref

final Ref ref

Field ref.

baseOpIndex

final int baseOpIndex

Field baseOpIndex.

waitMillis

final long waitMillis

Field waitMillis.

context2

final HytaleLogger.Api context2

Field context2.

threshold

final long threshold

Field threshold.

waitMillis2

final long waitMillis2

Field waitMillis2.

context3

final HytaleLogger.Api context3

Field context3.

threshold2

final long threshold2

Field threshold2.

timeResource

final TimeResource timeResource

Field timeResource.

root

final RootInteraction root

Field root.

maxOperations

final int maxOperations

Field maxOperations.

entry

final InteractionEntry entry

Field entry.

operation

final Operation operation

Field operation.

interactionData

final ObjectList interactionData

Field interactionData.

parent

final InteractionChain parent

Field parent.

simOp

final Operation simOp

Field simOp.

simWaitFrom

final WaitForDataFrom simWaitFrom

Field simWaitFrom.

tickTime

final long tickTime

Field tickTime.

tickTimeDilation

final float tickTimeDilation

Field tickTimeDilation.

serverDataHashCode

final int serverDataHashCode

Field serverDataHashCode.

serverData

final InteractionSyncData serverData

Field serverData.

rootInteraction

final RootInteraction rootInteraction

Field rootInteraction.

index

final int index

Field index.

type

final InteractionType type

Field type.

ctx2

final HytaleLogger.Api ctx2

Field ctx2.

proxyId

final UUID proxyId

Field proxyId.

proxyTarget

final Ref proxyTarget

Field proxyTarget.

rootInteractionId

final String rootInteractionId

Field rootInteractionId.

entityInventory

final Inventory entityInventory

Field entityInventory.

itemInHand

final ItemStack itemInHand

Field itemInHand.

utilityItem

final ItemStack utilityItem

Field utilityItem.

serverItemInHandId

final String serverItemInHandId

Field serverItemInHandId.

serverUtilityItemId

final String serverUtilityItemId

Field serverUtilityItemId.

ctx4

final HytaleLogger.Api ctx4

Field ctx4.

chain

final InteractionChain chain

Field chain.

world2

final World world2

Field world2.

targetBlock

final BlockPosition targetBlock

Field targetBlock.

entityComponentStore

final EntityStore entityComponentStore

Field entityComponentStore.

entityReference

final Ref entityReference

Field entityReference.

hit

final Vector3f hit

Field hit.

syncData

final InteractionSyncData syncData

Field syncData.

interaction

final InteractionEntry interaction

Field interaction.

interactionChain

final InteractionChain interactionChain

Field interactionChain.

last

final int last

Field last.

chainsToCancel

final List chainsToCancel

Field chainsToCancel.

currentRoot

final RootInteraction currentRoot

Field currentRoot.

currentOp

final Operation currentOp

Field currentOp.

data

final InteractionChainData data

Field data.

lastServerChainId2

final int lastServerChainId2

Field lastServerChainId2.

cooldown

final InteractionCooldown cooldown

Field cooldown.

gameMode

final GameMode gameMode

Field gameMode.

settings

final RootInteractionSettings settings

Field settings.

inventory

final Inventory inventory

Field inventory.

rootId

final String rootId

Field rootId.

newForks

final List newForks

Field newForks.

fc

final InteractionChain fc

Field fc.

globalTimeShift

final float[] globalTimeShift

Field globalTimeShift.

n

final int n

Field n.

manager

final InteractionManager manager

Field manager.

Method Detail

InteractionManager

public public InteractionManager (@Nonnull final LivingEntity entity, @Nullable final PlayerRef playerRef, @Nonnull final IInteractionSimulationHandler simulationHandler)

Method InteractionManager.

Parameters:
@Nonnull final LivingEntity entity
@Nullable final PlayerRef playerRef
@Nonnull final IInteractionSimulationHandler simulationHandler

getChains

public Int2ObjectMap getChains ()

Method getChains.

getInteractionSimulationHandler

public IInteractionSimulationHandler getInteractionSimulationHandler ()

Method getInteractionSimulationHandler.

getOperationTimeoutThreshold

private long getOperationTimeoutThreshold ()

Method getOperationTimeoutThreshold.

waitingForClient

private boolean waitingForClient (@Nonnull final Ref ref)

Method waitingForClient.

Parameters:
@Nonnull final Ref ref

setHasRemoteClient

public void setHasRemoteClient (final boolean hasRemoteClient)

Method setHasRemoteClient.

Parameters:
final boolean hasRemoteClient

copyFrom

public void copyFrom (@Nonnull final InteractionManager interactionManager)

Method copyFrom.

Parameters:
@Nonnull final InteractionManager interactionManager

tick

public void tick (@Nonnull final Ref ref, @Nonnull final CommandBuffer commandBuffer, final float dt)

Method tick.

Parameters:
@Nonnull final Ref ref
@Nonnull final CommandBuffer commandBuffer
final float dt

tryConsumePacketQueue

private boolean tryConsumePacketQueue (@Nonnull final Ref ref, @Nonnull final Deque packetQueue)

Method tryConsumePacketQueue.

Parameters:
@Nonnull final Ref ref
@Nonnull final Deque packetQueue

if

public else if (chain != null)

Method if.

Parameters:
chain != null

getChain

private InteractionChain getChain (final int chainId, @Nullable final ForkedChainId forkedChainId)

Method getChain.

Parameters:
final int chainId
@Nullable final ForkedChainId forkedChainId

tickChain

private boolean tickChain (@Nonnull final InteractionChain chain)

Method tickChain.

Parameters:
@Nonnull final InteractionChain chain

handleCancelledChain

private void handleCancelledChain (@Nonnull final Ref ref, @Nonnull final InteractionChain chain)

Method handleCancelledChain.

Parameters:
@Nonnull final Ref ref
@Nonnull final InteractionChain chain

IllegalStateException

public new IllegalStateException ("Failed to find operation during simulation tick of chain '" + root.getId()

Method IllegalStateException.

Parameters:
"Failed to find operation during simulation tick of chain '" + root.getId(

doTickChain

private void doTickChain (@Nonnull final Ref ref, @Nonnull final InteractionChain chain)

Method doTickChain.

Parameters:
@Nonnull final Ref ref
@Nonnull final InteractionChain chain

ChainCancelledException

public new ChainCancelledException (chain.getServerState()

Method ChainCancelledException.

Parameters:
chain.getServerState( chain.getServerState(

serverTick

private InteractionSyncData serverTick (@Nonnull final Ref ref, @Nonnull final InteractionChain chain, final long tickTime)

Method serverTick.

Parameters:
@Nonnull final Ref ref
@Nonnull final InteractionChain chain
final long tickTime

RuntimeException

public new RuntimeException ("Client took too long to send clientData! Millis: " + waitMillis + ", Threshold: " + threshold + ", \nChain: " + String.valueOf(chain)

Method RuntimeException.

Parameters:
Threshold: " + threshold + "
\nChain: " + String.valueOf(chain

removeInteractionIfFinished

private void removeInteractionIfFinished (@Nonnull final Ref ref, @Nonnull final InteractionChain chain, @Nonnull final InteractionEntry entry)

Method removeInteractionIfFinished.

Parameters:
@Nonnull final Ref ref
@Nonnull final InteractionChain chain
@Nonnull final InteractionEntry entry

simulationTick

private void simulationTick (@Nonnull final Ref ref, @Nonnull final InteractionChain chain, final long tickTime)

Method simulationTick.

Parameters:
@Nonnull final Ref ref
@Nonnull final InteractionChain chain
final long tickTime

syncStart

private boolean syncStart (@Nonnull final Ref ref, @Nonnull final SyncInteractionChain packet)

Method syncStart.

Parameters:
@Nonnull final Ref ref
@Nonnull final SyncInteractionChain packet

SetActiveSlot

public new SetActiveSlot (-1, entityInventory.getActiveHotbarSlot()

Method SetActiveSlot.

Parameters:
-1 -1
entityInventory.getActiveHotbarSlot( entityInventory.getActiveHotbarSlot(

Vector4d

public new Vector4d (hit.x, hit.y, hit.z, 1.0)

Method Vector4d.

Parameters:
hit.x hit.x
hit.y hit.y
hit.z hit.z
1.0 1.0

sync

Method sync.

Parameters:
@Nonnull final Ref ref
@Nonnull final ChainSyncStorage chainSyncStorage
@Nonnull final SyncInteractionChain packet

canRun

public boolean canRun (@Nonnull final InteractionType type, @Nonnull final RootInteraction rootInteraction)

Method canRun.

Parameters:
@Nonnull final InteractionType type
@Nonnull final RootInteraction rootInteraction

cancelChains

public void cancelChains (@Nonnull final InteractionChain chain)

Method cancelChains.

Parameters:
@Nonnull final InteractionChain chain

tryStartChain

Method tryStartChain.

Parameters:
@Nonnull final Ref ref
@Nonnull final CommandBuffer commandBuffer
@Nonnull final InteractionType type
@Nonnull final InteractionContext context
@Nonnull final RootInteraction rootInteraction

initChain

public InteractionChain initChain (@Nonnull final InteractionType type, @Nonnull final InteractionContext context, @Nonnull final RootInteraction rootInteraction, final boolean forceRemoteSync)

Method initChain.

Parameters:
@Nonnull final InteractionType type
@Nonnull final InteractionContext context
@Nonnull final RootInteraction rootInteraction
final boolean forceRemoteSync

queueExecuteChain

public void queueExecuteChain (@Nonnull final InteractionChain chain)

Method queueExecuteChain.

Parameters:
@Nonnull final InteractionChain chain

executeChain

public void executeChain (@Nonnull final Ref ref, @Nonnull final CommandBuffer commandBuffer, @Nonnull final InteractionChain chain)

Method executeChain.

Parameters:
@Nonnull final Ref ref
@Nonnull final CommandBuffer commandBuffer
@Nonnull final InteractionChain chain

executeChain0

private void executeChain0 (@Nonnull final Ref ref, @Nonnull final InteractionChain chain)

Method executeChain0.

Parameters:
@Nonnull final Ref ref
@Nonnull final InteractionChain chain

isOnCooldown

private boolean isOnCooldown (@Nonnull final Ref ref, @Nonnull final InteractionType type, @Nonnull final RootInteraction root, final boolean remote)

Method isOnCooldown.

Parameters:
@Nonnull final Ref ref
@Nonnull final InteractionType type
@Nonnull final RootInteraction root
final boolean remote

tryRunHeldInteraction

public void tryRunHeldInteraction (@Nonnull final Ref ref, @Nonnull final CommandBuffer commandBuffer, @Nonnull final InteractionType type)

Method tryRunHeldInteraction.

Parameters:
@Nonnull final Ref ref
@Nonnull final CommandBuffer commandBuffer
@Nonnull final InteractionType type

sendSyncPacket

public void sendSyncPacket (@Nonnull final InteractionChain chain, final int operationBaseIndex, @Nullable final List interactionData)

Method sendSyncPacket.

Parameters:
@Nonnull final InteractionChain chain
final int operationBaseIndex
@Nullable final List interactionData

makeSyncPacket

static SyncInteractionChain makeSyncPacket (@Nonnull final InteractionChain chain, final int operationBaseIndex, @Nullable final List interactionData)

Method makeSyncPacket.

Parameters:
@Nonnull final InteractionChain chain
final int operationBaseIndex
@Nullable final List interactionData

SyncInteractionChain

public new SyncInteractionChain (0, 0, 0, null, null, null, !chain.hasSentInitial()

Method SyncInteractionChain.

Parameters:
0 0
null null
!chain.hasSentInitial( !chain.hasSentInitial(

sendCancelPacket

private void sendCancelPacket (@Nonnull final InteractionChain chain)

Method sendCancelPacket.

Parameters:
@Nonnull final InteractionChain chain

CancelInteractionChain

public new CancelInteractionChain (chainId, forkedChainId)

Method CancelInteractionChain.

Parameters:
chainId chainId
forkedChainId forkedChainId

clear

public void clear ()

Method clear.

clearAllGlobalTimeShift

public void clearAllGlobalTimeShift (final float dt)

Method clearAllGlobalTimeShift.

Parameters:
final float dt

setGlobalTimeShift

public void setGlobalTimeShift (@Nonnull final InteractionType type, final float shift)

Method setGlobalTimeShift.

Parameters:
@Nonnull final InteractionType type
final float shift

getGlobalTimeShift

public float getGlobalTimeShift (@Nonnull final InteractionType type)

Method getGlobalTimeShift.

Parameters:
@Nonnull final InteractionType type

forEachInteraction

public T forEachInteraction (@Nonnull final TriFunction func, @Nonnull final T val)

Method forEachInteraction.

Parameters:
@Nonnull final TriFunction func
@Nonnull final T val

walkChain

Method walkChain.

Parameters:
@Nonnull final Ref ref
@Nonnull final Collector collector
@Nonnull final InteractionType type
@Nonnull final ComponentAccessor componentAccessor

walkInteractions

static boolean walkInteractions (@Nonnull final Collector collector, @Nonnull final InteractionContext context, @Nonnull final CollectorTag tag, @Nonnull final String[] interactionIds)

Method walkInteractions.

Parameters:
@Nonnull final Collector collector
@Nonnull final InteractionContext context
@Nonnull final CollectorTag tag
@Nonnull final String[] interactionIds

walkInteraction

static boolean walkInteraction (@Nonnull final Collector collector, @Nonnull final InteractionContext context, @Nonnull final CollectorTag tag, @Nullable final String id)

Method walkInteraction.

Parameters:
@Nonnull final Collector collector
@Nonnull final InteractionContext context
@Nonnull final CollectorTag tag
@Nullable final String id

getSyncPackets

public ObjectList getSyncPackets ()

Method getSyncPackets.

clone

public Component clone ()

Method clone.