public static interface DestructEntityEvent.Death extends DestructEntityEvent, TargetLivingEvent, Cancellable
DestructEntityEvent
where the removal of the
Living
, the TargetLivingEvent.getTargetEntity()
,
is due to it losing its health.
Note that cancelling this event will have the implication that the entity will have restored health and not enter a "death" state to play a dying animation, drop items, and drop experience. It is highly encouraged to keep the cancellation of this event at a mimium as in modded environments, cancelling this event may have other implications that mods may not consider and cause bugs.
DestructEntityEvent.Death
MessageChannelEvent.Chat
MessageEvent.DefaultBodyApplier, MessageEvent.DefaultHeaderApplier, MessageEvent.MessageFormatter
PARAM_MESSAGE_BODY, PARAM_MESSAGE_FOOTER, PARAM_MESSAGE_HEADER
Modifier and Type | Method and Description |
---|---|
boolean |
getKeepInventory()
Returns whether the inventory is kept after death.
|
void |
setKeepInventory(boolean keepInventory)
Applies the
DefaultGameRules.KEEP_INVENTORY gamerule to this
entity alone. |
getChannel, getOriginalChannel, setChannel
clearMessage, getFormatter, getMessage, getOriginalMessage, isMessageCancelled, setMessage, setMessage, setMessage, setMessageCancelled
getCause, getContext, getSource
getTargetEntity
isCancelled, setCancelled
void setKeepInventory(boolean keepInventory)
DefaultGameRules.KEEP_INVENTORY
gamerule to this
entity alone.
This only works for players
keepInventory
- Whether to keep the inventory on deathboolean getKeepInventory()
By default this is the same as the
DefaultGameRules.KEEP_INVENTORY
gamerule.