Class NetworkEventBus
java.lang.Object
org.cyclops.integrateddynamics.core.network.event.NetworkEventBus
- All Implemented Interfaces:
INetworkEventBus
An event bus for
INetwork
events where
INetworkElement
instances can listen to.
Partially based on Minecraft Forge's EventBus
implementation.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
post
(INetworkEvent event) Post the given event to the events bus.boolean
Post the given cancelable event to the events bus.void
register
(IEventListenableNetworkElement<?> target, Class<? extends INetworkEvent> eventType) Register a network element for the given event type.void
unregister
(IEventListenableNetworkElement<?> target) Unregister all events for the given network element.void
unregister
(IEventListenableNetworkElement<?> target, Class<? extends INetworkEvent> eventType) Unregister a network element for the given event type.
-
Constructor Details
-
NetworkEventBus
public NetworkEventBus()
-
-
Method Details
-
register
public void register(IEventListenableNetworkElement<?> target, Class<? extends INetworkEvent> eventType) Description copied from interface:INetworkEventBus
Register a network element for the given event type.- Specified by:
register
in interfaceINetworkEventBus
- Parameters:
target
- The element that will be called once the event bus receives the given event.eventType
- The event type.
-
unregister
public void unregister(IEventListenableNetworkElement<?> target, Class<? extends INetworkEvent> eventType) Description copied from interface:INetworkEventBus
Unregister a network element for the given event type.- Specified by:
unregister
in interfaceINetworkEventBus
- Parameters:
target
- The element that would be called once the event bus receives the given event.eventType
- The event type.
-
unregister
Description copied from interface:INetworkEventBus
Unregister all events for the given network element.- Specified by:
unregister
in interfaceINetworkEventBus
- Parameters:
target
- The element that would be called once the event bus receives events.
-
post
Description copied from interface:INetworkEventBus
Post the given event to the events bus.- Specified by:
post
in interfaceINetworkEventBus
- Parameters:
event
- The event to post.
-
postCancelable
Description copied from interface:INetworkEventBus
Post the given cancelable event to the events bus.- Specified by:
postCancelable
in interfaceINetworkEventBus
- Parameters:
event
- The event to post.- Returns:
- If the event was not canceled.
-