3

Datapack help

NetheritePlanet 3/15/25 10:30 pm history
150
3/16/2025 12:13 am
When player killing player, he gets 8 emeralds with NBT
I need this mechanic in my datapack for map
Version - 1.21.4
Posted by
NetheritePlanet
Level 30 : Artisan Architect Writer
38

  Have something to say?

JoinSign in

2

ScotsMiser
03/15/2025 10:57 pm
Level 71 : Legendary Miner
history
Beyond my area of comfort, but this might be doable if approached by checking if the player dieing is being killed by a player and adding the emeralds to the dropped inventory.

Note that I don't know how to do this, but …
From https://minecraft.wiki/w/Death_messages#Players_and_mobs
This death message is actually two different death messages: <player> was slain by <mob> and <player> was slain by <player>.
* This means they can be customized completely independently of each other using resource packs.
So if you know B has been killed by A, you also know A has killed B

That should also be usable to trigger a function to either give the emeralds to A, or to summon the emeralds at A's location.
EDIT: possibly the emeralds could be added to B's invetory before it is dropped?

If/When you work out how to implement the idea, please post as I'm still in the learning stage…
2
Cornbread_Alphanumeric
03/16/2025 12:13 am
She/They • Level 54 : Grandmaster Miner uwu
players have their own loot table, so the emeralds could theoretically be added to there with the killed_by_player condition.
3

Welcome