1.2 Block Loot

I have been building these tutorials based off reading from Cadiboo’s example mod code on github. This one is very easy to do, but was very hard for me to find how to do it. Previously this kind of functionality had been inside the java source code, but now it is just in a json file in a part called a ‘data pack’

I was able to find this information from a few sources,
Data pack – Minecraft Gamepedia
Resource pack – Minecraft Gamepedia
Resources – Forge Documentation

So after finding what to look for I was able to find the file on cadiboo’s repo

So to get started we need to make the folder for our mod’s Data pack. Create a folder data in our resources folder, then inside of that new folder create a folder with the same name as your modid (example_mod for me), then inside that create a folder loot_tables, and finally create a blocks folder inside that. This should make a directory structure that looks like resources/data/example_mod/loot_tables/blocks

Now that we have all of our folders, we are ready to make our example_ore.json file inside in that we will need to specify the things that the block can drop, the chances of each drop, and any conditions. In our case we just want to drop our BlockItem 100% of the time. We will also add a condition that will only drop the item if it should have survived an explosion.

  "type": "minecraft:block",
  "pools": [
      "rolls": 1,
      "entries": [
          "type": "minecraft:item",
          "name": "example_mod:example_ore"
      "conditions": [
          "condition": "minecraft:survives_explosion"

If you have any problems double check that the json is fully valid. I had an issue with my first launch where I was missing a comma, and nothing worked.

To learn even more about how loot tables work you can look at minecraft’s default loot tables by downloading the minecraft client jar and then you can extract the files uzing 7-zip (on Mac or Linux you can rename the file from .jar to .zip easily using the mv command). Once extracted you can see the loot tables (or any other part of minecraft’s Asset or Data packs) in data/minecraft/loot_tables/blocks. that way if you want similar behaviors to any minecraft blocks (like redstone ore’s multi item drops, and fortune/silk touch support) you can easily get a great example!

You can see my code from this post here hgithub.com/cody-code-wy/1.15.2-Example-Mod/commit/f2fc16

In the next post I am going to experiment some more with the loot tables, and create a new block from scratch.

Leave Comment

Your email address will not be published. Required fields are marked *