Class CitizenData

java.lang.Object
com.minecolonies.core.colony.CitizenData
All Implemented Interfaces:
ICitizen, ICitizenData, ICivilianData, IQuestGiver, IQuestParticipant, net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
Direct Known Subclasses:
VisitorData

public class CitizenData extends Object implements ICitizenData
Extra data for Citizens.
  • Field Details

    • MAX_HEALTH

      public static final float MAX_HEALTH
      The max health.
      See Also:
    • SUFFIXES

      public static final List<String> SUFFIXES
      Possible texture suffixes.
    • inventory

      protected InventoryCitizen inventory
      Inventory of the citizen.
    • citizenChatOptions

      protected final Map<net.minecraft.network.chat.Component,IInteractionResponseHandler> citizenChatOptions
      The citizen chat options on the server side.
  • Constructor Details

    • CitizenData

      public CitizenData(int id, IColony colony)
      Create a CitizenData given an ID. Used as a super-constructor or during loading.
      Parameters:
      id - ID of the Citizen.
      colony - Colony the Citizen belongs to.
  • Method Details

    • onResponseTriggered

      public void onResponseTriggered(@NotNull @NotNull net.minecraft.network.chat.Component key, int responseId, net.minecraft.world.entity.player.Player player)
      Description copied from interface: ICivilianData
      Trigger the response on the server side.
      Specified by:
      onResponseTriggered in interface ICivilianData
      Parameters:
      key - the key of the component.
      responseId - the triggered response.
      player - the world it was triggered in.
    • getEntity

      @NotNull public @NotNull Optional<AbstractEntityCitizen> getEntity()
      Return the entity instance of the citizen data. Respawn the citizen if needed.
      Specified by:
      getEntity in interface ICitizenData
      Specified by:
      getEntity in interface ICivilianData
      Returns:
      AbstractEntityCitizen of the citizen data.
    • getVoiceProfile

      public int getVoiceProfile()
      Description copied from interface: ICivilianData
      Get the voice profile of the citizen.
      Specified by:
      getVoiceProfile in interface ICivilianData
      Returns:
      the profile id.
    • setVoiceProfile

      public void setVoiceProfile(int profile)
      Description copied from interface: ICivilianData
      Set the voice profile of the citizen.
      Specified by:
      setVoiceProfile in interface ICivilianData
      Parameters:
      profile - the profile to set.
    • setEntity

      public void setEntity(@Nullable @Nullable AbstractCivilianEntity citizen)
      Description copied from interface: ICivilianData
      Sets the entity of the civilian data.
      Specified by:
      setEntity in interface ICivilianData
      Parameters:
      citizen - AbstractCivilianEntity instance of the civilian data.
    • markDirty

      public void markDirty(int time)
      Description copied from interface: ICivilianData
      Marks the instance dirty.
      Specified by:
      markDirty in interface ICivilianData
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getColony

      public IColony getColony()
      Description copied from interface: ICitizen
      Returns the visitor's colony
      Specified by:
      getColony in interface ICitizen
      Returns:
      colony
    • getId

      public int getId()
      Description copied from interface: ICitizen
      Returns the id of the citizen.
      Specified by:
      getId in interface ICitizen
      Returns:
      id of the citizen.
    • initForNewCivilian

      public void initForNewCivilian()
      Description copied from interface: ICivilianData
      Initializes a new citizen, when not read from nbt
      Specified by:
      initForNewCivilian in interface ICivilianData
    • initEntityValues

      public void initEntityValues()
      Initializes the entities values from citizen data.
      Specified by:
      initEntityValues in interface ICivilianData
    • generateName

      public static String generateName(@NotNull @NotNull Random rand, boolean female, IColony colony, CitizenNameFile nameFile)
      Generates a random name from a set of names.
      Parameters:
      rand - Random object.
      female - the gender
      colony - the colony.
      Returns:
      Name of the citizen.
    • generateName

      public void generateName(@NotNull @NotNull Random rand, String firstParentName, String secondParentName, CitizenNameFile nameFile)
      Generates a random name considering both parent names.
      Specified by:
      generateName in interface ICitizenData
      Parameters:
      rand - Random object.
      firstParentName - name of the first parent.
      secondParentName - name of the second parent.
    • isRelatedTo

      public boolean isRelatedTo(ICitizenData data)
      Description copied from interface: ICitizenData
      Check if the two citizens are related.
      Specified by:
      isRelatedTo in interface ICitizenData
      Parameters:
      data - the data of the citizen.
      Returns:
      true if so.
    • doesLiveWith

      public boolean doesLiveWith(ICitizenData data)
      Description copied from interface: ICitizenData
      Check if the two citizens live together.
      Specified by:
      doesLiveWith in interface ICitizenData
      Parameters:
      data - the data of the other citizen.
      Returns:
      true if so.
    • getName

      public String getName()
      Description copied from interface: ICitizen
      Returns the name of the citizen.
      Specified by:
      getName in interface ICitizen
      Specified by:
      getName in interface IQuestParticipant
      Returns:
      name of the citizen.
    • isFemale

      public boolean isFemale()
      Description copied from interface: ICitizen
      Returns true if citizen is female, false for male.
      Specified by:
      isFemale in interface ICitizen
      Returns:
      true for female, false for male.
    • setGenderAndGenerateName

      public void setGenderAndGenerateName(boolean isFemale)
      Description copied from interface: ICivilianData
      Sets a gender and generates a new name
      Specified by:
      setGenderAndGenerateName in interface ICivilianData
      Parameters:
      isFemale -
    • setGender

      public void setGender(boolean isFemale)
      Description copied from interface: ICivilianData
      Sets the gender
      Specified by:
      setGender in interface ICivilianData
      Parameters:
      isFemale -
    • setPaused

      public void setPaused(boolean p)
      Description copied from interface: ICitizen
      Check if the citizen is paused.
      Specified by:
      setPaused in interface ICitizen
      Parameters:
      p - true if paused, else false.
    • isPaused

      public boolean isPaused()
      Description copied from interface: ICitizen
      Check if the citizen is paused.
      Specified by:
      isPaused in interface ICitizen
      Returns:
      true for paused, false for working.
    • getTextureId

      public int getTextureId()
      Description copied from interface: ICivilianData
      Returns the texture id for the civilian.
      Specified by:
      getTextureId in interface ICivilianData
      Returns:
      texture ID.
    • isDirty

      public boolean isDirty()
      Description copied from interface: ICivilianData
      Returns whether or not the instance is dirty.
      Specified by:
      isDirty in interface ICivilianData
      Returns:
      true when dirty, otherwise false.
    • clearDirty

      public void clearDirty()
      Description copied from interface: ICivilianData
      Markt the instance not dirty.
      Specified by:
      clearDirty in interface ICivilianData
    • onRemoveBuilding

      public void onRemoveBuilding(IBuilding building)
      Description copied from interface: ICitizenData
      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.
      Specified by:
      onRemoveBuilding in interface ICitizenData
      Parameters:
      building - building that is destroyed.
    • getHomeBuilding

      @Nullable public @Nullable IBuilding getHomeBuilding()
      Description copied from interface: ICitizenData
      Returns the home building of the citizen.
      Specified by:
      getHomeBuilding in interface ICitizenData
      Returns:
      home building.
    • setHomeBuilding

      public void setHomeBuilding(@Nullable @Nullable IBuilding building)
      Description copied from interface: ICitizenData
      Sets the home of the citizen.
      Specified by:
      setHomeBuilding in interface ICitizenData
      Parameters:
      building - home building.
    • getWorkBuilding

      @Nullable public @Nullable IBuilding getWorkBuilding()
      Description copied from interface: ICitizenData
      Returns the work building of a citizen.
      Specified by:
      getWorkBuilding in interface ICitizenData
      Returns:
      home building of a citizen.
    • updateEntityIfNecessary

      public void updateEntityIfNecessary()
      Description copied from interface: ICivilianData
      Updates AbstractCivilianEntity for the instance.
      Specified by:
      updateEntityIfNecessary in interface ICivilianData
    • getJob

      @Nullable public @Nullable IJob<?> getJob()
      Description copied from interface: ICitizenData
      Returns the job of the citizen.
      Specified by:
      getJob in interface ICitizenData
      Returns:
      Job of the citizen.
    • setJob

      public void setJob(IJob<?> job)
      Description copied from interface: ICitizenData
      Sets the job of this citizen.
      Specified by:
      setJob in interface ICitizenData
      Parameters:
      job - Job of the citizen.
    • getJob

      @Nullable public <J extends IJob<?>> J getJob(@NotNull @NotNull Class<J> type)
      Description copied from interface: ICitizenData
      Returns the job subclass needed. Returns null on type mismatch.
      Specified by:
      getJob in interface ICitizenData
      Type Parameters:
      J - The job type returned.
      Parameters:
      type - the type of job wanted.
      Returns:
      the job this citizen has.
    • serializeViewNetworkData

      public void serializeViewNetworkData(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf)
      Description copied from interface: ICivilianData
      Writes the citizen data to a byte buf for transition.
      Specified by:
      serializeViewNetworkData in interface ICivilianData
      Parameters:
      buf - Buffer to write to.
    • increaseSaturation

      public void increaseSaturation(double extraSaturation)
      Description copied from interface: ICivilianData
      Getter for the saturation.
      Specified by:
      increaseSaturation in interface ICivilianData
      Parameters:
      extraSaturation - the extra saturation
    • decreaseSaturation

      public void decreaseSaturation(double extraSaturation)
      Description copied from interface: ICivilianData
      Getter for the saturation.
      Specified by:
      decreaseSaturation in interface ICivilianData
      Parameters:
      extraSaturation - the saturation to remove.
    • setName

      public void setName(String name)
      Description copied from interface: ICivilianData
      Set the citizen name.
      Specified by:
      setName in interface ICivilianData
      Parameters:
      name - the name to set.
    • setLastPosition

      public void setLastPosition(net.minecraft.core.BlockPos lastPosition)
      Description copied from interface: ICitizenData
      Set the last position of the citizen.
      Specified by:
      setLastPosition in interface ICitizenData
      Parameters:
      lastPosition - the last position.
    • getLastPosition

      public net.minecraft.core.BlockPos getLastPosition()
      Description copied from interface: ICitizenData
      Get the last position of the citizen.
      Specified by:
      getLastPosition in interface ICitizenData
      Returns:
      the last position.
    • getSaturation

      public double getSaturation()
      Description copied from interface: ICitizen
      Getter for the saturation.
      Specified by:
      getSaturation in interface ICitizen
      Returns:
      the saturation.
    • setSaturation

      public void setSaturation(double saturation)
      Description copied from interface: ICitizenData
      Sets the citizens current saturation.
      Specified by:
      setSaturation in interface ICitizenData
      Parameters:
      saturation - to set
    • getInventory

      public InventoryCitizen getInventory()
      Description copied from interface: ICitizen
      Get the inventory of the citizen.
      Specified by:
      getInventory in interface ICitizen
      Returns:
      the inventory of the citizen.
    • isAsleep

      public boolean isAsleep()
      Description copied from interface: ICitizenData
      Check if citizen is asleep.
      Specified by:
      isAsleep in interface ICitizenData
      Returns:
      true if so.
    • getBedPos

      public net.minecraft.core.BlockPos getBedPos()
      Description copied from interface: ICitizenData
      Getter for the bedPos.
      Specified by:
      getBedPos in interface ICitizenData
      Returns:
      the bedPos.
    • setAsleep

      public void setAsleep(boolean asleep)
      Description copied from interface: ICitizenData
      Set asleep.
      Specified by:
      setAsleep in interface ICitizenData
      Parameters:
      asleep - true if asleep.
    • setBedPos

      public void setBedPos(net.minecraft.core.BlockPos bedPos)
      Description copied from interface: ICitizenData
      Set the bed pos.
      Specified by:
      setBedPos in interface ICitizenData
      Parameters:
      bedPos - the pos to set.
    • getCitizenHappinessHandler

      public CitizenHappinessHandler getCitizenHappinessHandler()
      Description copied from interface: ICitizenData
      The Handler for the citizens happiness.
      Specified by:
      getCitizenHappinessHandler in interface ICitizenData
      Returns:
      the instance of the handler
    • getCitizenMournHandler

      public CitizenMournHandler getCitizenMournHandler()
      Description copied from interface: ICitizenData
      The Handler for the citizens mourning.
      Specified by:
      getCitizenMournHandler in interface ICitizenData
      Returns:
      the instance of the handler
    • getCitizenSkillHandler

      public ICitizenSkillHandler getCitizenSkillHandler()
      Description copied from interface: ICitizenData
      Get the citizen skill handler.
      Specified by:
      getCitizenSkillHandler in interface ICitizenData
      Returns:
      the handler.
    • getCitizenFoodHandler

      public ICitizenFoodHandler getCitizenFoodHandler()
      Description copied from interface: ICitizenData
      The Handler for the citizens food.
      Specified by:
      getCitizenFoodHandler in interface ICitizenData
      Returns:
      the instance of the handler
    • getCitizenDiseaseHandler

      public ICitizenDiseaseHandler getCitizenDiseaseHandler()
      Specified by:
      getCitizenDiseaseHandler in interface ICitizenData
    • scheduleRestart

      public void scheduleRestart(net.minecraft.server.level.ServerPlayer player)
      Description copied from interface: ICitizenData
      Schedule restart and cleanup.
      Specified by:
      scheduleRestart in interface ICitizenData
      Parameters:
      player - the player scheduling it.
    • shouldRestart

      public boolean shouldRestart()
      Description copied from interface: ICitizenData
      AI will be restarted, also restart building etc
      Specified by:
      shouldRestart in interface ICitizenData
      Returns:
      true if so.
    • restartDone

      public void restartDone()
      Description copied from interface: ICitizenData
      Restart done successfully
      Specified by:
      restartDone in interface ICitizenData
    • setIsChild

      public void setIsChild(boolean isChild)
      Description copied from interface: ICitizenData
      Set the child flag.
      Specified by:
      setIsChild in interface ICitizenData
      Parameters:
      isChild - boolean
    • isChild

      public boolean isChild()
      Description copied from interface: ICitizen
      Check if the entity is a child
      Specified by:
      isChild in interface ICitizen
      Returns:
      true if child
    • justAte

      public boolean justAte()
      Description copied from interface: ICitizenData
      Check if the citizen just ate.
      Specified by:
      justAte in interface ICitizenData
      Returns:
      true if so.
    • setJustAte

      public void setJustAte(boolean justAte)
      Description copied from interface: ICitizenData
      Set or reset if the citizen just ate.
      Specified by:
      setJustAte in interface ICitizenData
      Parameters:
      justAte - true if justAte, false to reset.
    • serializeNBT

      public net.minecraft.nbt.CompoundTag serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider)
      Specified by:
      serializeNBT in interface net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
    • deserializeNBT

      public void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag nbtTagCompound)
      Specified by:
      deserializeNBT in interface net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
    • onBuildingLoad

      public void onBuildingLoad()
      Description copied from interface: ICitizenData
      Called after buildings loaded
      Specified by:
      onBuildingLoad in interface ICitizenData
    • setInteractedRecently

      public void setInteractedRecently(UUID player)
      Description copied from interface: ICitizenData
      Called when a player interacts with a citizen
      Specified by:
      setInteractedRecently in interface ICitizenData
      Parameters:
      player - the player that interacted
    • update

      public void update(int tickRate)
      Description copied from interface: ICivilianData
      Tick the data to update values.
      Specified by:
      update in interface ICivilianData
    • triggerInteraction

      public void triggerInteraction(@NotNull @NotNull IInteractionResponseHandler handler)
      Description copied from interface: ICivilianData
      Trigger a possible interaction.
      Specified by:
      triggerInteraction in interface ICivilianData
      Parameters:
      handler - the new handler.
    • isIdleAtJob

      public boolean isIdleAtJob()
      Description copied from interface: ICitizenData
      If is idle at job.
      Specified by:
      isIdleAtJob in interface ICitizenData
      Returns:
      true if the citizen's job status is JobStatus.STUCK.
    • getJobStatus

      public JobStatus getJobStatus()
      Description copied from interface: ICitizenData
      Queries the citizen's job status.
      Specified by:
      getJobStatus in interface ICitizenData
    • setJobStatus

      public void setJobStatus(JobStatus status)
      Description copied from interface: ICitizenData
      Set the working status of the citizen.
      Specified by:
      setJobStatus in interface ICitizenData
      Parameters:
      status - the job status
    • getTextureSuffix

      public String getTextureSuffix()
      Description copied from interface: ICivilianData
      Get the texture suffix.
      Specified by:
      getTextureSuffix in interface ICivilianData
      Returns:
      the suffix.
    • setSuffix

      public void setSuffix(String suffix)
      Description copied from interface: ICivilianData
      Set the texture suffix.
      Specified by:
      setSuffix in interface ICivilianData
      Parameters:
      suffix - the suffix to set.
    • createRequest

      public <R extends IRequestable> IToken<?> createRequest(@NotNull R requested)
      Description copied from interface: ICivilianData
      Create a blocking request.
      Specified by:
      createRequest in interface ICivilianData
      Type Parameters:
      R - the Type
      Parameters:
      requested - the request to create.
      Returns:
      the token of the request.
    • createRequestAsync

      public <R extends IRequestable> IToken<?> createRequestAsync(@NotNull R requested)
      Description copied from interface: ICivilianData
      Create an async request.
      Specified by:
      createRequestAsync in interface ICivilianData
      Type Parameters:
      R - the Type
      Parameters:
      requested - the request to create.
      Returns:
      the token of the request.
    • onRequestCancelled

      public void onRequestCancelled(@NotNull @NotNull IToken<?> token)
      Description copied from interface: ICivilianData
      Called on request canceled.
      Specified by:
      onRequestCancelled in interface ICivilianData
      Parameters:
      token - the token to be canceled.
    • onRequestCompleted

      public void onRequestCompleted(IToken<?> token)
      Description copied from interface: ICitizenData
      Request completed hook into citizen data.
      Specified by:
      onRequestCompleted in interface ICitizenData
      Parameters:
      token - the id.
    • isRequestAsync

      public boolean isRequestAsync(@NotNull @NotNull IToken<?> token)
      Description copied from interface: ICivilianData
      Check if a request is async.
      Specified by:
      isRequestAsync in interface ICivilianData
      Parameters:
      token - the token to check.
      Returns:
      true if it is.
    • getStatus

      public VisibleCitizenStatus getStatus()
      Description copied from interface: ICitizenData
      Gets the citizen's status
      Specified by:
      getStatus in interface ICitizenData
      Returns:
      status
    • setVisibleStatus

      public void setVisibleStatus(VisibleCitizenStatus status)
      Description copied from interface: ICitizenData
      Sets the citizens status
      Specified by:
      setVisibleStatus in interface ICitizenData
      Parameters:
      status - status to set
    • getStatusPosition

      @Nullable public @Nullable net.minecraft.core.BlockPos getStatusPosition()
      Description copied from interface: ICitizenData
      Gets a location of interest of this citizen's job.
      Specified by:
      getStatusPosition in interface ICitizenData
      Returns:
      the location, or null if nowhere is particularly interesting right now.
    • setStatusPosition

      public void setStatusPosition(@Nullable @Nullable net.minecraft.core.BlockPos pos)
      Description copied from interface: ICitizenData
      Sets the location of interest of this citizen.
      Specified by:
      setStatusPosition in interface ICitizenData
      Parameters:
      pos - the location, or null to clear.
    • loadFromNBT

      public static CitizenData loadFromNBT(IColony colony, net.minecraft.nbt.CompoundTag nbt, @NotNull net.minecraft.core.HolderLookup.Provider provider)
      Loads this citizen data from nbt
      Parameters:
      colony - colony to load for
      nbt - nbt compound to read from
      Returns:
      new CitizenData
    • getRandom

      public Random getRandom()
      Description copied from interface: ICitizenData
      Get the random var of the citizen.
      Specified by:
      getRandom in interface ICitizenData
      Returns:
      the random.
    • applyResearchEffects

      public void applyResearchEffects()
      Description copied from interface: ICitizenData
      Applies the effects of research to the data's entity
      Specified by:
      applyResearchEffects in interface ICitizenData
    • onGoSleep

      public void onGoSleep()
      Description copied from interface: ICitizenData
      Triggered when the citizen is going to sleep
      Specified by:
      onGoSleep in interface ICitizenData
    • setNextRespawnPosition

      public void setNextRespawnPosition(net.minecraft.core.BlockPos pos)
      Description copied from interface: ICitizenData
      Sets the next position to respawn at
      Specified by:
      setNextRespawnPosition in interface ICitizenData
      Parameters:
      pos - position to set
    • needsBetterFood

      public boolean needsBetterFood()
      Description copied from interface: ICitizenData
      Returns whether the citizen has food in their inventory that's not good enough (but no good food)
      Specified by:
      needsBetterFood in interface ICitizenData
      Returns:
      true if so
    • isWorking

      public boolean isWorking()
      Description copied from interface: ICitizenData
      Check if the worker is currently actively working.
      Specified by:
      isWorking in interface ICitizenData
      Returns:
      true if so.
    • onResurrect

      public void onResurrect()
      Description copied from interface: ICitizenData
      On citizen being resurrected.
      Specified by:
      onResurrect in interface ICitizenData
    • setWorking

      public void setWorking(boolean isWorking)
      Description copied from interface: ICitizenData
      Set if the worker is currently working actively.
      Specified by:
      setWorking in interface ICitizenData
      Parameters:
      isWorking - true if so.
    • getPartner

      @Nullable public @Nullable ICitizenData getPartner()
      Description copied from interface: ICitizenData
      Get the partner of the citizen.
      Specified by:
      getPartner in interface ICitizenData
      Returns:
      the partner or null if non existent.
    • getChildren

      public List<Integer> getChildren()
      Description copied from interface: ICitizenData
      Get the list of children of a citizen.
      Specified by:
      getChildren in interface ICitizenData
      Returns:
      the citizen ids.
    • getSiblings

      public List<Integer> getSiblings()
      Description copied from interface: ICitizenData
      Get the list of children of a citizen.
      Specified by:
      getSiblings in interface ICitizenData
      Returns:
      the citizen ids.
    • getParents

      public Tuple<String,String> getParents()
      Description copied from interface: ICitizenData
      Get the names of the parents.
      Specified by:
      getParents in interface ICitizenData
      Returns:
      the name.
    • addSiblings

      public void addSiblings(Integer... siblings)
      Description copied from interface: ICitizenData
      Add one or more siblings to a citizen.
      Specified by:
      addSiblings in interface ICitizenData
      Parameters:
      siblings - the ids of the siblings.
    • addChildren

      public void addChildren(Integer... children)
      Description copied from interface: ICitizenData
      Add one or more children to a citizen.
      Specified by:
      addChildren in interface ICitizenData
      Parameters:
      children - the ids of the children.
    • setPartner

      public void setPartner(int id)
      Description copied from interface: ICitizenData
      Set a new partner to the citizen.
      Specified by:
      setPartner in interface ICitizenData
      Parameters:
      id - the partner id.
    • onDeath

      public void onDeath(Integer id)
      Description copied from interface: ICitizenData
      On death of a citizen this is invoked on the related citizens.
      Specified by:
      onDeath in interface ICitizenData
      Parameters:
      id - the id of the citizen.
    • setParents

      public void setParents(String firstParent, String secondParent)
      Description copied from interface: ICitizenData
      Set the parents of the citizen.
      Specified by:
      setParents in interface ICitizenData
      Parameters:
      firstParent - the parent name.
      secondParent - second parent name.
    • setIdleDays

      public void setIdleDays(int days)
      Description copied from interface: ICitizenData
      Sets the citizen idle for a certain amount of days
      Specified by:
      setIdleDays in interface ICitizenData
      Parameters:
      days - amount of days
    • assignQuest

      public void assignQuest(IQuestInstance quest)
      Description copied from interface: IQuestGiver
      Assign quest authority to quest giver.
      Specified by:
      assignQuest in interface IQuestGiver
      Parameters:
      quest - the quest to assign to the entity.
    • openDialogue

      public void openDialogue(IQuestInstance quest, int index)
      Description copied from interface: IQuestParticipant
      Initiates a dialogue at the citizen.
      Specified by:
      openDialogue in interface IQuestParticipant
      Parameters:
      quest - the quest to open it for.
      index - the current objective index
    • addQuestParticipation

      public void addQuestParticipation(IQuestInstance quest)
      Description copied from interface: IQuestParticipant
      Notify quest participant about their participation.
      Specified by:
      addQuestParticipation in interface IQuestParticipant
      Parameters:
      quest - the quest to assign to the entity.
    • onQuestDeletion

      public void onQuestDeletion(net.minecraft.resources.ResourceLocation questId)
      Description copied from interface: IQuestParticipant
      Method for cleanup purposes on quest deletion.
      Specified by:
      onQuestDeletion in interface IQuestParticipant
      Parameters:
      questId - the id of the quest.
    • isParticipantOfQuest

      public boolean isParticipantOfQuest(net.minecraft.resources.ResourceLocation questId)
      Description copied from interface: IQuestParticipant
      Check if the citizen has a quest open.
      Specified by:
      isParticipantOfQuest in interface IQuestParticipant
      Parameters:
      questId - the id of the quest.
      Returns:
      true if so.
    • onQuestCompletion

      public void onQuestCompletion(net.minecraft.resources.ResourceLocation questId)
      Description copied from interface: ICitizenData
      On completing a quest.
      Specified by:
      onQuestCompletion in interface ICitizenData
      Parameters:
      questId - the id of the completed quest.
    • hasQuestAssignment

      public boolean hasQuestAssignment()
      Description copied from interface: ICitizenData
      If any quest is assigned to the citizen.
      Specified by:
      hasQuestAssignment in interface ICitizenData
      Returns:
      true if so.
    • onInteractionClosed

      public void onInteractionClosed(net.minecraft.network.chat.Component key, net.minecraft.server.level.ServerPlayer sender)
      Description copied from interface: ICitizenData
      Trigger for server side interaction closing.
      Specified by:
      onInteractionClosed in interface ICitizenData
      Parameters:
      key - the key of the interaction.
      sender - the player closing it.
    • getUUID

      public UUID getUUID()
      Description copied from interface: ICivilianData
      Get the uuid for the citizen
      Specified by:
      getUUID in interface ICivilianData
      Returns:
      uuid
    • setCustomTexture

      public void setCustomTexture(UUID texture)
      Description copied from interface: ICitizenData
      Setter of the custom texture.
      Specified by:
      setCustomTexture in interface ICitizenData
      Parameters:
      texture - the texture uuid.
    • hasCustomTexture

      public boolean hasCustomTexture()
      Description copied from interface: ICitizenData
      Check if the citizen has some kind of custom texture.
      Specified by:
      hasCustomTexture in interface ICitizenData
      Returns:
      true if so.
    • getCustomTexture

      public UUID getCustomTexture()
      Description copied from interface: ICitizenData
      Get custom texture uuid.
      Specified by:
      getCustomTexture in interface ICitizenData
      Returns:
      uuid to return.
    • getHomePosition

      @Nullable public @Nullable net.minecraft.core.BlockPos getHomePosition()
      Description copied from interface: ICitizenData
      Get the home position of the citizen.
      Specified by:
      getHomePosition in interface ICitizenData
      Returns:
      the pos to go home to.
    • getDiseaseModifier

      public double getDiseaseModifier()
      Description copied from interface: ICitizenData
      Personal citizen disease modifier.
      Specified by:
      getDiseaseModifier in interface ICitizenData
      Returns:
      the disease modifier.
    • getLeisureTime

      public int getLeisureTime()
      Description copied from interface: ICitizenData
      Get leisure time. Time in ticks citizens might be wanting to do leisure instead of work.
      Specified by:
      getLeisureTime in interface ICitizenData
      Returns:
      the leftover leisure time.