Class CitizenDiedEvent
java.lang.Object
com.minecolonies.core.colony.eventhooks.AbstractEvent
com.minecolonies.core.colony.eventhooks.citizenEvents.AbstractCitizenEvent
com.minecolonies.core.colony.eventhooks.citizenEvents.CitizenDiedEvent
- All Implemented Interfaces:
ICitizenEventDescription,IColonyEventDescription,net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
The event for handling a citizen death.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.resources.ResourceLocationThis events id, registry entries use res locations as ids. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new citizen died event.CitizenDiedEvent(net.minecraft.core.BlockPos eventPos, String citizenName, String deathCause) Creates a new citizen died event. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserialize(net.minecraft.network.FriendlyByteBuf buf) Deserializes this event from the givenFriendlyByteBuf.voiddeserializeNBT(net.minecraft.nbt.CompoundTag compound) Gets the cause of the citizen death.net.minecraft.resources.ResourceLocationGets this event types registry id.getName()Gets the name of this event type.Get the summary translation key.static CitizenDiedEventloadFromFriendlyByteBuf(@NotNull net.minecraft.network.FriendlyByteBuf buf) Loads the citizen died event from the given packet buffer.static CitizenDiedEventloadFromNBT(@NotNull net.minecraft.nbt.CompoundTag compound) Loads the citizen died event from the given nbt.voidserialize(net.minecraft.network.FriendlyByteBuf buf) Serializes this event to the givenFriendlyByteBuf.net.minecraft.nbt.CompoundTagvoidsetDeathCause(String deathCause) Sets the cause of the citizen death.Methods inherited from class com.minecolonies.core.colony.eventhooks.citizenEvents.AbstractCitizenEvent
getCitizenName, getEventPos, setCitizenName, setEventPos, toStringMethods inherited from class com.minecolonies.core.colony.eventhooks.AbstractEvent
getDay, includeInSummary, setDayMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.colonyEvents.descriptions.ICitizenEventDescription
toDisplayStringMethods inherited from interface com.minecolonies.api.colony.colonyEvents.descriptions.IColonyEventDescription
getDay, includeInSummary, setDay
-
Field Details
-
CITIZEN_DIED_EVENT_ID
public static final net.minecraft.resources.ResourceLocation CITIZEN_DIED_EVENT_IDThis events id, registry entries use res locations as ids.
-
-
Constructor Details
-
CitizenDiedEvent
public CitizenDiedEvent()Creates a new citizen died event. -
CitizenDiedEvent
public CitizenDiedEvent(net.minecraft.core.BlockPos eventPos, String citizenName, String deathCause) Creates a new citizen died event.- Parameters:
eventPos- the position of the hut block of the building.citizenName- the name of the building.deathCause- the cause of the citizen death.
-
-
Method Details
-
getEventTypeId
public net.minecraft.resources.ResourceLocation getEventTypeId()Description copied from interface:IColonyEventDescriptionGets this event types registry id.- Returns:
- this event types registry id.
-
getName
Description copied from interface:IColonyEventDescriptionGets the name of this event type.- Returns:
- the name of this event type.
-
serializeNBT
public net.minecraft.nbt.CompoundTag serializeNBT()- Specified by:
serializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>- Overrides:
serializeNBTin classAbstractCitizenEvent
-
deserializeNBT
public void deserializeNBT(net.minecraft.nbt.CompoundTag compound) - Specified by:
deserializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>- Overrides:
deserializeNBTin classAbstractCitizenEvent
-
serialize
public void serialize(net.minecraft.network.FriendlyByteBuf buf) Description copied from interface:IColonyEventDescriptionSerializes this event to the givenFriendlyByteBuf.- Specified by:
serializein interfaceIColonyEventDescription- Overrides:
serializein classAbstractCitizenEvent- Parameters:
buf- theFriendlyByteBufto serialize to.
-
deserialize
public void deserialize(net.minecraft.network.FriendlyByteBuf buf) Description copied from interface:IColonyEventDescriptionDeserializes this event from the givenFriendlyByteBuf.- Specified by:
deserializein interfaceIColonyEventDescription- Overrides:
deserializein classAbstractCitizenEvent- Parameters:
buf- theFriendlyByteBufto deserialize from.
-
getDeathCause
Gets the cause of the citizen death.- Returns:
- the cause of the citizen death.
-
setDeathCause
Sets the cause of the citizen death.- Parameters:
deathCause- the cause of the citizen death.
-
loadFromNBT
public static CitizenDiedEvent loadFromNBT(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Loads the citizen died event from the given nbt.- Parameters:
compound- the NBT compound- Returns:
- the colony to load.
-
loadFromFriendlyByteBuf
public static CitizenDiedEvent loadFromFriendlyByteBuf(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf) Loads the citizen died event from the given packet buffer.- Parameters:
buf- the packet buffer.- Returns:
- the colony to load.
-
getSummaryTranslationKey
Description copied from interface:IColonyEventDescriptionGet the summary translation key.- Returns:
- the translation key.
-