Class EnterPortalCondition
- All Implemented Interfaces:
EventCondition, EventCondition.TrackedEvent<EnterPortalEvent>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classNested classes/interfaces inherited from interface EventCondition
EventCondition.Event<T>, EventCondition.Ticking, EventCondition.TrackedEvent<T>, EventCondition.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BuilderCodec<EnterPortalCondition> static final Stringstatic final EventCondition.TypeFields inherited from interface EventCondition
ARRAY_CODEC, EMPTY_ARRAY, TYPE_CODEC -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the exact class of the ECS event this condition handles.voidhandle(World world, EnterPortalEvent event, TrackedComponent tracked) Processes an incoming ECS event together with the tracking component of the entity that triggered it.voidmerge(EventCondition other) Copies runtime state fromotherinto this condition.booleanonComplete(WorldEvent event) Called after all conditions in the stage have returnedtruefromEventCondition.test(), before the stage's actions are run.booleanonStart(WorldEvent event) Called when the stage this condition belongs to begins, afterEventCondition.reset().voidreset()Resets the condition to its unsatisfied state before a new stage iteration begins.booleantest()Returnstruewhen this condition has been satisfied.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EventCondition
onCancel
-
Field Details
-
ID
- See Also:
-
TYPE
-
CODEC
-
-
Constructor Details
-
EnterPortalCondition
public EnterPortalCondition()
-
-
Method Details
-
test
public boolean test()Description copied from interface:EventConditionReturnstruewhen this condition has been satisfied.This method is called frequently and must be side-effect free. Update internal state in
EventCondition.Ticking.tick(float, Store)orEventCondition.Event.handle(World, T)instead.- Specified by:
testin interfaceEventCondition- Returns:
trueif the condition is met
-
reset
public void reset()Description copied from interface:EventConditionResets the condition to its unsatisfied state before a new stage iteration begins.Called before
EventCondition.onStart(WorldEvent)at the start of a stage. All transient fields (timers, flags, cached context references) should be cleared here.- Specified by:
resetin interfaceEventCondition
-
eventType
Description copied from interface:EventCondition.TrackedEventReturns the exact class of the ECS event this condition handles.- Specified by:
eventTypein interfaceEventCondition.TrackedEvent<EnterPortalEvent>- Returns:
- the event class; must match the type parameter
Texactly
-
handle
public void handle(@Nonnull World world, @Nonnull EnterPortalEvent event, @Nonnull TrackedComponent tracked) Description copied from interface:EventCondition.TrackedEventProcesses an incoming ECS event together with the tracking component of the entity that triggered it.- Specified by:
handlein interfaceEventCondition.TrackedEvent<EnterPortalEvent>- Parameters:
world- the world in which the event was firedevent- the ECS eventtracked- theTrackedComponentfrom the entity that triggered the event
-
onStart
Description copied from interface:EventConditionCalled when the stage this condition belongs to begins, afterEventCondition.reset().Implementations typically use this to look up values in the event context that the condition needs in order to operate (e.g. a location or a child event reference). If a required context value is absent, log a warning and return
falseto abort the stage immediately.- Specified by:
onStartin interfaceEventCondition- Parameters:
event- the world event whose stage is starting- Returns:
falseto abort the stage before it runs
-
onComplete
Description copied from interface:EventConditionCalled after all conditions in the stage have returnedtruefromEventCondition.test(), before the stage's actions are run.This is the correct place to write results into the event context (e.g.
LocationConditionwrites the chosen location as aLocationContexthere). Returnfalseif the condition cannot produce a valid result, which will treat the stage as failed.- Specified by:
onCompletein interfaceEventCondition- Parameters:
event- the world event whose stage just completed- Returns:
falseto treat the stage as failed
-
merge
Description copied from interface:EventConditionCopies runtime state fromotherinto this condition.Called when a persisted condition is restored from storage. The (this) condition is built from its asset config, and the loaded state from the (other) condition is merged into it.
- Specified by:
mergein interfaceEventCondition- Parameters:
other- the loaded condition to merge state from.
-