Package com.minecolonies.api.colony
Interface ICivilianData
- All Superinterfaces:
ICitizen,net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
- All Known Subinterfaces:
ICitizenData,IVisitorData
- All Known Implementing Classes:
CitizenData,VisitorData
public interface ICivilianData
extends ICitizen, net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
Data for all civilians of a colony, can be citizen/trader/visitor etc
-
Method Summary
Modifier and TypeMethodDescriptionvoidMarkt 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.Optional<? extends AbstractCivilianEntity> Gets the entityintReturns the texture id for the civilian.Get the texture suffix.getUUID()Get the uuid for the citizenintGet the voice profile of the citizen.voidincreaseSaturation(double extraSaturation) Getter for the saturation.voidInitializes the entities values from citizen data.voidInitializes a new citizen, when not read from nbtbooleanisDirty()Returns whether or not the instance is dirty.booleanisRequestAsync(@NotNull IToken<?> token) Check if a request is async.voidmarkDirty(int time) Marks the instance dirty.voidonRequestCancelled(@NotNull IToken<?> token) Called on request canceled.voidonResponseTriggered(@NotNull net.minecraft.network.chat.Component key, int responseId, net.minecraft.world.entity.player.Player player) Trigger the response on the server side.voidserializeViewNetworkData(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Writes the citizen data to a byte buf for transition.voidsetEntity(@Nullable AbstractCivilianEntity civilian) Sets the entity of the civilian data.voidsetGender(boolean isFemale) Sets the gendervoidsetGenderAndGenerateName(boolean isFemale) Sets a gender and generates a new namevoidSet the citizen name.voidSet the texture suffix.voidsetVoiceProfile(int profile) Set the voice profile of the citizen.voidtriggerInteraction(@NotNull IInteractionResponseHandler handler) Trigger a possible interaction.voidupdate(int tickRate) Tick the data to update values.voidUpdatesAbstractCivilianEntityfor the instance.Methods inherited from interface com.minecolonies.api.colony.ICitizen
getColony, getId, getInventory, getName, getSaturation, isChild, isFemale, isPaused, setPausedMethods inherited from interface net.neoforged.neoforge.common.util.INBTSerializable
deserializeNBT, serializeNBT
-
Method Details
-
setEntity
Sets the entity of the civilian data.- Parameters:
civilian-AbstractCivilianEntityinstance of the civilian data.
-
markDirty
void markDirty(int time) Marks the instance dirty. -
initForNewCivilian
void initForNewCivilian()Initializes a new citizen, when not read from nbt -
initEntityValues
void initEntityValues()Initializes the entities values from citizen data. -
setGenderAndGenerateName
void setGenderAndGenerateName(boolean isFemale) Sets a gender and generates a new name- Parameters:
isFemale-
-
setGender
void setGender(boolean isFemale) Sets the gender- Parameters:
isFemale-
-
getTextureId
int getTextureId()Returns the texture id for the civilian.- Returns:
- texture ID.
-
isDirty
boolean isDirty()Returns whether or not the instance is dirty.- Returns:
- true when dirty, otherwise false.
-
clearDirty
void clearDirty()Markt the instance not dirty. -
updateEntityIfNecessary
void updateEntityIfNecessary()UpdatesAbstractCivilianEntityfor the instance. -
serializeViewNetworkData
void serializeViewNetworkData(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Writes the citizen data to a byte buf for transition.- Parameters:
buf- Buffer to write to.
-
increaseSaturation
void increaseSaturation(double extraSaturation) Getter for the saturation.- Parameters:
extraSaturation- the extra saturation
-
decreaseSaturation
void decreaseSaturation(double extraSaturation) Getter for the saturation.- Parameters:
extraSaturation- the saturation to remove.
-
setName
Set the citizen name.- Parameters:
name- the name to set.
-
createRequest
Create a blocking request.- Type Parameters:
R- the Type- Parameters:
requested- the request to create.- Returns:
- the token of the request.
-
createRequestAsync
Create an async request.- Type Parameters:
R- the Type- Parameters:
requested- the request to create.- Returns:
- the token of the request.
-
onRequestCancelled
Called on request canceled.- Parameters:
token- the token to be canceled.
-
isRequestAsync
Check if a request is async.- Parameters:
token- the token to check.- Returns:
- true if it is.
-
onResponseTriggered
void onResponseTriggered(@NotNull @NotNull net.minecraft.network.chat.Component key, int responseId, net.minecraft.world.entity.player.Player player) Trigger the response on the server side.- Parameters:
key- the key of the component.responseId- the triggered response.player- the world it was triggered in.
-
update
void update(int tickRate) Tick the data to update values. -
triggerInteraction
Trigger a possible interaction.- Parameters:
handler- the new handler.
-
getTextureSuffix
String getTextureSuffix()Get the texture suffix.- Returns:
- the suffix.
-
setSuffix
Set the texture suffix.- Parameters:
suffix- the suffix to set.
-
getEntity
Optional<? extends AbstractCivilianEntity> getEntity()Gets the entity- Returns:
-
getVoiceProfile
int getVoiceProfile()Get the voice profile of the citizen.- Returns:
- the profile id.
-
setVoiceProfile
void setVoiceProfile(int profile) Set the voice profile of the citizen.- Parameters:
profile- the profile to set.
-
getUUID
UUID getUUID()Get the uuid for the citizen- Returns:
- uuid
-