2

Execute if predicate help

Silabear 4/13/21 5:05 am
878
5/30/2021 12:28 am
I am making a bosses datapack with new custom swords. I want a custom boss to summon a custom item if it was killed by a player with a 10% chance for the item to spawn. I know the killed_by_player and the custom chance predicates exist, but I'm confused about how to use 'execute if predicate' on a dead mob. If anyone can give me a simple execute command which will summon an item on a entity when it has been killed by a player, I would be very grateful :D

Thanks, and have a great day!
Posted by
Silabear
Retired Moderator
Level 70 : Legendary Guard Bear
981

  Have something to say?

JoinSign in

4

anonpmc2935992
05/30/2021 12:28 am
Level 7 : Apprentice Miner
[deleted]
1
mzxciap
05/03/2021 1:53 pm
She/Her • Level 49 : Master Procrastinator
eg this command: "/summon pig ~ ~ ~ {DeathLootTable:"minecraft:chests/abandoned_mineshaft"}"
1
mzxciap
05/03/2021 1:51 pm
She/Her • Level 49 : Master Procrastinator
have you considered the DeathLootTable tag?
cuz loot tables can use predicates, and the DeathLootTable tag lets you set a custom loot table on death.
So maybe you could have a loot table with a 10% chance to drop it, and a killed_by_player condition.
1
HoboMaggot
04/13/2021 7:00 am
Level 55 : Grandmaster Blob
You would need to make another mob/AEC a passenger of the boss, which detects if the mob its on is dead before using the predicate and disappear.
This video basically explains the concept even though it is 1.12.
If you need actual command examples just comment that you need some
1

Welcome