Place loot table files in data/<modid>/loot_table/ directory.
Block Loot Table (data/mymod/loot_table/blocks/simple_block.json):
json
{
"type": "minecraft:block",
"pools": [{"rolls": 1, "entries": [{"type": "minecraft:item", "name": "mymod:simple_block"}],
"conditions": [{"condition": "minecraft:survives_explosion"}]}]
}
Block with silk touch:
json
{
"type": "minecraft:block",
"pools": [
{"rolls": 1, "entries": [{"type": "minecraft:item", "name": "mymod:glass_block"}],
"conditions": [{"condition": "minecraft:match_tool", "predicate": {"enchantments": [{"enchantment": "minecraft:silk_touch", "levels": {"min": 1}}]}}]},
{"rolls": 1, "entries": [{"type": "minecraft:item", "name": "mymod:glass_shard"}],
"conditions": [{"condition": "minecraft:inverted", "term": {"condition": "minecraft:match_tool", "predicate": {"enchantments": [{"enchantment": "minecraft:silk_touch", "levels": {"min": 1}}]}}}]}]
}
Entity Loot Table (data/mymod/loot_table/entities/custom_entity.json):
json
{
"type": "minecraft:entity",
"pools": [
{"rolls": 1, "entries": [{"type": "minecraft:item", "name": "mymod:entity_drop"}]},
{"rolls": 1, "entries": [{"type": "minecraft:item", "name": "minecraft:experience_bottle",
"functions": [{"function": "minecraft:set_count", "count": {"min": 5, "max": 10, "type": "minecraft:uniform"}}]}]}]
}