末影龍戰利品│Ender Dragon Loot
For Players
If you're using a data pack that requires this data pack as a dependency, simply add it to your data packs folder along with the main one.
When removing a data pack that uses this as a dependency, execute the command /data remove storage minecraft:ender_dragon_loot loot_table_list after deleting the data pack files, then reload the world with /reload.
For Data Pack Creators
Setting Up Loot
Create a function and add the following two commands, replacing <loot table identifier> with the desired loot table that the Ender Dragon should drop:
data remove storage minecraft:ender_dragon_loot loot_table_list[{id:"<loot table identifier>"}]
data modify storage minecraft:ender_dragon_loot loot_table_list append value {id:"<loot table identifier>"}
Add this function to the #minecraft:load function tag.
Important: loot spawns above the highest block at coordinates x=0, z=0.
Executing Functions
Create a function containing commands that should run after the Ender Dragon's death. Add this function to the #ender_dragon_loot:rewards tag.
Note: commands execute at the position of the block marked with a white frame in the image below.

Usage Examples
Check out the collection of example data packs created using this system.
Other Works
Explore my other projects.