Contents
- Description
- Field Summary
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- getWeight()
- canExecute(Ref, ExecutionSupport, InfoProvider, double, Store)
- execute(Ref, ExecutionSupport, InfoProvider, double, Store)
- activate(ExecutionSupport, InfoProvider)
- deactivate(ExecutionSupport, InfoProvider)
- isActivated()
- getInfo(ExecutionSupport, ComponentInfo)
- processDelay(float)
- clearOnce()
- setOnce()
- isTriggered()
- registerWithSupport(ExecutionSupport)
- motionControllerChanged(Ref, NPCEntity, MotionController, ComponentAccessor)
- loaded(ExecutionSupport)
- spawned(ExecutionSupport)
- unloaded(ExecutionSupport)
- removed(ExecutionSupport)
- teleported(ExecutionSupport, World, World)
- isBusy()
Class WeightedAction
java.lang.Object
com.hypixel.hytale.server.npc.corecomponents.AnnotatedComponentBase
com.hypixel.hytale.server.npc.corecomponents.WeightedAction
- All Implemented Interfaces:
Action, RoleStateChange, IAnnotatedComponent, IComponentExecutionControl
-
Field Summary
Fields inherited from interface Action
EMPTY_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionWeightedAction(BuilderWeightedAction builder, BuilderSupport support, Action action) -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(ExecutionSupport executionSupport, InfoProvider infoProvider) Called when the action is activated.booleancanExecute(Ref<EntityStore> ref, ExecutionSupport executionSupport, InfoProvider sensorInfo, double dt, Store<EntityStore> store) Test if an action can be executedvoidvoiddeactivate(ExecutionSupport executionSupport, InfoProvider infoProvider) Called when the action is deactivated.booleanexecute(Ref<EntityStore> ref, ExecutionSupport executionSupport, InfoProvider sensorInfo, double dt, Store<EntityStore> store) Execute actionvoidgetInfo(ExecutionSupport executionSupport, ComponentInfo holder) Populates the ComponentInfo holder with any relevant information relating to this particular componentdoublebooleanChecks if this action has been activated.booleanisBusy()Whether this action has work in flight that spans ticks (e.g. a deferred/delayed continuation bound to this instance).booleanvoidloaded(ExecutionSupport executionSupport) voidmotionControllerChanged(Ref<EntityStore> ref, NPCEntity npcComponent, MotionController motionController, ComponentAccessor<EntityStore> componentAccessor) booleanprocessDelay(float dt) Tick down the internal delay on this core componentvoidregisterWithSupport(ExecutionSupport executionSupport) voidremoved(ExecutionSupport executionSupport) voidsetOnce()voidspawned(ExecutionSupport executionSupport) voidteleported(ExecutionSupport executionSupport, World from, World to) voidunloaded(ExecutionSupport executionSupport) Methods inherited from class AnnotatedComponentBase
getIndex, getParent, setContextMethods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IAnnotatedComponent
getBreadCrumbs, getBreadCrumbs, getIndex, getLabel, getParent, setContext
-
Constructor Details
-
WeightedAction
public WeightedAction(@Nonnull BuilderWeightedAction builder, @Nonnull BuilderSupport support, @Nonnull Action action)
-
-
Method Details
-
getWeight
public double getWeight() -
canExecute
public boolean canExecute(@Nonnull Ref<EntityStore> ref, @Nonnull ExecutionSupport executionSupport, @Nullable InfoProvider sensorInfo, double dt, @Nonnull Store<EntityStore> store) Description copied from interface:ActionTest if an action can be executed- Specified by:
canExecutein interfaceAction- Parameters:
ref- The entity refexecutionSupport- The execution supportsensorInfo- SensorInfo with PositionProvider, PathProvider, etc if requireddt- The interval in seconds for this calculationstore- The component store- Returns:
- true if action can be executed else false to skip execution
-
execute
public boolean execute(@Nonnull Ref<EntityStore> ref, @Nonnull ExecutionSupport executionSupport, @Nullable InfoProvider sensorInfo, double dt, @Nonnull Store<EntityStore> store) Description copied from interface:ActionExecute action- Specified by:
executein interfaceAction- Parameters:
ref- The entity refexecutionSupport- The execution supportsensorInfo- SensorInfo with PositionProvider, PathProvider, etc if requireddt- The interval in seconds for this calculationstore- The component store- Returns:
- true when executed action has finished else false when execution is not completed yet
-
activate
Description copied from interface:ActionCalled when the action is activated. In normal lists, this will be called for all actions in the list that can be executed. In blocking sequences, this will be called prior to beginning the first execution of the action in the current cycle. -
deactivate
Description copied from interface:ActionCalled when the action is deactivated. In normal lists, this will be called if the action cannot be executed. In blocking sequences, this will be called when the execution of the action completes before moving to the next action.- Specified by:
deactivatein interfaceAction- Parameters:
executionSupport- The execution supportinfoProvider- the InfoProvider from the parent sensor.
-
isActivated
public boolean isActivated()Description copied from interface:ActionChecks if this action has been activated.- Specified by:
isActivatedin interfaceAction- Returns:
trueif activated,falseif not.
-
getInfo
Description copied from interface:IAnnotatedComponentPopulates the ComponentInfo holder with any relevant information relating to this particular component- Specified by:
getInfoin interfaceIAnnotatedComponent- Overrides:
getInfoin classAnnotatedComponentBase- Parameters:
executionSupport- per-execution contextholder- the ComponentInfo instance to populate
-
processDelay
public boolean processDelay(float dt) Description copied from interface:IComponentExecutionControlTick down the internal delay on this core component- Specified by:
processDelayin interfaceIComponentExecutionControl- Parameters:
dt- the tick duration- Returns:
- whether this component has finished processing its internal delay
-
clearOnce
public void clearOnce()- Specified by:
clearOncein interfaceIComponentExecutionControl
-
setOnce
public void setOnce()- Specified by:
setOncein interfaceIComponentExecutionControl
-
isTriggered
public boolean isTriggered()- Specified by:
isTriggeredin interfaceIComponentExecutionControl
-
registerWithSupport
- Specified by:
registerWithSupportin interfaceRoleStateChange
-
motionControllerChanged
public void motionControllerChanged(@Nullable Ref<EntityStore> ref, @Nonnull NPCEntity npcComponent, MotionController motionController, @Nullable ComponentAccessor<EntityStore> componentAccessor) - Specified by:
motionControllerChangedin interfaceRoleStateChange
-
loaded
- Specified by:
loadedin interfaceRoleStateChange
-
spawned
- Specified by:
spawnedin interfaceRoleStateChange
-
unloaded
- Specified by:
unloadedin interfaceRoleStateChange
-
removed
- Specified by:
removedin interfaceRoleStateChange
-
teleported
- Specified by:
teleportedin interfaceRoleStateChange
-
isBusy
public boolean isBusy()Description copied from interface:ActionWhether this action has work in flight that spans ticks (e.g. a deferred/delayed continuation bound to this instance). Used byForEach's per-target instance pool to avoid recycling a slot whose action is still mid-execution. Defaults tofalse.
-