Interface ICitizenManager

All Superinterfaces:
IEntityManager
All Known Implementing Classes:
CitizenManager

public interface ICitizenManager extends IEntityManager
The interface of the citizen manager.
  • Method Details

    • spawnOrCreateCitizen

      void spawnOrCreateCitizen()
      Spawn a brand new Citizen.
    • spawnOrCreateCitizen

      default ICitizenData spawnOrCreateCitizen(ICitizenData data, @NotNull @NotNull net.minecraft.world.level.Level world)
      Spawn a citizen with specific citizen data.
      Parameters:
      data - Data to use to spawn citizen.
      world - the world to spawn it in.
      Returns:
      the citizen data of the spawned citizen.
    • spawnOrCreateCitizen

      default ICitizenData spawnOrCreateCitizen(ICitizenData data, @NotNull @NotNull net.minecraft.world.level.Level world, net.minecraft.core.BlockPos spawnPos)
      Spawn a citizen with specific citizen data.
      Parameters:
      data - Data to use to spawn citizen.
      world - the world to spawn it in.
      spawnPos - the Blockposition to spawn at
      Returns:
      the new citizen.
    • getJoblessCitizen

      @Nullable @Nullable ICitizenData getJoblessCitizen()
      Get the first unemployed citizen.
      Returns:
      Citizen with no current job.
    • calculateMaxCitizens

      void calculateMaxCitizens()
      Recalculates how many citizen can be in the colony.
    • createAndRegisterCivilianData

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

      ICitizenData resurrectCivilianData(@NotNull @NotNull net.minecraft.nbt.CompoundTag compoundNBT, boolean resetId, @NotNull @NotNull net.minecraft.world.level.Level world, net.minecraft.core.BlockPos spawnPos)
      Resurrect a citizen from its saved NBT.
      Parameters:
      compoundNBT - the saved citizen NBT
      resetId - if true, will calculate a new citizen ID
      world -
      spawnPos - position where to resurrect the citizen
      Returns:
      the citizenData of the resurrected citizen
    • getCitizens

      List<ICitizenData> getCitizens()
      Get all citizens.
      Returns:
      a copy of the list of citizens.
    • getMaxCitizens

      int getMaxCitizens()
      Get max citizens of the colony.
      Returns:
      the amount.
    • getPotentialMaxCitizens

      int getPotentialMaxCitizens()
      Get potential max citizens of the colony. The potential considers all available beds including not assigned guard towers.
      Returns:
      the amount.
    • maxCitizensFromResearch

      double maxCitizensFromResearch()
      Get the max citizens based on the research.
      Returns:
      the max.
    • getCurrentCitizenCount

      int getCurrentCitizenCount()
      Get the current amount of citizens, might be bigger then getMaxCitizens()
      Returns:
      The current amount of citizens in the colony.
    • setMaxCitizens

      void setMaxCitizens(int newMaxCitizens)
      Set the new max citizens.
      Parameters:
      newMaxCitizens - the amount to set.
    • setPotentialMaxCitizens

      void setPotentialMaxCitizens(int newMaxCitizens)
      Set the new potential max citizens. The potential considers all available beds including not assigned guard towers.
      Parameters:
      newMaxCitizens - the potential amount to set.
    • checkCitizensForHappiness

      void checkCitizensForHappiness()
      Check for the citizen happiness and update the colony happiness with it.
    • tickCitizenData

      boolean tickCitizenData(int tickRate)
      Tick the citizen data of all active citizens.
    • updateCitizenMourn

      void updateCitizenMourn(ICitizenData data, boolean mourn)
      Call this to set all the citizens in the colony to mourn or not.
      Parameters:
      mourn - boolean to indicate if citizen should mourn or not
    • updateCitizenSleep

      void updateCitizenSleep(boolean sleep)
      Call this to set all citizens asleep
      Parameters:
      sleep - boolean to indicate whether the citizens are all asleep
    • getRandomCitizen

      ICitizenData getRandomCitizen()
      Get a random citizen.
      Returns:
      the random citizen.
    • injectModifier

      void injectModifier(IHappinessModifier modifier)
      Inject a modifier into all citizens
      Parameters:
      modifier - the modifier.
    • onCitizenSleep

      void onCitizenSleep()
      Call this when citizens sleep
    • getCivilian

      ICitizenData 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.
    • onWakeUp

      void onWakeUp()
      Called in the morning.
    • afterBuildingLoad

      void afterBuildingLoad()
      Post building load actions
    • onFlagChange

      void onFlagChange()
      Called when flag is changed