java.lang.Object
net.neoforged.bus.api.Event
- Direct Known Subclasses:
GenericEvent
Base Event class that all other events are derived from.
Note on abstract events
Listeners cannot be registered to an abstract event class.
Note on abstract events
Listeners cannot be registered to an abstract event class.
This is useful for classes that extend Event with more data and methods,
but should never be listened to directly.
For example, an event with Pre and Post subclasses might want to
be declared as abstract to prevent user accidentally listening to both.
All the parents of abstract event classes until Event must also be abstract.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceDeprecated, for removal: This API element is subject to removal in a future version.static enum -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal Event.ResultReturns the value set as the result of this eventfinal booleanDetermines if this event expects a significant result value.voidsetResult(Event.Result value) Sets the result value for this event, not all events can have a result set, and any attempt to set a result for a event that isn't expecting it will result in a IllegalArgumentException.
-
Constructor Details
-
Event
protected Event()
-
-
Method Details
-
hasResult
public final boolean hasResult()Determines if this event expects a significant result value. -
getResult
Returns the value set as the result of this event -
setResult
Sets the result value for this event, not all events can have a result set, and any attempt to set a result for a event that isn't expecting it will result in a IllegalArgumentException. The functionality of setting the result is defined on a per-event bases.- Parameters:
value- The new result
-
Event.Resultenum.