Package com.minecolonies.core.colony
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
Extra data for Citizens.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<net.minecraft.network.chat.Component, IInteractionResponseHandler> The citizen chat options on the server side.protected InventoryCitizenInventory of the citizen.static final floatThe max health.Possible texture suffixes.Fields inherited from interface com.minecolonies.api.colony.ICitizenData
MAX_SATURATION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChildren(Integer... children) Add one or more children to a citizen.voidNotify quest participant about their participation.voidaddSiblings(Integer... siblings) Add one or more siblings to a citizen.voidApplies the effects of research to the data's entityvoidassignQuest(IQuestInstance quest) Assign quest authority to quest giver.voidMarkt the instance not dirty.<R extends IRequestable>
IToken<?> createRequest(R requested) Create a blocking request.<R extends IRequestable>
IToken<?> createRequestAsync(R requested) Create an async request.voiddecreaseSaturation(double extraSaturation) Getter for the saturation.voiddeserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag nbtTagCompound) booleandoesLiveWith(ICitizenData data) Check if the two citizens live together.booleanstatic StringgenerateName(@NotNull Random rand, boolean female, IColony colony, CitizenNameFile nameFile) Generates a random name from a set of names.voidgenerateName(@NotNull Random rand, String firstParentName, String secondParentName, CitizenNameFile nameFile) Generates a random name considering both parent names.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.Returns the visitor's colonyGet custom texture uuid.doublePersonal citizen disease modifier.@NotNull Optional<AbstractEntityCitizen> Return the entity instance of the citizen data.@Nullable IBuildingReturns the home building of the citizen.@Nullable net.minecraft.core.BlockPosGet the home position of the citizen.intgetId()Returns the id of the citizen.Get the inventory of the citizen.@Nullable 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.getName()Returns the name of the citizen.Get the names of the parents.@Nullable ICitizenDataGet the partner of the citizen.Get the random var of the citizen.doubleGetter for the saturation.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.intReturns the texture id for the civilian.Get the texture suffix.getUUID()Get the uuid for the citizenintGet the voice profile of the citizen.@Nullable IBuildingReturns the work building of a citizen.booleanCheck if the citizen has some kind of custom texture.inthashCode()booleanIf any quest is assigned to the citizen.voidincreaseSaturation(double extraSaturation) Getter for the saturation.voidInitializes the entities values from citizen data.voidInitializes a new citizen, when not read from nbtbooleanisAsleep()Check if citizen is asleep.booleanisChild()Check if the entity is a childbooleanisDirty()Returns whether or not the instance is dirty.booleanisFemale()Returns true if citizen is female, false for male.booleanIf is idle at job.booleanisParticipantOfQuest(net.minecraft.resources.ResourceLocation questId) Check if the citizen has a quest open.booleanisPaused()Check if the citizen is paused.booleanisRelatedTo(ICitizenData data) Check if the two citizens are related.booleanisRequestAsync(@NotNull IToken<?> token) Check if a request is async.booleanCheck if the worker is currently actively working.booleanjustAte()Check if the citizen just ate.static CitizenDataloadFromNBT(IColony colony, net.minecraft.nbt.CompoundTag nbt, net.minecraft.core.HolderLookup.Provider provider) Loads this citizen data from nbtvoidmarkDirty(int time) Marks the instance dirty.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.voidonQuestDeletion(net.minecraft.resources.ResourceLocation questId) Method for cleanup purposes on quest deletion.voidonRemoveBuilding(IBuilding building) When a building is destroyed, inform the citizen so it can do any cleanup of associations that the building's.voidonRequestCancelled(@NotNull IToken<?> token) Called on request canceled.voidonRequestCompleted(IToken<?> token) Request completed hook into citizen data.voidonResponseTriggered(@NotNull net.minecraft.network.chat.Component key, int responseId, net.minecraft.world.entity.player.Player player) Trigger the response on the server side.voidOn citizen being resurrected.voidopenDialogue(IQuestInstance quest, int index) Initiates a dialogue at the citizen.voidRestart done successfullyvoidscheduleRestart(net.minecraft.server.level.ServerPlayer player) Schedule restart and cleanup.net.minecraft.nbt.CompoundTagserializeNBT(net.minecraft.core.HolderLookup.Provider provider) voidserializeViewNetworkData(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Writes the citizen data to a byte buf for transition.voidsetAsleep(boolean asleep) Set asleep.voidsetBedPos(net.minecraft.core.BlockPos bedPos) Set the bed pos.voidsetCustomTexture(UUID texture) Setter of the custom texture.voidsetEntity(@Nullable AbstractCivilianEntity citizen) Sets the entity of the civilian data.voidsetGender(boolean isFemale) Sets the gendervoidsetGenderAndGenerateName(boolean isFemale) Sets a gender and generates a new namevoidsetHomeBuilding(@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.voidSet the citizen name.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.voidsetPaused(boolean p) Check if the citizen is paused.voidsetSaturation(double saturation) Sets the citizens current saturation.voidsetStatusPosition(@Nullable net.minecraft.core.BlockPos pos) Sets the location of interest of this citizen.voidSet the texture suffix.voidsetVisibleStatus(VisibleCitizenStatus status) Sets the citizens statusvoidsetVoiceProfile(int profile) Set the voice profile of the citizen.voidsetWorking(boolean isWorking) Set if the worker is currently working actively.booleanAI will be restarted, also restart building etcvoidtriggerInteraction(@NotNull IInteractionResponseHandler handler) Trigger a possible interaction.voidupdate(int tickRate) Tick the data to update values.voidUpdatesAbstractCivilianEntityfor the instance.
-
Field Details
-
MAX_HEALTH
public static final float MAX_HEALTHThe max health.- See Also:
-
SUFFIXES
Possible texture suffixes. -
inventory
Inventory of the citizen. -
citizenChatOptions
protected final Map<net.minecraft.network.chat.Component,IInteractionResponseHandler> citizenChatOptionsThe citizen chat options on the server side.
-
-
Constructor Details
-
CitizenData
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:ICivilianDataTrigger the response on the server side.- Specified by:
onResponseTriggeredin interfaceICivilianData- Parameters:
key- the key of the component.responseId- the triggered response.player- the world it was triggered in.
-
getEntity
Return the entity instance of the citizen data. Respawn the citizen if needed.- Specified by:
getEntityin interfaceICitizenData- Specified by:
getEntityin interfaceICivilianData- Returns:
AbstractEntityCitizenof the citizen data.
-
getVoiceProfile
public int getVoiceProfile()Description copied from interface:ICivilianDataGet the voice profile of the citizen.- Specified by:
getVoiceProfilein interfaceICivilianData- Returns:
- the profile id.
-
setVoiceProfile
public void setVoiceProfile(int profile) Description copied from interface:ICivilianDataSet the voice profile of the citizen.- Specified by:
setVoiceProfilein interfaceICivilianData- Parameters:
profile- the profile to set.
-
setEntity
Description copied from interface:ICivilianDataSets the entity of the civilian data.- Specified by:
setEntityin interfaceICivilianData- Parameters:
citizen-AbstractCivilianEntityinstance of the civilian data.
-
markDirty
public void markDirty(int time) Description copied from interface:ICivilianDataMarks the instance dirty.- Specified by:
markDirtyin interfaceICivilianData
-
hashCode
public int hashCode() -
equals
-
getColony
Description copied from interface:ICitizenReturns the visitor's colony -
getId
public int getId()Description copied from interface:ICitizenReturns the id of the citizen. -
initForNewCivilian
public void initForNewCivilian()Description copied from interface:ICivilianDataInitializes a new citizen, when not read from nbt- Specified by:
initForNewCivilianin interfaceICivilianData
-
initEntityValues
public void initEntityValues()Initializes the entities values from citizen data.- Specified by:
initEntityValuesin interfaceICivilianData
-
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 gendercolony- 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:
generateNamein interfaceICitizenData- Parameters:
rand- Random object.firstParentName- name of the first parent.secondParentName- name of the second parent.
-
isRelatedTo
Description copied from interface:ICitizenDataCheck if the two citizens are related.- Specified by:
isRelatedToin interfaceICitizenData- Parameters:
data- the data of the citizen.- Returns:
- true if so.
-
doesLiveWith
Description copied from interface:ICitizenDataCheck if the two citizens live together.- Specified by:
doesLiveWithin interfaceICitizenData- Parameters:
data- the data of the other citizen.- Returns:
- true if so.
-
getName
Description copied from interface:ICitizenReturns the name of the citizen.- Specified by:
getNamein interfaceICitizen- Specified by:
getNamein interfaceIQuestParticipant- Returns:
- name of the citizen.
-
isFemale
public boolean isFemale()Description copied from interface:ICitizenReturns true if citizen is female, false for male. -
setGenderAndGenerateName
public void setGenderAndGenerateName(boolean isFemale) Description copied from interface:ICivilianDataSets a gender and generates a new name- Specified by:
setGenderAndGenerateNamein interfaceICivilianData- Parameters:
isFemale-
-
setGender
public void setGender(boolean isFemale) Description copied from interface:ICivilianDataSets the gender- Specified by:
setGenderin interfaceICivilianData- Parameters:
isFemale-
-
setPaused
public void setPaused(boolean p) Description copied from interface:ICitizenCheck if the citizen is paused. -
isPaused
public boolean isPaused()Description copied from interface:ICitizenCheck if the citizen is paused. -
getTextureId
public int getTextureId()Description copied from interface:ICivilianDataReturns the texture id for the civilian.- Specified by:
getTextureIdin interfaceICivilianData- Returns:
- texture ID.
-
isDirty
public boolean isDirty()Description copied from interface:ICivilianDataReturns whether or not the instance is dirty.- Specified by:
isDirtyin interfaceICivilianData- Returns:
- true when dirty, otherwise false.
-
clearDirty
public void clearDirty()Description copied from interface:ICivilianDataMarkt the instance not dirty.- Specified by:
clearDirtyin interfaceICivilianData
-
onRemoveBuilding
Description copied from interface:ICitizenDataWhen 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:
onRemoveBuildingin interfaceICitizenData- Parameters:
building- building that is destroyed.
-
getHomeBuilding
Description copied from interface:ICitizenDataReturns the home building of the citizen.- Specified by:
getHomeBuildingin interfaceICitizenData- Returns:
- home building.
-
setHomeBuilding
Description copied from interface:ICitizenDataSets the home of the citizen.- Specified by:
setHomeBuildingin interfaceICitizenData- Parameters:
building- home building.
-
getWorkBuilding
Description copied from interface:ICitizenDataReturns the work building of a citizen.- Specified by:
getWorkBuildingin interfaceICitizenData- Returns:
- home building of a citizen.
-
updateEntityIfNecessary
public void updateEntityIfNecessary()Description copied from interface:ICivilianDataUpdatesAbstractCivilianEntityfor the instance.- Specified by:
updateEntityIfNecessaryin interfaceICivilianData
-
getJob
Description copied from interface:ICitizenDataReturns the job of the citizen.- Specified by:
getJobin interfaceICitizenData- Returns:
- Job of the citizen.
-
setJob
Description copied from interface:ICitizenDataSets the job of this citizen.- Specified by:
setJobin interfaceICitizenData- Parameters:
job- Job of the citizen.
-
getJob
Description copied from interface:ICitizenDataReturns the job subclass needed. Returns null on type mismatch.- Specified by:
getJobin interfaceICitizenData- 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:ICivilianDataWrites the citizen data to a byte buf for transition.- Specified by:
serializeViewNetworkDatain interfaceICivilianData- Parameters:
buf- Buffer to write to.
-
increaseSaturation
public void increaseSaturation(double extraSaturation) Description copied from interface:ICivilianDataGetter for the saturation.- Specified by:
increaseSaturationin interfaceICivilianData- Parameters:
extraSaturation- the extra saturation
-
decreaseSaturation
public void decreaseSaturation(double extraSaturation) Description copied from interface:ICivilianDataGetter for the saturation.- Specified by:
decreaseSaturationin interfaceICivilianData- Parameters:
extraSaturation- the saturation to remove.
-
setName
Description copied from interface:ICivilianDataSet the citizen name.- Specified by:
setNamein interfaceICivilianData- Parameters:
name- the name to set.
-
setLastPosition
public void setLastPosition(net.minecraft.core.BlockPos lastPosition) Description copied from interface:ICitizenDataSet the last position of the citizen.- Specified by:
setLastPositionin interfaceICitizenData- Parameters:
lastPosition- the last position.
-
getLastPosition
public net.minecraft.core.BlockPos getLastPosition()Description copied from interface:ICitizenDataGet the last position of the citizen.- Specified by:
getLastPositionin interfaceICitizenData- Returns:
- the last position.
-
getSaturation
public double getSaturation()Description copied from interface:ICitizenGetter for the saturation.- Specified by:
getSaturationin interfaceICitizen- Returns:
- the saturation.
-
setSaturation
public void setSaturation(double saturation) Description copied from interface:ICitizenDataSets the citizens current saturation.- Specified by:
setSaturationin interfaceICitizenData- Parameters:
saturation- to set
-
getInventory
Description copied from interface:ICitizenGet the inventory of the citizen.- Specified by:
getInventoryin interfaceICitizen- Returns:
- the inventory of the citizen.
-
isAsleep
public boolean isAsleep()Description copied from interface:ICitizenDataCheck if citizen is asleep.- Specified by:
isAsleepin interfaceICitizenData- Returns:
- true if so.
-
getBedPos
public net.minecraft.core.BlockPos getBedPos()Description copied from interface:ICitizenDataGetter for the bedPos.- Specified by:
getBedPosin interfaceICitizenData- Returns:
- the bedPos.
-
setAsleep
public void setAsleep(boolean asleep) Description copied from interface:ICitizenDataSet asleep.- Specified by:
setAsleepin interfaceICitizenData- Parameters:
asleep- true if asleep.
-
setBedPos
public void setBedPos(net.minecraft.core.BlockPos bedPos) Description copied from interface:ICitizenDataSet the bed pos.- Specified by:
setBedPosin interfaceICitizenData- Parameters:
bedPos- the pos to set.
-
getCitizenHappinessHandler
Description copied from interface:ICitizenDataThe Handler for the citizens happiness.- Specified by:
getCitizenHappinessHandlerin interfaceICitizenData- Returns:
- the instance of the handler
-
getCitizenMournHandler
Description copied from interface:ICitizenDataThe Handler for the citizens mourning.- Specified by:
getCitizenMournHandlerin interfaceICitizenData- Returns:
- the instance of the handler
-
getCitizenSkillHandler
Description copied from interface:ICitizenDataGet the citizen skill handler.- Specified by:
getCitizenSkillHandlerin interfaceICitizenData- Returns:
- the handler.
-
getCitizenFoodHandler
Description copied from interface:ICitizenDataThe Handler for the citizens food.- Specified by:
getCitizenFoodHandlerin interfaceICitizenData- Returns:
- the instance of the handler
-
getCitizenDiseaseHandler
- Specified by:
getCitizenDiseaseHandlerin interfaceICitizenData
-
scheduleRestart
public void scheduleRestart(net.minecraft.server.level.ServerPlayer player) Description copied from interface:ICitizenDataSchedule restart and cleanup.- Specified by:
scheduleRestartin interfaceICitizenData- Parameters:
player- the player scheduling it.
-
shouldRestart
public boolean shouldRestart()Description copied from interface:ICitizenDataAI will be restarted, also restart building etc- Specified by:
shouldRestartin interfaceICitizenData- Returns:
- true if so.
-
restartDone
public void restartDone()Description copied from interface:ICitizenDataRestart done successfully- Specified by:
restartDonein interfaceICitizenData
-
setIsChild
public void setIsChild(boolean isChild) Description copied from interface:ICitizenDataSet the child flag.- Specified by:
setIsChildin interfaceICitizenData- Parameters:
isChild- boolean
-
isChild
public boolean isChild()Description copied from interface:ICitizenCheck if the entity is a child -
justAte
public boolean justAte()Description copied from interface:ICitizenDataCheck if the citizen just ate.- Specified by:
justAtein interfaceICitizenData- Returns:
- true if so.
-
setJustAte
public void setJustAte(boolean justAte) Description copied from interface:ICitizenDataSet or reset if the citizen just ate.- Specified by:
setJustAtein interfaceICitizenData- Parameters:
justAte- true if justAte, false to reset.
-
serializeNBT
public net.minecraft.nbt.CompoundTag serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider) - Specified by:
serializeNBTin interfacenet.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:
deserializeNBTin interfacenet.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
onBuildingLoad
public void onBuildingLoad()Description copied from interface:ICitizenDataCalled after buildings loaded- Specified by:
onBuildingLoadin interfaceICitizenData
-
setInteractedRecently
Description copied from interface:ICitizenDataCalled when a player interacts with a citizen- Specified by:
setInteractedRecentlyin interfaceICitizenData- Parameters:
player- the player that interacted
-
update
public void update(int tickRate) Description copied from interface:ICivilianDataTick the data to update values.- Specified by:
updatein interfaceICivilianData
-
triggerInteraction
Description copied from interface:ICivilianDataTrigger a possible interaction.- Specified by:
triggerInteractionin interfaceICivilianData- Parameters:
handler- the new handler.
-
isIdleAtJob
public boolean isIdleAtJob()Description copied from interface:ICitizenDataIf is idle at job.- Specified by:
isIdleAtJobin interfaceICitizenData- Returns:
- true if the citizen's job status is
JobStatus.STUCK.
-
getJobStatus
Description copied from interface:ICitizenDataQueries the citizen's job status.- Specified by:
getJobStatusin interfaceICitizenData
-
setJobStatus
Description copied from interface:ICitizenDataSet the working status of the citizen.- Specified by:
setJobStatusin interfaceICitizenData- Parameters:
status- the job status
-
getTextureSuffix
Description copied from interface:ICivilianDataGet the texture suffix.- Specified by:
getTextureSuffixin interfaceICivilianData- Returns:
- the suffix.
-
setSuffix
Description copied from interface:ICivilianDataSet the texture suffix.- Specified by:
setSuffixin interfaceICivilianData- Parameters:
suffix- the suffix to set.
-
createRequest
Description copied from interface:ICivilianDataCreate a blocking request.- Specified by:
createRequestin interfaceICivilianData- Type Parameters:
R- the Type- Parameters:
requested- the request to create.- Returns:
- the token of the request.
-
createRequestAsync
Description copied from interface:ICivilianDataCreate an async request.- Specified by:
createRequestAsyncin interfaceICivilianData- Type Parameters:
R- the Type- Parameters:
requested- the request to create.- Returns:
- the token of the request.
-
onRequestCancelled
Description copied from interface:ICivilianDataCalled on request canceled.- Specified by:
onRequestCancelledin interfaceICivilianData- Parameters:
token- the token to be canceled.
-
onRequestCompleted
Description copied from interface:ICitizenDataRequest completed hook into citizen data.- Specified by:
onRequestCompletedin interfaceICitizenData- Parameters:
token- the id.
-
isRequestAsync
Description copied from interface:ICivilianDataCheck if a request is async.- Specified by:
isRequestAsyncin interfaceICivilianData- Parameters:
token- the token to check.- Returns:
- true if it is.
-
getStatus
Description copied from interface:ICitizenDataGets the citizen's status- Specified by:
getStatusin interfaceICitizenData- Returns:
- status
-
setVisibleStatus
Description copied from interface:ICitizenDataSets the citizens status- Specified by:
setVisibleStatusin interfaceICitizenData- Parameters:
status- status to set
-
getStatusPosition
@Nullable public @Nullable net.minecraft.core.BlockPos getStatusPosition()Description copied from interface:ICitizenDataGets a location of interest of this citizen's job.- Specified by:
getStatusPositionin interfaceICitizenData- 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:ICitizenDataSets the location of interest of this citizen.- Specified by:
setStatusPositionin interfaceICitizenData- 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 fornbt- nbt compound to read from- Returns:
- new CitizenData
-
getRandom
Description copied from interface:ICitizenDataGet the random var of the citizen.- Specified by:
getRandomin interfaceICitizenData- Returns:
- the random.
-
applyResearchEffects
public void applyResearchEffects()Description copied from interface:ICitizenDataApplies the effects of research to the data's entity- Specified by:
applyResearchEffectsin interfaceICitizenData
-
onGoSleep
public void onGoSleep()Description copied from interface:ICitizenDataTriggered when the citizen is going to sleep- Specified by:
onGoSleepin interfaceICitizenData
-
setNextRespawnPosition
public void setNextRespawnPosition(net.minecraft.core.BlockPos pos) Description copied from interface:ICitizenDataSets the next position to respawn at- Specified by:
setNextRespawnPositionin interfaceICitizenData- Parameters:
pos- position to set
-
needsBetterFood
public boolean needsBetterFood()Description copied from interface:ICitizenDataReturns whether the citizen has food in their inventory that's not good enough (but no good food)- Specified by:
needsBetterFoodin interfaceICitizenData- Returns:
- true if so
-
isWorking
public boolean isWorking()Description copied from interface:ICitizenDataCheck if the worker is currently actively working.- Specified by:
isWorkingin interfaceICitizenData- Returns:
- true if so.
-
onResurrect
public void onResurrect()Description copied from interface:ICitizenDataOn citizen being resurrected.- Specified by:
onResurrectin interfaceICitizenData
-
setWorking
public void setWorking(boolean isWorking) Description copied from interface:ICitizenDataSet if the worker is currently working actively.- Specified by:
setWorkingin interfaceICitizenData- Parameters:
isWorking- true if so.
-
getPartner
Description copied from interface:ICitizenDataGet the partner of the citizen.- Specified by:
getPartnerin interfaceICitizenData- Returns:
- the partner or null if non existent.
-
getChildren
Description copied from interface:ICitizenDataGet the list of children of a citizen.- Specified by:
getChildrenin interfaceICitizenData- Returns:
- the citizen ids.
-
getSiblings
Description copied from interface:ICitizenDataGet the list of children of a citizen.- Specified by:
getSiblingsin interfaceICitizenData- Returns:
- the citizen ids.
-
getParents
Description copied from interface:ICitizenDataGet the names of the parents.- Specified by:
getParentsin interfaceICitizenData- Returns:
- the name.
-
addSiblings
Description copied from interface:ICitizenDataAdd one or more siblings to a citizen.- Specified by:
addSiblingsin interfaceICitizenData- Parameters:
siblings- the ids of the siblings.
-
addChildren
Description copied from interface:ICitizenDataAdd one or more children to a citizen.- Specified by:
addChildrenin interfaceICitizenData- Parameters:
children- the ids of the children.
-
setPartner
public void setPartner(int id) Description copied from interface:ICitizenDataSet a new partner to the citizen.- Specified by:
setPartnerin interfaceICitizenData- Parameters:
id- the partner id.
-
onDeath
Description copied from interface:ICitizenDataOn death of a citizen this is invoked on the related citizens.- Specified by:
onDeathin interfaceICitizenData- Parameters:
id- the id of the citizen.
-
setParents
Description copied from interface:ICitizenDataSet the parents of the citizen.- Specified by:
setParentsin interfaceICitizenData- Parameters:
firstParent- the parent name.secondParent- second parent name.
-
setIdleDays
public void setIdleDays(int days) Description copied from interface:ICitizenDataSets the citizen idle for a certain amount of days- Specified by:
setIdleDaysin interfaceICitizenData- Parameters:
days- amount of days
-
assignQuest
Description copied from interface:IQuestGiverAssign quest authority to quest giver.- Specified by:
assignQuestin interfaceIQuestGiver- Parameters:
quest- the quest to assign to the entity.
-
openDialogue
Description copied from interface:IQuestParticipantInitiates a dialogue at the citizen.- Specified by:
openDialoguein interfaceIQuestParticipant- Parameters:
quest- the quest to open it for.index- the current objective index
-
addQuestParticipation
Description copied from interface:IQuestParticipantNotify quest participant about their participation.- Specified by:
addQuestParticipationin interfaceIQuestParticipant- Parameters:
quest- the quest to assign to the entity.
-
onQuestDeletion
public void onQuestDeletion(net.minecraft.resources.ResourceLocation questId) Description copied from interface:IQuestParticipantMethod for cleanup purposes on quest deletion.- Specified by:
onQuestDeletionin interfaceIQuestParticipant- Parameters:
questId- the id of the quest.
-
isParticipantOfQuest
public boolean isParticipantOfQuest(net.minecraft.resources.ResourceLocation questId) Description copied from interface:IQuestParticipantCheck if the citizen has a quest open.- Specified by:
isParticipantOfQuestin interfaceIQuestParticipant- Parameters:
questId- the id of the quest.- Returns:
- true if so.
-
onQuestCompletion
public void onQuestCompletion(net.minecraft.resources.ResourceLocation questId) Description copied from interface:ICitizenDataOn completing a quest.- Specified by:
onQuestCompletionin interfaceICitizenData- Parameters:
questId- the id of the completed quest.
-
hasQuestAssignment
public boolean hasQuestAssignment()Description copied from interface:ICitizenDataIf any quest is assigned to the citizen.- Specified by:
hasQuestAssignmentin interfaceICitizenData- Returns:
- true if so.
-
onInteractionClosed
public void onInteractionClosed(net.minecraft.network.chat.Component key, net.minecraft.server.level.ServerPlayer sender) Description copied from interface:ICitizenDataTrigger for server side interaction closing.- Specified by:
onInteractionClosedin interfaceICitizenData- Parameters:
key- the key of the interaction.sender- the player closing it.
-
getUUID
Description copied from interface:ICivilianDataGet the uuid for the citizen- Specified by:
getUUIDin interfaceICivilianData- Returns:
- uuid
-
setCustomTexture
Description copied from interface:ICitizenDataSetter of the custom texture.- Specified by:
setCustomTexturein interfaceICitizenData- Parameters:
texture- the texture uuid.
-
hasCustomTexture
public boolean hasCustomTexture()Description copied from interface:ICitizenDataCheck if the citizen has some kind of custom texture.- Specified by:
hasCustomTexturein interfaceICitizenData- Returns:
- true if so.
-
getCustomTexture
Description copied from interface:ICitizenDataGet custom texture uuid.- Specified by:
getCustomTexturein interfaceICitizenData- Returns:
- uuid to return.
-
getHomePosition
@Nullable public @Nullable net.minecraft.core.BlockPos getHomePosition()Description copied from interface:ICitizenDataGet the home position of the citizen.- Specified by:
getHomePositionin interfaceICitizenData- Returns:
- the pos to go home to.
-
getDiseaseModifier
public double getDiseaseModifier()Description copied from interface:ICitizenDataPersonal citizen disease modifier.- Specified by:
getDiseaseModifierin interfaceICitizenData- Returns:
- the disease modifier.
-
getLeisureTime
public int getLeisureTime()Description copied from interface:ICitizenDataGet leisure time. Time in ticks citizens might be wanting to do leisure instead of work.- Specified by:
getLeisureTimein interfaceICitizenData- Returns:
- the leftover leisure time.
-