All Implemented Interfaces:
ICitizenEventDescription, IColonyEventDescription, net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>

public class CitizenDiedEvent extends AbstractCitizenEvent
The event for handling a citizen death.
  • Field Details

    • CITIZEN_DIED_EVENT_ID

      public static final net.minecraft.resources.ResourceLocation CITIZEN_DIED_EVENT_ID
      This 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: IColonyEventDescription
      Gets this event types registry id.
      Returns:
      this event types registry id.
    • getName

      public String getName()
      Description copied from interface: IColonyEventDescription
      Gets the name of this event type.
      Returns:
      the name of this event type.
    • serializeNBT

      public net.minecraft.nbt.CompoundTag serializeNBT()
      Specified by:
      serializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
      Overrides:
      serializeNBT in class AbstractCitizenEvent
    • deserializeNBT

      public void deserializeNBT(net.minecraft.nbt.CompoundTag compound)
      Specified by:
      deserializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
      Overrides:
      deserializeNBT in class AbstractCitizenEvent
    • serialize

      public void serialize(net.minecraft.network.FriendlyByteBuf buf)
      Description copied from interface: IColonyEventDescription
      Serializes this event to the given FriendlyByteBuf.
      Specified by:
      serialize in interface IColonyEventDescription
      Overrides:
      serialize in class AbstractCitizenEvent
      Parameters:
      buf - the FriendlyByteBuf to serialize to.
    • deserialize

      public void deserialize(net.minecraft.network.FriendlyByteBuf buf)
      Description copied from interface: IColonyEventDescription
      Deserializes this event from the given FriendlyByteBuf.
      Specified by:
      deserialize in interface IColonyEventDescription
      Overrides:
      deserialize in class AbstractCitizenEvent
      Parameters:
      buf - the FriendlyByteBuf to deserialize from.
    • getDeathCause

      public String getDeathCause()
      Gets the cause of the citizen death.
      Returns:
      the cause of the citizen death.
    • setDeathCause

      public void setDeathCause(String deathCause)
      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

      public String getSummaryTranslationKey()
      Description copied from interface: IColonyEventDescription
      Get the summary translation key.
      Returns:
      the translation key.