Class VisitorManager

java.lang.Object
com.minecolonies.core.colony.managers.VisitorManager
All Implemented Interfaces:
IEntityManager, IVisitorManager

public class VisitorManager extends Object implements IVisitorManager
Manages all visiting entities to the colony
  • Field Details

    • TAG_VISIT_MANAGER

      public static String TAG_VISIT_MANAGER
      NBT Tags
    • TAG_VISITORS

      public static String TAG_VISITORS
    • TAG_NEXTID

      public static String TAG_NEXTID
  • Constructor Details

    • VisitorManager

      public VisitorManager(IColony colony)
  • Method Details

    • registerCivilian

      public void registerCivilian(AbstractCivilianEntity visitor)
      Description copied from interface: IEntityManager
      Register a civilian entity with the colony
      Specified by:
      registerCivilian in interface IEntityManager
      Parameters:
      visitor - civilian to register
    • unregisterCivilian

      public void unregisterCivilian(AbstractCivilianEntity entity)
      Description copied from interface: IEntityManager
      Unregiters a civilian with the colony
      Specified by:
      unregisterCivilian in interface IEntityManager
      Parameters:
      entity - civilian to unregister
    • read

      public void read(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull net.minecraft.nbt.CompoundTag compound)
      Description copied from interface: IEntityManager
      Read the civilian from nbt.
      Specified by:
      read in interface IEntityManager
      Parameters:
      compound - the compound to read it from.
    • write

      public void write(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull net.minecraft.nbt.CompoundTag compoundNBT)
      Description copied from interface: IEntityManager
      Write the civilian to nbt.
      Specified by:
      write in interface IEntityManager
      Parameters:
      compoundNBT - the compound to write it to.
    • sendPackets

      public void sendPackets(@NotNull @NotNull Set<net.minecraft.server.level.ServerPlayer> closeSubscribers, @NotNull @NotNull Set<net.minecraft.server.level.ServerPlayer> newSubscribers)
      Description copied from interface: IEntityManager
      Sends packages to update the civilian.
      Specified by:
      sendPackets in interface IEntityManager
      Parameters:
      closeSubscribers - the existing subscribers.
      newSubscribers - new subscribers
    • getCivilianDataMap

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

      public IVisitorData getCivilian(int citizenId)
      Description copied from interface: IEntityManager
      Get civilian by ID.
      Specified by:
      getCivilian in interface IEntityManager
      Parameters:
      citizenId - ID of the civilian.
      Returns:
      ICivilianData associated with the ID, or null if it was not found.
    • getVisitor

      public <T extends IVisitorData> T getVisitor(int citizenId)
      Description copied from interface: IVisitorManager
      Gets the visitor data for the given citizen
      Specified by:
      getVisitor in interface IVisitorManager
      Type Parameters:
      T - data type
      Parameters:
      citizenId - id to get data for
      Returns:
      visitor data
    • spawnOrCreateCivilian

      public <T extends ICivilianData> T spawnOrCreateCivilian(T data, net.minecraft.world.level.Level world, List<net.minecraft.core.BlockPos> spawnPositions, boolean force)
      Description copied from interface: IEntityManager
      Spawns a civilian with the specific civilian data.
      Specified by:
      spawnOrCreateCivilian in interface IEntityManager
      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

      public IVisitorData createAndRegisterCivilianData()
      Description copied from interface: IEntityManager
      Creates Civilian Data for a new civilian
      Specified by:
      createAndRegisterCivilianData in interface IEntityManager
      Returns:
      new ICivilianData
    • removeCivilian

      public void removeCivilian(@NotNull @NotNull ICivilianData citizen)
      Description copied from interface: IEntityManager
      Removes a civilian from the colony.
      Specified by:
      removeCivilian in interface IEntityManager
      Parameters:
      citizen - data to remove.
    • markDirty

      public void markDirty()
      Description copied from interface: IEntityManager
      Marks civilian data dirty.
      Specified by:
      markDirty in interface IEntityManager
    • clearDirty

      public void clearDirty()
      Description copied from interface: IEntityManager
      Clear dirty from all buildings.
      Specified by:
      clearDirty in interface IEntityManager
    • onColonyTick

      public void onColonyTick(IColony colony)
      Description copied from interface: IEntityManager
      Actions to execute on a colony tick.
      Specified by:
      onColonyTick in interface IEntityManager
      Parameters:
      colony - the event.