public interface IEventHandler
Event objects that can be
used by mods to hook into the game's and other mods' functionalities. You can
receive an instance of this class by using RockBottomAPI.getEventHandler().
You can find a list of events that are fired in the normal game in the
impl sub-package.| Modifier and Type | Method | Description |
|---|---|---|
EventResult |
fireEvent(Event event) |
Fires an event, making all of the registered listeners listen to it and,
in the end, return an
EventResult representing if the event was
EventResult.MODIFIED or EventResult.CANCELLED. |
<T extends Event> |
registerListener(java.lang.Class<T> type,
IEventListener<T> listener) |
Registers an
IEventListener that will listen to a certain kind of
event. |
void |
unregisterAllListeners(java.lang.Class<? extends Event> type) |
Unregisters all
IEventListener objects that are listening to a
certain kind of event. |
<T extends Event> |
unregisterListener(java.lang.Class<T> type,
IEventListener<T> listener) |
Unregisters an
IEventListener from listening to a certain kind of
event. |
<T extends Event> void registerListener(java.lang.Class<T> type, IEventListener<T> listener)
IEventListener that will listen to a certain kind of
event. Doing this will cause the listener's IEventListener.listen(EventResult, Event) method to be called whenever
the event is fired.T - A generic type representing the event that is listened
totype - The type of event to listen forlistener - The listenerIEventListener.listen(EventResult, Event)<T extends Event> void unregisterListener(java.lang.Class<T> type, IEventListener<T> listener)
IEventListener from listening to a certain kind of
event.T - A generic type representing the eventtype - The type of event to unregister fromlistener - The listener to unregistervoid unregisterAllListeners(java.lang.Class<? extends Event> type)
IEventListener objects that are listening to a
certain kind of event.type - The type of event to unregister all listeners ofEventResult fireEvent(Event event)
EventResult representing if the event was
EventResult.MODIFIED or EventResult.CANCELLED. Firing
events is only needed if you add your own implementations of the Event class.event - The event to fireregisterListener(Class, IEventListener)