Class CitizenDataView

java.lang.Object
com.minecolonies.core.colony.CitizenDataView
All Implemented Interfaces:
ICitizen, ICitizenDataView
Direct Known Subclasses:
VisitorDataView

public class CitizenDataView extends Object implements ICitizenDataView
The CitizenDataView is the client-side representation of a CitizenData. Views contain the CitizenData's data that is relevant to a Client, in a more client-friendly form. Mutable operations on a View result in a message to the server to perform the operation.
  • Field Details

    • entityId

      protected int entityId
    • name

      protected String name
    • female

      protected boolean female
    • paused

      protected boolean paused
    • isChild

      protected boolean isChild
    • colonyId

      protected int colonyId
      colony id of the citizen.
    • textureUUID

      protected UUID textureUUID
      Texture UUID.
  • Constructor Details

    • CitizenDataView

      protected CitizenDataView(int id, IColonyView colonyView)
      Set View id.
      Parameters:
      id - the id to set.
  • Method Details

    • 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.
    • getEntityId

      public int getEntityId()
      Description copied from interface: ICitizenDataView
      Entity Id getter.
      Specified by:
      getEntityId in interface ICitizenDataView
      Returns:
      entity id.
    • getName

      public String getName()
      Description copied from interface: ICitizen
      Returns the name of the citizen.
      Specified by:
      getName in interface ICitizen
      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.
    • 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.
    • getColony

      public IColonyView getColony()
      Description copied from interface: ICitizen
      Returns the visitor's colony
      Specified by:
      getColony in interface ICitizen
      Specified by:
      getColony in interface ICitizenDataView
      Returns:
      colony
    • 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
    • setPaused

      public void setPaused(boolean p)
      DEPRECATED
      Specified by:
      setPaused in interface ICitizen
      Parameters:
      p - true if paused, else false.
    • getJob

      public String getJob()
      Description copied from interface: ICitizenDataView
      Entity job getter.
      Specified by:
      getJob in interface ICitizenDataView
      Returns:
      the job as a string.
    • getJobComponent

      public net.minecraft.network.chat.MutableComponent getJobComponent()
      Description copied from interface: ICitizenDataView
      Get the job as mutable component.
      Specified by:
      getJobComponent in interface ICitizenDataView
      Returns:
      the job desc.
    • getHomeBuilding

      @Nullable public @Nullable net.minecraft.core.BlockPos getHomeBuilding()
      Description copied from interface: ICitizenDataView
      Get the entities home building.
      Specified by:
      getHomeBuilding in interface ICitizenDataView
      Returns:
      the home coordinates.
    • getWorkBuilding

      @Nullable public @Nullable net.minecraft.core.BlockPos getWorkBuilding()
      Description copied from interface: ICitizenDataView
      Get the entities work building.
      Specified by:
      getWorkBuilding in interface ICitizenDataView
      Returns:
      the work coordinates.
    • setHomeBuilding

      public void setHomeBuilding(net.minecraft.core.BlockPos homeBuilding)
      Description copied from interface: ICitizenDataView
      Set the home building on the client side.
      Specified by:
      setHomeBuilding in interface ICitizenDataView
      Parameters:
      homeBuilding - the pos of the home building.
    • setWorkBuilding

      public void setWorkBuilding(@Nullable @Nullable net.minecraft.core.BlockPos bp)
      Description copied from interface: ICitizenDataView
      DEPRECATED
      Specified by:
      setWorkBuilding in interface ICitizenDataView
      Parameters:
      bp - the position.
    • getColonyId

      public int getColonyId()
      Description copied from interface: ICitizenDataView
      Get the colony id of the citizen.
      Specified by:
      getColonyId in interface ICitizenDataView
      Returns:
      unique id of the colony.
    • getHappiness

      public double getHappiness()
      Description copied from interface: ICitizenDataView
      Gets the current Happiness value for the citizen
      Specified by:
      getHappiness in interface ICitizenDataView
      Returns:
      citizens current Happiness value
    • getSaturation

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

      public double getHealth()
      Specified by:
      getHealth in interface ICitizenDataView
      Returns:
      current health.
    • getMaxHealth

      public double getMaxHealth()
      Specified by:
      getMaxHealth in interface ICitizenDataView
      Returns:
      max health.
    • getPosition

      public net.minecraft.core.BlockPos getPosition()
      Description copied from interface: ICitizenDataView
      Get the last registered position of the citizen.
      Specified by:
      getPosition in interface ICitizenDataView
      Returns:
      the BlockPos.
    • deserialize

      public void deserialize(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf)
      Description copied from interface: ICitizenDataView
      Deserialize the attributes and variables from transition.
      Specified by:
      deserialize in interface ICitizenDataView
      Parameters:
      buf - Byte buffer to deserialize.
    • getJobView

      public IJobView getJobView()
      Description copied from interface: ICitizenDataView
      Get the job view that belongs to this citizen (or null).
      Specified by:
      getJobView in interface ICitizenDataView
      Returns:
      the job.
    • 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.
    • getOrderedInteractions

      public List<IInteractionResponseHandler> getOrderedInteractions()
      Description copied from interface: ICitizenDataView
      Get the list of ordered interactions.
      Specified by:
      getOrderedInteractions in interface ICitizenDataView
      Returns:
      the list.
    • getSpecificInteraction

      @Nullable public @Nullable IInteractionResponseHandler getSpecificInteraction(@NotNull @NotNull net.minecraft.network.chat.Component component)
      Description copied from interface: ICitizenDataView
      Get a specific interaction by key.
      Specified by:
      getSpecificInteraction in interface ICitizenDataView
      Parameters:
      component - the key.
      Returns:
      the interaction or null.
    • hasBlockingInteractions

      public boolean hasBlockingInteractions()
      Description copied from interface: ICitizenDataView
      Check if the citizen has important interactions.
      Specified by:
      hasBlockingInteractions in interface ICitizenDataView
      Returns:
      true if so.
    • hasVisibleStatus

      public boolean hasVisibleStatus()
      Description copied from interface: ICitizenDataView
      Check if the citizen has any visible interactions.
      Specified by:
      hasVisibleStatus in interface ICitizenDataView
      Returns:
      true if so.
    • hasPendingInteractions

      public boolean hasPendingInteractions()
      Description copied from interface: ICitizenDataView
      Check if the citizen has any interactions.
      Specified by:
      hasPendingInteractions in interface ICitizenDataView
      Returns:
      true if so.
    • getCitizenSkillHandler

      public ICitizenSkillHandler getCitizenSkillHandler()
      Description copied from interface: ICitizenDataView
      Get an instance of the skill handler.
      Specified by:
      getCitizenSkillHandler in interface ICitizenDataView
      Returns:
      the instance.
    • getHappinessHandler

      public ICitizenHappinessHandler getHappinessHandler()
      Description copied from interface: ICitizenDataView
      The citizen happiness handler.
      Specified by:
      getHappinessHandler in interface ICitizenDataView
      Returns:
      the handler.
    • getStatusIcon

      public net.minecraft.resources.ResourceLocation getStatusIcon()
      Description copied from interface: ICitizenDataView
      The texture to render for interactions
      Specified by:
      getStatusIcon in interface ICitizenDataView
      Returns:
      resourcelocation
    • getVisibleStatus

      public VisibleCitizenStatus getVisibleStatus()
      Description copied from interface: ICitizenDataView
      Get the visible citizen status
      Specified by:
      getVisibleStatus in interface ICitizenDataView
      Returns:
      status
    • getStatusPosition

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

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

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

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

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

      public net.minecraft.resources.ResourceLocation getCustomTexture()
      Description copied from interface: ICitizenDataView
      Get the custom texture of the citizen.
      Specified by:
      getCustomTexture in interface ICitizenDataView
      Returns:
      the res location.
    • getCustomTextureUUID

      public UUID getCustomTextureUUID()
      Description copied from interface: ICitizenDataView
      Get UUID of the custom texture.
      Specified by:
      getCustomTextureUUID in interface ICitizenDataView
      Returns:
      the uuid.
    • setJobView

      public void setJobView(IJobView jobView)
      Description copied from interface: ICitizenDataView
      Force set the job view.
      Specified by:
      setJobView in interface ICitizenDataView
      Parameters:
      jobView - the job view to set.
    • hashCode

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

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

      public net.minecraft.world.item.ItemStack getDisplayArmor(net.minecraft.world.entity.EquipmentSlot equipmentSlot)
      Description copied from interface: ICitizenDataView
      Get Armor in slot of citizen data view.
      Specified by:
      getDisplayArmor in interface ICitizenDataView
      Parameters:
      equipmentSlot - the equipment slot to get it from.
      Returns:
      the armor in the slot.
    • isSick

      public boolean isSick()
      Description copied from interface: ICitizenDataView
      Check if sick.
      Specified by:
      isSick in interface ICitizenDataView
      Returns:
      true if so.