Class EnterPortalCondition

java.lang.Object
com.hypixel.hytale.builtin.portals.integrations.EnterPortalCondition
All Implemented Interfaces:
EventCondition, EventCondition.TrackedEvent<EnterPortalEvent>

public class EnterPortalCondition extends Object implements EventCondition.TrackedEvent<EnterPortalEvent>
  • Field Details

  • Constructor Details

    • EnterPortalCondition

      public EnterPortalCondition()
  • Method Details

    • test

      public boolean test()
      Description copied from interface: EventCondition
      Returns true when 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) or EventCondition.Event.handle(World, T) instead.

      Specified by:
      test in interface EventCondition
      Returns:
      true if the condition is met
    • reset

      public void reset()
      Description copied from interface: EventCondition
      Resets 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:
      reset in interface EventCondition
    • eventType

      public Class<EnterPortalEvent> eventType()
      Description copied from interface: EventCondition.TrackedEvent
      Returns the exact class of the ECS event this condition handles.
      Specified by:
      eventType in interface EventCondition.TrackedEvent<EnterPortalEvent>
      Returns:
      the event class; must match the type parameter T exactly
    • handle

      public void handle(@Nonnull World world, @Nonnull EnterPortalEvent event, @Nonnull TrackedComponent tracked)
      Description copied from interface: EventCondition.TrackedEvent
      Processes an incoming ECS event together with the tracking component of the entity that triggered it.
      Specified by:
      handle in interface EventCondition.TrackedEvent<EnterPortalEvent>
      Parameters:
      world - the world in which the event was fired
      event - the ECS event
      tracked - the TrackedComponent from the entity that triggered the event
    • onStart

      public boolean onStart(@Nonnull WorldEvent event)
      Description copied from interface: EventCondition
      Called when the stage this condition belongs to begins, after EventCondition.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 false to abort the stage immediately.

      Specified by:
      onStart in interface EventCondition
      Parameters:
      event - the world event whose stage is starting
      Returns:
      false to abort the stage before it runs
    • onComplete

      public boolean onComplete(@Nonnull WorldEvent event)
      Description copied from interface: EventCondition
      Called after all conditions in the stage have returned true from EventCondition.test(), before the stage's actions are run.

      This is the correct place to write results into the event context (e.g. LocationCondition writes the chosen location as a LocationContext here). Return false if the condition cannot produce a valid result, which will treat the stage as failed.

      Specified by:
      onComplete in interface EventCondition
      Parameters:
      event - the world event whose stage just completed
      Returns:
      false to treat the stage as failed
    • merge

      public void merge(@Nonnull EventCondition other)
      Description copied from interface: EventCondition
      Copies runtime state from other into 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:
      merge in interface EventCondition
      Parameters:
      other - the loaded condition to merge state from.