Package com.minecolonies.core.colony
Class CitizenDataView
java.lang.Object
com.minecolonies.core.colony.CitizenDataView
- All Implemented Interfaces:
ICitizen,ICitizenDataView
- Direct Known Subclasses:
VisitorDataView
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 Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCitizenDataView(int id, IColonyView colonyView) Set View id. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserialize(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Deserialize the attributes and variables from transition.booleanGet the list of children of a citizen.Get an instance of the skill handler.Returns the visitor's colonyintGet the colony id of the citizen.net.minecraft.resources.ResourceLocationGet the custom texture of the citizen.Get UUID of the custom texture.net.minecraft.world.item.ItemStackgetDisplayArmor(net.minecraft.world.entity.EquipmentSlot equipmentSlot) Get Armor in slot of citizen data view.intEntity Id getter.doubleGets the current Happiness value for the citizenThe citizen happiness handler.double@Nullable net.minecraft.core.BlockPosGet the entities home building.intgetId()Returns the id of the citizen.Get the inventory of the citizen.getJob()Entity job getter.net.minecraft.network.chat.MutableComponentGet the job as mutable component.Get the job view that belongs to this citizen (or null).doublegetName()Returns the name of the citizen.Get the list of ordered interactions.Get the names of the parents.@Nullable IntegerGet the partner of the citizen.net.minecraft.core.BlockPosGet the last registered position of the citizen.doubleGetter for the saturation.Get the list of children of a citizen.@Nullable IInteractionResponseHandlergetSpecificInteraction(@NotNull net.minecraft.network.chat.Component component) Get a specific interaction by key.net.minecraft.resources.ResourceLocationThe texture to render for interactions@Nullable net.minecraft.core.BlockPosGets a location of interest of this citizen's job.Get the visible citizen status@Nullable net.minecraft.core.BlockPosGet the entities work building.booleanCheck if the citizen has important interactions.inthashCode()booleanCheck if the citizen has any interactions.booleanCheck if the citizen has any visible interactions.booleanisChild()Check if the entity is a childbooleanisFemale()Returns true if citizen is female, false for male.booleanisPaused()Check if the citizen is paused.booleanisSick()Check if sick.voidsetHomeBuilding(net.minecraft.core.BlockPos homeBuilding) Set the home building on the client side.voidsetJobView(IJobView jobView) Force set the job view.voidsetPaused(boolean p) DEPRECATEDvoidsetWorkBuilding(@Nullable net.minecraft.core.BlockPos bp) DEPRECATED
-
Field Details
-
entityId
protected int entityId -
name
-
female
protected boolean female -
paused
protected boolean paused -
isChild
protected boolean isChild -
colonyId
protected int colonyIdcolony id of the citizen. -
textureUUID
Texture UUID.
-
-
Constructor Details
-
CitizenDataView
Set View id.- Parameters:
id- the id to set.
-
-
Method Details
-
getId
public int getId()Description copied from interface:ICitizenReturns the id of the citizen. -
getEntityId
public int getEntityId()Description copied from interface:ICitizenDataViewEntity Id getter.- Specified by:
getEntityIdin interfaceICitizenDataView- Returns:
- entity id.
-
getName
Description copied from interface:ICitizenReturns the name of the citizen. -
isFemale
public boolean isFemale()Description copied from interface:ICitizenReturns true if citizen is female, false for male. -
isPaused
public boolean isPaused()Description copied from interface:ICitizenCheck if the citizen is paused. -
getColony
Description copied from interface:ICitizenReturns the visitor's colony- Specified by:
getColonyin interfaceICitizen- Specified by:
getColonyin interfaceICitizenDataView- Returns:
- colony
-
isChild
public boolean isChild()Description copied from interface:ICitizenCheck if the entity is a child -
setPaused
public void setPaused(boolean p) DEPRECATED -
getJob
Description copied from interface:ICitizenDataViewEntity job getter.- Specified by:
getJobin interfaceICitizenDataView- Returns:
- the job as a string.
-
getJobComponent
public net.minecraft.network.chat.MutableComponent getJobComponent()Description copied from interface:ICitizenDataViewGet the job as mutable component.- Specified by:
getJobComponentin interfaceICitizenDataView- Returns:
- the job desc.
-
getHomeBuilding
@Nullable public @Nullable net.minecraft.core.BlockPos getHomeBuilding()Description copied from interface:ICitizenDataViewGet the entities home building.- Specified by:
getHomeBuildingin interfaceICitizenDataView- Returns:
- the home coordinates.
-
getWorkBuilding
@Nullable public @Nullable net.minecraft.core.BlockPos getWorkBuilding()Description copied from interface:ICitizenDataViewGet the entities work building.- Specified by:
getWorkBuildingin interfaceICitizenDataView- Returns:
- the work coordinates.
-
setHomeBuilding
public void setHomeBuilding(net.minecraft.core.BlockPos homeBuilding) Description copied from interface:ICitizenDataViewSet the home building on the client side.- Specified by:
setHomeBuildingin interfaceICitizenDataView- Parameters:
homeBuilding- the pos of the home building.
-
setWorkBuilding
public void setWorkBuilding(@Nullable @Nullable net.minecraft.core.BlockPos bp) Description copied from interface:ICitizenDataViewDEPRECATED- Specified by:
setWorkBuildingin interfaceICitizenDataView- Parameters:
bp- the position.
-
getColonyId
public int getColonyId()Description copied from interface:ICitizenDataViewGet the colony id of the citizen.- Specified by:
getColonyIdin interfaceICitizenDataView- Returns:
- unique id of the colony.
-
getHappiness
public double getHappiness()Description copied from interface:ICitizenDataViewGets the current Happiness value for the citizen- Specified by:
getHappinessin interfaceICitizenDataView- Returns:
- citizens current Happiness value
-
getSaturation
public double getSaturation()Description copied from interface:ICitizenGetter for the saturation.- Specified by:
getSaturationin interfaceICitizen- Returns:
- the saturation.
-
getHealth
public double getHealth()- Specified by:
getHealthin interfaceICitizenDataView- Returns:
- current health.
-
getMaxHealth
public double getMaxHealth()- Specified by:
getMaxHealthin interfaceICitizenDataView- Returns:
- max health.
-
getPosition
public net.minecraft.core.BlockPos getPosition()Description copied from interface:ICitizenDataViewGet the last registered position of the citizen.- Specified by:
getPositionin interfaceICitizenDataView- Returns:
- the BlockPos.
-
deserialize
public void deserialize(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Description copied from interface:ICitizenDataViewDeserialize the attributes and variables from transition.- Specified by:
deserializein interfaceICitizenDataView- Parameters:
buf- Byte buffer to deserialize.
-
getJobView
Description copied from interface:ICitizenDataViewGet the job view that belongs to this citizen (or null).- Specified by:
getJobViewin interfaceICitizenDataView- Returns:
- the job.
-
getInventory
Description copied from interface:ICitizenGet the inventory of the citizen.- Specified by:
getInventoryin interfaceICitizen- Returns:
- the inventory of the citizen.
-
getOrderedInteractions
Description copied from interface:ICitizenDataViewGet the list of ordered interactions.- Specified by:
getOrderedInteractionsin interfaceICitizenDataView- Returns:
- the list.
-
getSpecificInteraction
@Nullable public @Nullable IInteractionResponseHandler getSpecificInteraction(@NotNull @NotNull net.minecraft.network.chat.Component component) Description copied from interface:ICitizenDataViewGet a specific interaction by key.- Specified by:
getSpecificInteractionin interfaceICitizenDataView- Parameters:
component- the key.- Returns:
- the interaction or null.
-
hasBlockingInteractions
public boolean hasBlockingInteractions()Description copied from interface:ICitizenDataViewCheck if the citizen has important interactions.- Specified by:
hasBlockingInteractionsin interfaceICitizenDataView- Returns:
- true if so.
-
hasVisibleStatus
public boolean hasVisibleStatus()Description copied from interface:ICitizenDataViewCheck if the citizen has any visible interactions.- Specified by:
hasVisibleStatusin interfaceICitizenDataView- Returns:
- true if so.
-
hasPendingInteractions
public boolean hasPendingInteractions()Description copied from interface:ICitizenDataViewCheck if the citizen has any interactions.- Specified by:
hasPendingInteractionsin interfaceICitizenDataView- Returns:
- true if so.
-
getCitizenSkillHandler
Description copied from interface:ICitizenDataViewGet an instance of the skill handler.- Specified by:
getCitizenSkillHandlerin interfaceICitizenDataView- Returns:
- the instance.
-
getHappinessHandler
Description copied from interface:ICitizenDataViewThe citizen happiness handler.- Specified by:
getHappinessHandlerin interfaceICitizenDataView- Returns:
- the handler.
-
getStatusIcon
public net.minecraft.resources.ResourceLocation getStatusIcon()Description copied from interface:ICitizenDataViewThe texture to render for interactions- Specified by:
getStatusIconin interfaceICitizenDataView- Returns:
- resourcelocation
-
getVisibleStatus
Description copied from interface:ICitizenDataViewGet the visible citizen status- Specified by:
getVisibleStatusin interfaceICitizenDataView- Returns:
- status
-
getStatusPosition
@Nullable public @Nullable net.minecraft.core.BlockPos getStatusPosition()Description copied from interface:ICitizenDataViewGets a location of interest of this citizen's job.- Specified by:
getStatusPositionin interfaceICitizenDataView- Returns:
- the location, or null if nowhere is particularly interesting right now.
-
getPartner
Description copied from interface:ICitizenDataViewGet the partner of the citizen.- Specified by:
getPartnerin interfaceICitizenDataView- Returns:
- the partner or null if non existent.
-
getChildren
Description copied from interface:ICitizenDataViewGet the list of children of a citizen.- Specified by:
getChildrenin interfaceICitizenDataView- Returns:
- the citizen ids.
-
getSiblings
Description copied from interface:ICitizenDataViewGet the list of children of a citizen.- Specified by:
getSiblingsin interfaceICitizenDataView- Returns:
- the citizen ids.
-
getParents
Description copied from interface:ICitizenDataViewGet the names of the parents.- Specified by:
getParentsin interfaceICitizenDataView- Returns:
- the name.
-
getCustomTexture
public net.minecraft.resources.ResourceLocation getCustomTexture()Description copied from interface:ICitizenDataViewGet the custom texture of the citizen.- Specified by:
getCustomTexturein interfaceICitizenDataView- Returns:
- the res location.
-
getCustomTextureUUID
Description copied from interface:ICitizenDataViewGet UUID of the custom texture.- Specified by:
getCustomTextureUUIDin interfaceICitizenDataView- Returns:
- the uuid.
-
setJobView
Description copied from interface:ICitizenDataViewForce set the job view.- Specified by:
setJobViewin interfaceICitizenDataView- Parameters:
jobView- the job view to set.
-
hashCode
public int hashCode() -
equals
-
getDisplayArmor
public net.minecraft.world.item.ItemStack getDisplayArmor(net.minecraft.world.entity.EquipmentSlot equipmentSlot) Description copied from interface:ICitizenDataViewGet Armor in slot of citizen data view.- Specified by:
getDisplayArmorin interfaceICitizenDataView- Parameters:
equipmentSlot- the equipment slot to get it from.- Returns:
- the armor in the slot.
-
isSick
public boolean isSick()Description copied from interface:ICitizenDataViewCheck if sick.- Specified by:
isSickin interfaceICitizenDataView- Returns:
- true if so.
-