Minecraft Data Packs / Other

Custom Death Messages Datapack

  • check_circle Advancements
  • check_circle Functions
  • check_circle Loot Tables
  • 5,602 views, 8 today
  • 506 downloads, 0 today
  • 19
  • 13
  • 3
Oligo's Avatar Oligo
Level 37 : Artisan Crafter
22
Custom Death Messages (for Minecraft 1.19+)
by: Oligo

Description

This data pack allows you to create custom death messages that display when players die. Messages are written as strings in raw JSON format, and multiple messages can be written for a single death event creating a great amount of variety!

Why not use a resource pack (language file)?

Resource packs can be used to change the encoded death messages, however, this method does not allow the creator to use text formatting. Further, only a single message can be specified for a given death event. This data pack also provides more data relevant to the death event which can be used to further customize your messages.

Features

Death messages can be edited in-game

Messages are stored as strings in the cdm:messages storage space, and can be changed using the /data modify command. Death messages can be created for 10 different death events: combat, explosion, fall, fire, lightning, magic, projectile, starvation, suffocation, and void. (Click here for detailed description of death events). Each death event contains two tags: root and player which hold the message(s) to be displayed. Messages in the player tags display when there is a victim and killer in the death event, while messages in the root tag display when there is only a victim.

Below are some examples of how to change death messages.
Append a new message to the combat.player pool
data modify storage cdm:messages combat.player append value '{"text":"Example"}'
Create a new message pool for fire.root
data modify storage cdm:messages fire.root set value ['{"text":"Example 1"}', '{"text":"Example 2"}']
Remove the first message in the magic.root pool
data remove storage cdm:data magic.root[0]

Entity names can be used in messages using JSON components
Entity names related to the death event are stored in the entity tag of the cdm:data storage namespace. In the entity tag: victim is the player that died, direct_killer is the entity that dealt the damage responsible for death, and killer is the creator of direct_killer (same as direct_killer if killer dealt final damage to victim). These entity names can be incorporated into messages using the NBT JSON component with the interpret tag set to true.

Below is an example of how to incorporate entity names.
Enter the name of the victim in a combat.root message
data modify storage cdm:messages combat.root append value '{"nbt":"entity.victim", "storage":"cdm:data", "interpret":true, "extra":[{"text":" died"}]}'


Other parameters can be used in messages
The param tag in the cdm:data storage space contains two tags: loc which contains the death location of the victim, and dist which is the distance between the victim and killer at the time of death (in blocks).

Below are some examples of how to incorporate these parameters in messages:
Enter the victim's death location in an explosion.root message
data modify storage cdm:messages explosion.root append value '{"text":"Deathly explosion at ", "extra":[{"nbt":"param.loc", "storage":"cdm:data"}]}'
Enter the distance between the victim and killer in a projectile.player message
data modify storage cdm:messages projectile.player append value '{"nbt":"entity.victim", "storage":"cdm:data", "interpret":true, "extra":[{"text":" was shot by "}, {"nbt":"entity.killer", "storage":"cdm:data", "interpret":true}, {"text":" from "}, {"nbt":"param.dist", "storage":"cdm:data"}, {"text":" blocks away"}]}'


Messages can be randomized
An arbitrary number of death messages can be added to a single death event pool. Each message will be randomly selected when the death event occurs in the world.

Compatibility

This datapack requires doMobLoot to be true and showDeathMessages to be false. These settings can be changed automatically by typing /reload.

To uninstall the datapack in-game, simply type the command:
function cdm:uninstall
CompatibilityMinecraft 1.19
Tags

Create an account or sign in to comment.

Maabs
08/31/2022 7:31 pm
Level 55 : Grandmaster Explorer
Maabs's Avatar
Nice work!!! :D
1
Unavalible_User
08/31/2022 12:00 am
Level 12 : Journeyman Cookie
history
Unavalible_User's Avatar
I suppose that if I wanted to do this in a world without cheats I could just add the data modify commands to the pack itself?

also it would be cool if there was a /trigger command that would allow you to see all the messages in a certain pool (e.g. /trigger listDeaths set 3 could list all the ones in the fall damage category)
1
MagicMason1000
09/07/2022 11:32 pm
Level 1 : New Explorer
MagicMason1000's Avatar
What you could do is open the world to LAN with cheats on and set all the commands up, then leave the world and rejoin and cheats will be back off. I'm not sure if you want to stay off of cheats at all, but if you are ok with having them on for a minute to set up the datapack, you could do that.
1
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome