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 Type
    Method
    Description
    void
    addEvent(IColonyEvent colonyEvent)
    Adds an event
    int
    Gets and takes the next open event ID.
    getEventByID(int ID)
    Gets an event by its id.
    Returns the full event Map
    Returns the associated structure manager, which manages structure spawn/despawn for events.
    void
    onColonyTick(@NotNull IColony colony)
    Update function, which is called from the colony every 500 ticks.
    void
    onEntityDeath(net.minecraft.world.entity.LivingEntity entity, int eventID)
    Lets the event know if a certain entity died
    void
    Allows events to react to nightfall, which is always calculated by the colony itself
    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.
    void
    readFromNBT(net.minecraft.core.HolderLookup.Provider provider, @NotNull net.minecraft.nbt.CompoundTag compound)
    Reads the eventManager nbt and creates events from it
    void
    registerEntity(@NotNull net.minecraft.world.entity.Entity entity, int eventID)
    Registers an entity with the given event
    void
    unregisterEntity(@NotNull net.minecraft.world.entity.Entity entity, int eventID)
    Unregisters an entity with the given event
    void
    writeToNBT(net.minecraft.core.HolderLookup.Provider provider, @NotNull net.minecraft.nbt.CompoundTag compound)
    Write the eventmanager and all events to NBT
  • Method Details

    • addEvent

      void addEvent(IColonyEvent colonyEvent)
      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 register
      eventID - 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 unregister
      eventID - 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 died
      eventID - 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 event
      te - tileentity to use
    • onColonyTick

      void onColonyTick(@NotNull @NotNull IColony colony)
      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

      IColonyEvent getEventByID(int ID)
      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 net.minecraft.core.HolderLookup.Provider provider, @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 net.minecraft.core.HolderLookup.Provider provider, @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.