Class CitizenDiedEvent
java.lang.Object
com.minecolonies.core.colony.eventhooks.citizenEvents.AbstractCitizenEvent
com.minecolonies.core.colony.eventhooks.citizenEvents.CitizenDiedEvent
- All Implemented Interfaces:
ICitizenEventDescription,IColonyEventDescription,net.neoforged.neoforge.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.RegistryFriendlyByteBuf buf) Deserializes this event from the givenRegistryFriendlyByteBuf.voiddeserializeNBT(net.minecraft.core.HolderLookup.Provider provider, 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.static CitizenDiedEventloadFromFriendlyByteBuf(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Loads the citizen died event from the given packet buffer.static CitizenDiedEventloadFromNBT(net.minecraft.core.HolderLookup.Provider provider, @NotNull net.minecraft.nbt.CompoundTag compound) Loads the citizen died event from the given nbt.voidserialize(net.minecraft.network.RegistryFriendlyByteBuf buf) Serializes this event to the givenRegistryFriendlyByteBuf.net.minecraft.nbt.CompoundTagserializeNBT(net.minecraft.core.HolderLookup.Provider provider) voidsetDeathCause(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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.colonyEvents.descriptions.ICitizenEventDescription
toDisplayString
-
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(@NotNull net.minecraft.core.HolderLookup.Provider provider) - Specified by:
serializeNBTin interfacenet.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>- Overrides:
serializeNBTin classAbstractCitizenEvent
-
deserializeNBT
public void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) - Specified by:
deserializeNBTin interfacenet.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>- Overrides:
deserializeNBTin classAbstractCitizenEvent
-
serialize
public void serialize(net.minecraft.network.RegistryFriendlyByteBuf buf) Description copied from interface:IColonyEventDescriptionSerializes this event to the givenRegistryFriendlyByteBuf.- Specified by:
serializein interfaceIColonyEventDescription- Overrides:
serializein classAbstractCitizenEvent- Parameters:
buf- theRegistryFriendlyByteBufto serialize to.
-
deserialize
public void deserialize(net.minecraft.network.RegistryFriendlyByteBuf buf) Description copied from interface:IColonyEventDescriptionDeserializes this event from the givenRegistryFriendlyByteBuf.- Specified by:
deserializein interfaceIColonyEventDescription- Overrides:
deserializein classAbstractCitizenEvent- Parameters:
buf- theRegistryFriendlyByteBufto 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 net.minecraft.core.HolderLookup.Provider provider, @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.RegistryFriendlyByteBuf buf) Loads the citizen died event from the given packet buffer.- Parameters:
buf- the packet buffer.- Returns:
- the colony to load.
-