Interface IEventManager
- All Known Implementing Classes:
EventManager
public interface IEventManager
Interface for the event manager, the event manager deals with all colony related events, such as raid events.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddEvent(IColonyEvent colonyEvent) Adds an eventintGets and takes the next open event ID.getEventByID(int ID) Gets an event by its id.Returns the full event MapReturns the associated structure manager, which manages structure spawn/despawn for events.voidonColonyTick(@NotNull IColony colony) Update function, which is called from the colony every 500 ticks.voidonEntityDeath(net.minecraft.world.entity.LivingEntity entity, int eventID) Lets the event know if a certain entity diedvoidAllows events to react to nightfall, which is always calculated by the colony itselfvoidonTileEntityBreak(int eventID, net.minecraft.world.level.block.entity.BlockEntity te) Forwards a broken tileEntity to the given event, to react to TE breaks.voidreadFromNBT(@NotNull net.minecraft.nbt.CompoundTag compound) Reads the eventManager nbt and creates events from itvoidregisterEntity(@NotNull net.minecraft.world.entity.Entity entity, int eventID) Registers an entity with the given eventvoidunregisterEntity(@NotNull net.minecraft.world.entity.Entity entity, int eventID) Unregisters an entity with the given eventvoidwriteToNBT(@NotNull net.minecraft.nbt.CompoundTag compound) Write the eventmanager and all events to NBT
-
Method Details
-
addEvent
Adds an event- Parameters:
colonyEvent- event to add
-
getAndTakeNextEventID
int getAndTakeNextEventID()Gets and takes the next open event ID.- Returns:
- int ID
-
registerEntity
void registerEntity(@NotNull @NotNull net.minecraft.world.entity.Entity entity, int eventID) Registers an entity with the given event- Parameters:
entity- entity to registereventID- eventID to register on
-
unregisterEntity
void unregisterEntity(@NotNull @NotNull net.minecraft.world.entity.Entity entity, int eventID) Unregisters an entity with the given event- Parameters:
entity- entity to unregistereventID- eventID to unregister on
-
onEntityDeath
void onEntityDeath(net.minecraft.world.entity.LivingEntity entity, int eventID) Lets the event know if a certain entity died- Parameters:
entity- entity that diedeventID- eventID to forward the Death to
-
onNightFall
void onNightFall()Allows events to react to nightfall, which is always calculated by the colony itself -
onTileEntityBreak
void onTileEntityBreak(int eventID, net.minecraft.world.level.block.entity.BlockEntity te) Forwards a broken tileEntity to the given event, to react to TE breaks. The TE needs to call this on break- Parameters:
eventID- ID of the related eventte- tileentity to use
-
onColonyTick
Update function, which is called from the colony every 500 ticks. Used to update event states/remove them if needed. Forwarded to events aswell to allow them tick based logic- Parameters:
colony- the colony to tick.
-
getEventByID
Gets an event by its id.- Parameters:
ID- event ID to get- Returns:
- event
-
getEvents
Map<Integer,IColonyEvent> getEvents()Returns the full event Map- Returns:
- the map of events per colony.
-
readFromNBT
void readFromNBT(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Reads the eventManager nbt and creates events from it- Parameters:
compound- the compound to read from.
-
writeToNBT
void writeToNBT(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Write the eventmanager and all events to NBT- Parameters:
compound- the compound to write to.
-
getStructureManager
IEventStructureManager getStructureManager()Returns the associated structure manager, which manages structure spawn/despawn for events.- Returns:
- the manager.
-