Custom Loot

Custom Loot 1.2

This project is
90% Complete
Minecraft Version(s)
1.14,1.14.1,1.14.2
This datapack adds the ability to add loot to entities without replacing the default loot or replacing loot from other datapacks.

There are two function tags for every living entity:
Code:
/data/custom_loot/tags/functions/killed/<ENTITY ID> (Don't exists for the wither and enderdragon)
/data/custom_loot/tags/functions/killed
These functions are executed as/at the entity with the given ID on death while it is living (so you can test for tags/NBT)
If no ID is given, the function gets executed as/at every living entity on death

Code:
/data/custom_loot/tags/functions/killer/<ENTITY ID> (Exists for the wither and enderdragon)
/data/custom_loot/tags/functions/killer
These functions are executed as/at the player who killed the entity with the given ID
If no ID is given, the function gets executed as/at the player who killed a living entity
(The entity killed can be checked with @e[tag=cl_dead,limit=1,sort=nearest,distance=..128] )

In these functions you can add commands you want to get executed when a entity is killed.

I will demonstrate how to add two times cooked pork to Zombie Pigmen.


First create a function and mention it in #custom_loot/killed/zombie_pigman


When only dropping a fixed amount and you don't want to use loot tables you can add the command


summon item ~ ~ ~ {Item:{id:"minecraft:cooked_porkchop",Count:2b}}


If you want to used the advanced possibilities add the following command to the function


loot drop ~ ~ ~ loot <LOOT TABLE PATH>


Loot table example:


{
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "item",
"name": "minecraft:cooked_porkchop",
"weight": 1,
"functions": [
{
"function": "set_count",
"count": {
"min": 2,
"max": 2
}
}
]
}
]
}
]
}




Changelog:
V1.2:
  • added function tag that gets executed as/at every living entity upon death
  • added function tag that gets executed as/at every player who killed a living entity
V1.1:
  • added missing tag



Known Bugs:

  • If you kill a entity with a weapon that deals more than 1023 damage, the custom loot system won't work (This can't be fixed)


If you've found any other bugs or have ideas, contact me via discord.

Supported entity types:
  • bat
  • blaze
  • cat
  • cave_spider
  • chicken
  • cod
  • cow
  • creeper
  • dolphin
  • donkey
  • drowned
  • elder_guardian
  • enderman
  • endermite
  • evoker
  • fox
  • ghast
  • giant
  • guardian
  • horse
  • husk
  • illusioner
  • iron_golem
  • llama
  • magma_cube
  • mooshroom
  • mule
  • ocelot
  • panda
  • parrot
  • phantom
  • pig
  • pillager
  • polar_bear
  • pufferfish
  • rabbit
  • ravager
  • salmon
  • shulker
  • silverfish
  • skeleton
  • skeleton_horse
  • slime
  • snow_golem
  • spider
  • squid
  • stray
  • trader_llama
  • tropical_fish
  • turtle
  • vex
  • villager
  • vindicator
  • wandering_trader
  • witch
  • wither_skeleton
  • wolf
  • zombie
  • zombie_horse
  • zombie_pigman
  • zombie_villager
Discord
Join My Discord
Author
unnamedDE
Downloads
75
Views
226
First release
Last update
Rating
0.00 star(s) 0 ratings
Top