Package com.minecolonies.api.colony
Interface ICitizenData
- All Superinterfaces:
ICitizen,ICivilianData,net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>,IQuestGiver,IQuestParticipant
- All Known Subinterfaces:
IVisitorData
- All Known Implementing Classes:
CitizenData,VisitorData
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMaximum saturation of a citizen. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChildren(Integer... children) Add one or more children to a citizen.voidaddSiblings(Integer... siblings) Add one or more siblings to a citizen.voidApplies the effects of research to the data's entitybooleandoesLiveWith(ICitizenData data) Check if the two citizens live together.voidgenerateName(@NotNull Random rand, String firstParentName, String secondParentName, CitizenNameFile nameFile) Generate the name of the citizen.net.minecraft.core.BlockPosGetter for the bedPos.Get the list of children of a citizen.The Handler for the citizens food.The Handler for the citizens happiness.The Handler for the citizens mourning.Get the citizen skill handler.Get custom texture uuid.doublePersonal citizen disease modifier.Gets the entity@Nullable IBuildingReturns the home building of the citizen.@Nullable net.minecraft.core.BlockPosGet the home position of the citizen.IJob<?>getJob()Returns the job of the citizen.<J extends IJob<?>>
JReturns the job subclass needed.Queries the citizen's job status.net.minecraft.core.BlockPosGet the last position of the citizen.intGet leisure time.Get the names of the parents.@Nullable ICitizenDataGet the partner of the citizen.Get the random var of the citizen.Get the list of children of a citizen.Gets the citizen's status@Nullable net.minecraft.core.BlockPosGets a location of interest of this citizen's job.@Nullable IBuildingReturns the work building of a citizen.default booleanCheck if the citizen has some kind of custom texture.booleanIf any quest is assigned to the citizen.booleanisAsleep()Check if citizen is asleep.booleanIf is idle at job.booleanisRelatedTo(ICitizenData data) Check if the two citizens are related.default booleanCheck if the worker is currently actively working.booleanjustAte()Check if the citizen just ate.booleanReturns whether the citizen has food in their inventory that's not good enough (but no good food)voidCalled after buildings loadedvoidOn death of a citizen this is invoked on the related citizens.voidTriggered when the citizen is going to sleepvoidonInteractionClosed(net.minecraft.network.chat.Component key, net.minecraft.server.level.ServerPlayer sender) Trigger for server side interaction closing.voidonQuestCompletion(net.minecraft.resources.ResourceLocation questId) On completing a quest.voidonRemoveBuilding(IBuilding building) When a building is destroyed, inform the citizen so it can do any cleanup of associations that the building's.voidonRequestCompleted(IToken<?> token) Request completed hook into citizen data.voidOn citizen being resurrected.voidRestart done successfullyvoidscheduleRestart(net.minecraft.server.level.ServerPlayer player) Schedule restart and cleanup.voidsetAsleep(boolean asleep) Set asleep.voidsetBedPos(net.minecraft.core.BlockPos bedPos) Set the bed pos.voidsetCustomTexture(UUID texture) Setter of the custom texture.voidsetHomeBuilding(@Nullable IBuilding building) Sets the home of the citizen.voidsetIdleDays(int days) Sets the citizen idle for a certain amount of daysvoidsetInteractedRecently(UUID player) Called when a player interacts with a citizenvoidsetIsChild(boolean isChild) Set the child flag.voidSets the job of this citizen.voidsetJobStatus(JobStatus status) Set the working status of the citizen.voidsetJustAte(boolean justAte) Set or reset if the citizen just ate.voidsetLastPosition(net.minecraft.core.BlockPos lastPosition) Set the last position of the citizen.voidsetNextRespawnPosition(net.minecraft.core.BlockPos pos) Sets the next position to respawn atvoidsetParents(String firstParent, String secondParent) Set the parents of the citizen.voidsetPartner(int id) Set a new partner to the citizen.voidsetSaturation(double saturation) Sets the citizens current saturation.voidsetStatusPosition(@Nullable net.minecraft.core.BlockPos pos) Sets the location of interest of this citizen.voidsetVisibleStatus(VisibleCitizenStatus status) Sets the citizens statusdefault voidsetWorking(boolean b) Set if the worker is currently working actively.booleanAI will be restarted, also restart building etcMethods inherited from interface com.minecolonies.api.colony.ICitizen
getColony, getId, getInventory, getName, getSaturation, isChild, isFemale, isPaused, setPausedMethods inherited from interface com.minecolonies.api.colony.ICivilianData
clearDirty, createRequest, createRequestAsync, decreaseSaturation, getTextureId, getTextureSuffix, getUUID, getVoiceProfile, increaseSaturation, initEntityValues, initForNewCivilian, isDirty, isRequestAsync, markDirty, onRequestCancelled, onResponseTriggered, serializeViewNetworkData, setEntity, setGender, setGenderAndGenerateName, setName, setSuffix, setVoiceProfile, triggerInteraction, update, updateEntityIfNecessaryMethods inherited from interface net.minecraftforge.common.util.INBTSerializable
deserializeNBT, serializeNBTMethods inherited from interface com.minecolonies.api.quests.IQuestGiver
assignQuestMethods inherited from interface com.minecolonies.api.quests.IQuestParticipant
addQuestParticipation, getName, isParticipantOfQuest, onQuestDeletion, openDialogue
-
Field Details
-
MAX_SATURATION
static final int MAX_SATURATIONMaximum saturation of a citizen.- See Also:
-
-
Method Details
-
onRemoveBuilding
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
Returns the home building of the citizen.- Returns:
- home building.
-
setHomeBuilding
Sets the home of the citizen.- Parameters:
building- home building.
-
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
Sets the job of this citizen.- Parameters:
job- Job of the citizen.
-
getJob
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
Set the working status of the citizen.- Parameters:
status- the job status
-
getEntity
Optional<AbstractEntityCitizen> getEntity()Gets the entity- Specified by:
getEntityin interfaceICivilianData- Returns:
-
getStatus
VisibleCitizenStatus getStatus()Gets the citizen's status- Returns:
- status
-
setVisibleStatus
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
Get the partner of the citizen.- Returns:
- the partner or null if non existent.
-
getChildren
Get the list of children of a citizen.- Returns:
- the citizen ids.
-
getSiblings
Get the list of children of a citizen.- Returns:
- the citizen ids.
-
getParents
Get the names of the parents.- Returns:
- the name.
-
addSiblings
Add one or more siblings to a citizen.- Parameters:
siblings- the ids of the siblings.
-
addChildren
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
On death of a citizen this is invoked on the related citizens.- Parameters:
id- the id of the citizen.
-
setParents
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
Check if the two citizens are related.- Parameters:
data- the data of the citizen.- Returns:
- true if so.
-
doesLiveWith
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
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
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
Request completed hook into citizen data.- Parameters:
token- the id.
-