Interface IEntityManager

All Known Subinterfaces:
ICitizenManager, IVisitorManager
All Known Implementing Classes:
CitizenManager, VisitorManager

public interface IEntityManager
Manager interface for managing entities for a colony
  • Method Details

    • registerCivilian

      void registerCivilian(AbstractCivilianEntity entity)
      Register a civilian entity with the colony
      Parameters:
      entity - civilian to register
    • unregisterCivilian

      void unregisterCivilian(AbstractCivilianEntity entity)
      Unregiters a civilian with the colony
      Parameters:
      entity - civilian to unregister
    • read

      void read(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull net.minecraft.nbt.CompoundTag compound)
      Read the civilian from nbt.
      Parameters:
      compound - the compound to read it from.
    • write

      void write(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull net.minecraft.nbt.CompoundTag compoundNBT)
      Write the civilian to nbt.
      Parameters:
      compoundNBT - the compound to write it to.
    • sendPackets

      void sendPackets(@NotNull @NotNull Set<net.minecraft.server.level.ServerPlayer> closeSubscribers, @NotNull @NotNull Set<net.minecraft.server.level.ServerPlayer> newSubscribers)
      Sends packages to update the civilian.
      Parameters:
      closeSubscribers - the existing subscribers.
      newSubscribers - new subscribers
    • getCivilianDataMap

      @NotNull @NotNull Map<Integer,ICivilianData> getCivilianDataMap()
      Returns a map of civilian in the colony. The map has ID as key, and civilian data as value.
      Returns:
      Map of civilian in the colony, with as key the civilian ID, and as value the civilian data.
    • getCivilian

      <T extends ICivilianData> T getCivilian(int civilianId)
      Get civilian by ID.
      Parameters:
      civilianId - ID of the civilian.
      Returns:
      ICivilianData associated with the ID, or null if it was not found.
    • spawnOrCreateCivilian

      <T extends ICivilianData> T spawnOrCreateCivilian(T data, net.minecraft.world.level.Level world, List<net.minecraft.core.BlockPos> spawnPositions, boolean force)
      Spawns a civilian with the specific civilian data.
      Parameters:
      data - Data to use when spawn, null when new generation.
      world - THe world.
      spawnPositions - the positions to spawn it at, tried in order.
      force - True to skip max civilian test, false when not.
      Returns:
      the new civilian.
    • createAndRegisterCivilianData

      ICivilianData createAndRegisterCivilianData()
      Creates Civilian Data for a new civilian
      Returns:
      new ICivilianData
    • removeCivilian

      void removeCivilian(@NotNull @NotNull ICivilianData civilian)
      Removes a civilian from the colony.
      Parameters:
      civilian - data to remove.
    • markDirty

      void markDirty()
      Marks civilian data dirty.
    • clearDirty

      void clearDirty()
      Clear dirty from all buildings.
    • onColonyTick

      void onColonyTick(IColony colony)
      Actions to execute on a colony tick.
      Parameters:
      colony - the event.