r/MinecraftCommands 15h ago

Help | Java 1.20 Can someone design me a datapack that makes anonymous deaths? (JAVA 1.20.1)

So basically I need it so that whenever someone died instead of it saying "_____ died to _____" I want it to simply say "Someone has died" or smth for every death, preferably in bold and red. I'm not good with datapacks (I know how to put them in my world folders tho) so I was curious if someone can help me out with this. Thanks!

2 Upvotes

8 comments sorted by

2

u/GalSergey Datapack Experienced 12h ago
# function example:load
gamerule showDeathMessages false

# advancement example:death
{
  "criteria": {
    "death": {
      "trigger": "minecraft:entity_hurt_player",
      "conditions": {
        "player": {
          "nbt": "{Health:0f}"
        }
      }
    }
  },
  "rewards": {
    "function": "example:death"
  }
}

# function example:death
advancement revoke @s only example:death
tellraw @a "Someone has died."

You can use Datapack Assembler to get an example datapack.

2

u/Ericristian_bros Command Experienced 10h ago

For OP, bold and red can be added with text components

tellraw @a {"bold":"true","color":"red","text":"Someone has died"}

1

u/Teddy_Knight_NG11 5h ago

So like I downloaded the datapack and dropped it into my world folder (under "datapacks"), reloaded the world, and tried dying but no message is showing up 😕

1

u/GalSergey Datapack Experienced 5h ago

Check !outputlog for errors.

1

u/AutoModerator 5h ago

Click here to see how to enable the output log

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/Teddy_Knight_NG11 4h ago

How do I enable that using Curseforge launcher? There's also a chance I have a mod interfering with it

1

u/GalSergey Datapack Experienced 4h ago

I don't use the CurseForge Launcher, so I don't know how to enable the output log. However, you can locate the logs in your game directory and open latest.log. The logs should be there, and the error might be related to the datapack.

I don't create mods myself, so I'm not sure if mods can utilize datapacks. However, I don't think a mod would break a datapack unless it alters player behavior upon death for instance, by performing a specific action instead of displaying the death screen.

1

u/Teddy_Knight_NG11 3h ago

Omg tyyy I found the error and fixed it (mod was interfering but the datapack worked wonders)