Interface ICitizenData

All Superinterfaces:
ICitizen, ICivilianData, net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>, IQuestGiver, IQuestParticipant
All Known Subinterfaces:
IVisitorData
All Known Implementing Classes:
CitizenData, VisitorData

public interface ICitizenData extends ICivilianData, IQuestGiver, IQuestParticipant
  • Field Details

    • MAX_SATURATION

      static final int MAX_SATURATION
      Maximum saturation of a citizen.
      See Also:
  • Method Details

    • onRemoveBuilding

      void onRemoveBuilding(IBuilding building)
      When a building is destroyed, inform the citizen so it can do any cleanup of associations that the building's. own IBuilding.onDestroyed did not do.
      Parameters:
      building - building that is destroyed.
    • getHomeBuilding

      @Nullable @Nullable IBuilding getHomeBuilding()
      Returns the home building of the citizen.
      Returns:
      home building.
    • setHomeBuilding

      void setHomeBuilding(@Nullable @Nullable IBuilding building)
      Sets the home of the citizen.
      Parameters:
      building - home building.
    • getWorkBuilding

      @Nullable @Nullable IBuilding getWorkBuilding()
      Returns the work building of a citizen.
      Returns:
      home building of a citizen.
    • getJob

      IJob<?> getJob()
      Returns the job of the citizen.
      Returns:
      Job of the citizen.
    • setJob

      void setJob(IJob<?> job)
      Sets the job of this citizen.
      Parameters:
      job - Job of the citizen.
    • getJob

      @Nullable <J extends IJob<?>> J getJob(@NotNull @NotNull Class<J> type)
      Returns the job subclass needed. Returns null on type mismatch.
      Type Parameters:
      J - The job type returned.
      Parameters:
      type - the type of job wanted.
      Returns:
      the job this citizen has.
    • setLastPosition

      void setLastPosition(net.minecraft.core.BlockPos lastPosition)
      Set the last position of the citizen.
      Parameters:
      lastPosition - the last position.
    • getLastPosition

      net.minecraft.core.BlockPos getLastPosition()
      Get the last position of the citizen.
      Returns:
      the last position.
    • setSaturation

      void setSaturation(double saturation)
      Sets the citizens current saturation.
      Parameters:
      saturation - to set
    • isAsleep

      boolean isAsleep()
      Check if citizen is asleep.
      Returns:
      true if so.
    • getBedPos

      net.minecraft.core.BlockPos getBedPos()
      Getter for the bedPos.
      Returns:
      the bedPos.
    • setAsleep

      void setAsleep(boolean asleep)
      Set asleep.
      Parameters:
      asleep - true if asleep.
    • setBedPos

      void setBedPos(net.minecraft.core.BlockPos bedPos)
      Set the bed pos.
      Parameters:
      bedPos - the pos to set.
    • getCitizenHappinessHandler

      ICitizenHappinessHandler getCitizenHappinessHandler()
      The Handler for the citizens happiness.
      Returns:
      the instance of the handler
    • getCitizenMournHandler

      ICitizenMournHandler getCitizenMournHandler()
      The Handler for the citizens mourning.
      Returns:
      the instance of the handler
    • getCitizenSkillHandler

      ICitizenSkillHandler getCitizenSkillHandler()
      Get the citizen skill handler.
      Returns:
      the handler.
    • getCitizenDiseaseHandler

      ICitizenDiseaseHandler getCitizenDiseaseHandler()
    • scheduleRestart

      void scheduleRestart(net.minecraft.server.level.ServerPlayer player)
      Schedule restart and cleanup.
      Parameters:
      player - the player scheduling it.
    • shouldRestart

      boolean shouldRestart()
      AI will be restarted, also restart building etc
      Returns:
      true if so.
    • restartDone

      void restartDone()
      Restart done successfully
    • setIsChild

      void setIsChild(boolean isChild)
      Set the child flag.
      Parameters:
      isChild - boolean
    • justAte

      boolean justAte()
      Check if the citizen just ate.
      Returns:
      true if so.
    • setJustAte

      void setJustAte(boolean justAte)
      Set or reset if the citizen just ate.
      Parameters:
      justAte - true if justAte, false to reset.
    • isIdleAtJob

      boolean isIdleAtJob()
      If is idle at job.
      Returns:
      true if so.
    • getJobStatus

      JobStatus getJobStatus()
      Queries the citizen's job status.
    • setJobStatus

      void setJobStatus(JobStatus status)
      Set the working status of the citizen.
      Parameters:
      status - the job status
    • getEntity

      Gets the entity
      Specified by:
      getEntity in interface ICivilianData
      Returns:
    • getStatus

      Gets the citizen's status
      Returns:
      status
    • setVisibleStatus

      void setVisibleStatus(VisibleCitizenStatus status)
      Sets the citizens status
      Parameters:
      status - status to set
    • getStatusPosition

      @Nullable @Nullable net.minecraft.core.BlockPos getStatusPosition()
      Gets a location of interest of this citizen's job.
      Returns:
      the location, or null if nowhere is particularly interesting right now.
    • setStatusPosition

      void setStatusPosition(@Nullable @Nullable net.minecraft.core.BlockPos pos)
      Sets the location of interest of this citizen.
      Parameters:
      pos - the location, or null to clear.
    • getRandom

      Random getRandom()
      Get the random var of the citizen.
      Returns:
      the random.
    • applyResearchEffects

      void applyResearchEffects()
      Applies the effects of research to the data's entity
    • onGoSleep

      void onGoSleep()
      Triggered when the citizen is going to sleep
    • setNextRespawnPosition

      void setNextRespawnPosition(net.minecraft.core.BlockPos pos)
      Sets the next position to respawn at
      Parameters:
      pos - position to set
    • needsBetterFood

      boolean needsBetterFood()
      Returns whether the citizen has food in their inventory that's not good enough (but no good food)
      Returns:
      true if so
    • getPartner

      @Nullable @Nullable ICitizenData getPartner()
      Get the partner of the citizen.
      Returns:
      the partner or null if non existent.
    • getChildren

      List<Integer> getChildren()
      Get the list of children of a citizen.
      Returns:
      the citizen ids.
    • getSiblings

      List<Integer> getSiblings()
      Get the list of children of a citizen.
      Returns:
      the citizen ids.
    • getParents

      Tuple<String,String> getParents()
      Get the names of the parents.
      Returns:
      the name.
    • addSiblings

      void addSiblings(Integer... siblings)
      Add one or more siblings to a citizen.
      Parameters:
      siblings - the ids of the siblings.
    • addChildren

      void addChildren(Integer... children)
      Add one or more children to a citizen.
      Parameters:
      children - the ids of the children.
    • setPartner

      void setPartner(int id)
      Set a new partner to the citizen.
      Parameters:
      id - the partner id.
    • onDeath

      void onDeath(Integer id)
      On death of a citizen this is invoked on the related citizens.
      Parameters:
      id - the id of the citizen.
    • setParents

      void setParents(String firstParent, String secondParent)
      Set the parents of the citizen.
      Parameters:
      firstParent - the parent name.
      secondParent - second parent name.
    • generateName

      void generateName(@NotNull @NotNull Random rand, String firstParentName, String secondParentName, CitizenNameFile nameFile)
      Generate the name of the citizen.
      Parameters:
      rand - used random func.
      firstParentName - name of the first parent.
      secondParentName - name of the second parent.
    • isRelatedTo

      boolean isRelatedTo(ICitizenData data)
      Check if the two citizens are related.
      Parameters:
      data - the data of the citizen.
      Returns:
      true if so.
    • doesLiveWith

      boolean doesLiveWith(ICitizenData data)
      Check if the two citizens live together.
      Parameters:
      data - the data of the other citizen.
      Returns:
      true if so.
    • setWorking

      default void setWorking(boolean b)
      Set if the worker is currently working actively.
      Parameters:
      b - true if so.
    • isWorking

      default boolean isWorking()
      Check if the worker is currently actively working.
      Returns:
      true if so.
    • onResurrect

      void onResurrect()
      On citizen being resurrected.
    • hasCustomTexture

      default boolean hasCustomTexture()
      Check if the citizen has some kind of custom texture.
      Returns:
      true if so.
    • setCustomTexture

      void setCustomTexture(UUID texture)
      Setter of the custom texture.
      Parameters:
      texture - the texture uuid.
    • getCustomTexture

      UUID getCustomTexture()
      Get custom texture uuid.
      Returns:
      uuid to return.
    • setIdleDays

      void setIdleDays(int days)
      Sets the citizen idle for a certain amount of days
      Parameters:
      days - amount of days
    • onQuestCompletion

      void onQuestCompletion(net.minecraft.resources.ResourceLocation questId)
      On completing a quest.
      Parameters:
      questId - the id of the completed quest.
    • onInteractionClosed

      void onInteractionClosed(net.minecraft.network.chat.Component key, net.minecraft.server.level.ServerPlayer sender)
      Trigger for server side interaction closing.
      Parameters:
      key - the key of the interaction.
      sender - the player closing it.
    • onBuildingLoad

      void onBuildingLoad()
      Called after buildings loaded
    • setInteractedRecently

      void setInteractedRecently(UUID player)
      Called when a player interacts with a citizen
      Parameters:
      player - the player that interacted
    • hasQuestAssignment

      boolean hasQuestAssignment()
      If any quest is assigned to the citizen.
      Returns:
      true if so.
    • getHomePosition

      @Nullable @Nullable net.minecraft.core.BlockPos getHomePosition()
      Get the home position of the citizen.
      Returns:
      the pos to go home to.
    • getDiseaseModifier

      double getDiseaseModifier()
      Personal citizen disease modifier.
      Returns:
      the disease modifier.
    • getCitizenFoodHandler

      ICitizenFoodHandler getCitizenFoodHandler()
      The Handler for the citizens food.
      Returns:
      the instance of the handler
    • getLeisureTime

      int getLeisureTime()
      Get leisure time. Time in ticks citizens might be wanting to do leisure instead of work.
      Returns:
      the leftover leisure time.
    • onRequestCompleted

      void onRequestCompleted(IToken<?> token)
      Request completed hook into citizen data.
      Parameters:
      token - the id.