Damage type

Damage types are JSON files located in data packs that define different kinds of damage that entities can take. They control which attributes the damage has as well as which death message is used when an entity dies due to that type of damage.

Additionally, the built-in damage type tags control many aspects of how damage is applied by the game.

Custom damage types can currently only be applied using the command.

File format
Damage types are stored as JSON files within a data pack, at the path.


 * The root object.
 * Used as part of the death message translation key if is set to, as shown below.
 * The amount of hunger exhaustion caused by this damage type.
 * Whether this damage type scales with difficulty. Possible values:, , or . See below for more detail.
 * Optional field controlling how incoming damage is shown to the player. Possible values: (default),, , , , . See below for more detail.
 * Optional field that controls the kind of death messages to use. Possible values: (default),, . See below for more detail.

For example, here is JSON for the built-in :

Scaling
Damage types control whether damage scales with difficulty.

Possible values of :
 * Damage is always the same.
 * Damage always scales with difficulty.
 * Damage scales with difficulty if the attacker was a living entity and was not a player.

Effects
Damage types control how incoming damage is shown to the player.

Possible values of :
 * (default): The default hurt sound.
 * Thorns hurt sound.
 * Drowning sound.
 * A single tick of burning sound.
 * Berry bush poke sound.
 * Freezing tick sound.

Death messages
Damage types control the death messages displayed when players or pets die.

Possible values of :
 * (default): Use the standard death message logic.
 * Use the fall damage death messages, e.g..
 * Show the "intentional game design" death message.

Default message type
When standard death message logic is being used, messages are generated as follows, making use of the tag:


 * If the killing blow was caused by an attacker and the attacker was holding a named item in their main hand at the time of death, this is categorized as an item death. A translated message is displayed using the translation key  with the following insertions available:
 * The name of the dying entity.
 * The name of the attacker.
 * The name of the item.
 * If the killing blow was not caused by an attacker, but the dying entity had recently taken damage that was caused by a living entity , this is categorized as an assisted death. A translated message is displayed using the translation key  with the following insertions available:
 * The name of the dying entity.
 * The name of the recent attacker.
 * If neither of the above apply, this is categorized as a normal death. A translated message is displayed using the translation key  with the following insertions available:
 * The name of the dying entity.
 * The name of the attacker, if there was one.

Design
Because of how the default death messages are set up, most vanilla damage types are divided into ones that will always have an attacker and ones that will never have an attacker. Depending on whether there was an attacker, the translation for normal deaths will have either one or two available insertions. Translations have no safe way to access an insertion that may or may not be there, so the primary options are:

The death type is planned to always have an attacker.
 * The translation looks like
 * The translation key  is not provided, since assisted deaths are impossible.

The death type is planned to never have an attacker.
 * The translation looks like
 * The translation key  is not provided, since item deaths are impossible.

The death type may or may not have an attacker.
 * The translation looks like
 * The translation key  avoids using the second insertion, since it may or may not be present.
 * The translation is a little awkward, since the death message when killed by a player will only mention them if they're holding a named weapon.

To avoid the awkwardness of the third option you can have two different damage types, one for use with an attacker, and one for use without an attacker: