Record Class EventPhase
java.lang.Object
java.lang.Record
net.ixdarklord.coolcatcore.api.event.v2.core.EventPhase
- All Implemented Interfaces:
Comparable<EventPhase>
public record EventPhase(@NotNull String name, int order)
extends Record
implements Comparable<EventPhase>
When a listener runs relative to the others of the same event. Listeners run from the lowest
order() to the
highest; listeners in the same phase run in the order they were registered.
The built-in phases leave room between them, so a mod can slot its own in with of(String, int).
Phases also place a listener among other mods' own listeners of the same game event (their NeoForge or Fabric
listeners, which CoolCatLib doesn't run), by band(): FIRST and earlier run before them,
LAST and later after them, and the phases between with them. Only events whose loader hook fires each band
at its own place do this (their documentation says so); for the others every phase runs at once, in order.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhere a phase's listeners run among other mods' own listeners of the game event: before them (NeoForge's highest priority, a Fabric phase before the default one), with them, or after them (the lowest priority, a phase after the default one). -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EventPhasestatic final EventPhasestatic final EventPhasestatic final EventPhasestatic final EventPhase -
Constructor Summary
ConstructorsConstructorDescriptionEventPhase(@NotNull String name, int order) Creates an instance of aEventPhaserecord class. -
Method Summary
Modifier and TypeMethodDescriptionafter()A phase running just after this one.band()Where listeners of this phase run among other mods' own listeners of the game event.before()A phase running just before this one.intcompareTo(@NotNull EventPhase other) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@NotNull Stringname()Returns the value of thenamerecord component.static EventPhaseA custom phase, e.g.intorder()Returns the value of theorderrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
FIRST
-
EARLY
-
DEFAULT
-
LATE
-
LAST
-
-
Constructor Details
-
EventPhase
Creates an instance of aEventPhaserecord class.- Parameters:
name- the value for thenamerecord componentorder- the value for theorderrecord component
-
-
Method Details
-
of
A custom phase, e.g.EventPhase.of("after_defaults", 500). -
before
A phase running just before this one. -
after
A phase running just after this one. -
band
Where listeners of this phase run among other mods' own listeners of the game event. -
compareTo
- Specified by:
compareToin interfaceComparable<EventPhase>
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
order
public int order()Returns the value of theorderrecord component.- Returns:
- the value of the
orderrecord component
-