Skip to content

How to make a block drop something in a Minecraft mod

What a block drops is data: its loot table, a JSON file in data/<modid>/loot_table/blocks named after the block (loot_tables/blocks before 1.21, and assets/<modid>/loot_tables/blocks on 1.12.2). A table can drop the block itself, another item, more with Fortune like the ores do, and the block itself with Silk Touch.

Works on Minecraft 1.20.1 to 26.3 on NeoForge; Minecraft 1.16.5 to 26.3 on Fabric; Minecraft 1.16.5 to 1.20.1 on Forge; Minecraft 1.12.2 on Forge. Each example was compiled against its loader and version before it shipped in Linen.

  1. Make the loot table file for the block (data/<modid>/loot_table/blocks/<block>.json, loot_tables before 1.21).
  2. Add a pool with an item entry for what it drops.
  3. For ores, add a Fortune bonus and a Silk Touch alternative.
  4. Break the block in survival to check.

The example uses these values. Change them in the code.

Setting In the example What it does
drops minecraft:diamond The item it drops.
fortune true Fortune gives more, like Minecraft’s ores.
silk_touch true With Silk Touch it drops itself.

The example mod is examplemod in the package com.example.examplemod. Use your own mod id and package.

Fabric 1.16.5 to 26.3, NeoForge 1.20.1 to 26.3, Forge 1.16.5 to 1.20.1

Section titled “Fabric 1.16.5 to 26.3, NeoForge 1.20.1 to 26.3, Forge 1.16.5 to 1.20.1”

Uses:

  • minecraft:alternatives
  • minecraft:apply_bonus
  • minecraft:match_tool

Uses:

  • minecraft:item
  • minecraft:set_count
  • minecraft:looting_enchant

In 1.12.2 a loot table is a file in assets/<modid>/loot_tables/blocks.

Linen’s How-tos library has this page too, with the example for your own mod’s loader and Minecraft version. Hover a name in your code and Linen points to the how-tos that explain it. Both are free. Download Linen.