Annotation Interface ZenEvent.Bus
- Enclosing class:
- ZenEvent
To allow for automatic discovery of this field, the containing class must be annotated with either
ZenEvent or ZenEvent.BusCarrier accordingly. Refer to the specific documentation for further
information and the distinguishing factors between the two.
Moreover, the annotated field must be public static final and have a type of
IEventBus. If that's not the case, then an error will be raised
at runtime. Note that fields that follow the above characteristics but are not annotated with this annotation
will not be discovered automatically by CraftTweaker.
The association between the bus and the event carried by it can be either automatic or manual, according to
the limitations imposed by the parent class annotations. To enable automatic discovery, the value() of
this annotation should be set to its default value ZenEvent.Bus.Auto (or left empty, as it will be set to
the default automatically by Java). Refer to the documentation of the ZenEvent.Bus.Auto annotation for
more details on the automatic procedure. For manual discovery, the class of the event being carried by the bus
should be specified directly.
Note that, due to Java limitations, it is not possible to use this method to automatically register an event
bus that has a generic type (e.g. IEventBus<MyGenericEvent<Foo>>), as Java offers no way of determining
the generic types in this way. Similarly, it is not possible to discover both automatically or manually an event
bus for the ZenEvent.Bus.Auto annotation itself, if desired.
- Since:
- 11.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceEnables automatic determination of the type of event carried by an event bus. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionClass<?>The type of the event carried by the bus, orZenEvent.Bus.Autofor automatic discovery.
-
Element Details
-
value
Class<?> valueThe type of the event carried by the bus, orZenEvent.Bus.Autofor automatic discovery.- Returns:
- The type of event carried by the class.
- Since:
- 11.0.0
- Default:
- com.blamejared.crafttweaker.api.event.ZenEvent.Bus.Auto.class
-