1

I've been trying to set up a loot table for a chest. For some reason it doesn't work.
I put the .json file into "datapacks/loottables/data/minecraft/loot_tables/chests/".
There is a "pack.mcmeta" file in the correct folder right next to the data folder. The game does list this datapack when running the command /datapack list.
I named the file "buried_treasure.json".

Here is the command I used: /setblock ~ ~ ~ chest{LootTable:"minecraft:loot_tables/chests/buried_treasure.json"}
The chest comes out empty.

Here is the json file:

{
  "type": "minecraft:chests",
  "pools":
  [
    {
      "rolls":
      {
        "min": 1,
        "max": 4
      },
      "entries":
      [
        {
          "type": "item",
          "name": "minecraft:bread",
          "weight": 60,
          "functions":
          [
            {
              "function": "set_count",
              "count":
              {
                "min": 5,
                "max": 15
              }
            }
          ]
        },
        {
          "type": "item",
          "name": "minecraft:carrot",
          "weight": 65,
          "functions":
          [
            {
              "function": "set_count",
              "count": 1
            }
          ]
        },
        {
          "type": "item",
          "name": "minecraft:cooked_beef",
          "weight": 31,
          "functions":
            [
              {
                "function": "set_count",
                "count":
                {
                  "min": 1,
                  "max": 10
                }
              }
            ]
          },
          {
            "type": "item",
            "name": "minecraft:arrow",
            "weight": 1,
            "quality": 50,
            "functions":
            [
              {
                "function": "set_count",
                "count":
                {
                  "min": 3,
                  "max": 10
                }
              }
            ]
          },
          {
            "type": "item",
            "name": "minecraft:stick",
            "weight": 51,
            "functions":
            [
              {
                "function": "set_count",
                "count":
                {
                  "min": 5,
                  "max": 20
                }
              }
            ]
          },
          {
            "type": "item",
            "name": "minecraft:string",
            "weight": 50,
            "functions":
            [
              {
                "function": "set_count",
                "count":
                {
                  "min": 5,
                  "max": 15
                }
              } 
            ] 
          },
          {
            "type": "item",
            "name": "minecraft:iron_ingot",
            "weight": 30,
            "functions":
            [
              {
                "function": "set_count",
                "count":
                {
                  "min": 2,
                  "max": 13
                }
              }
            ]
          },
          {
            "type": "item",
            "name": "minecraft:redstone",
            "weight": 1,
            "quality": 20,
            "functions":
            [
              {
                "function": "set_count",
                "count":
                {
                  "min": 2,
                  "max": 11
                }
              }
            ]
          },
          {
            "type": "item",
            "name": "minecraft:obsidian",
            "weight": 17,
            "functions":
            [
              {
                "function": "set_count",
                "count":
                {
                  "min": 1,
                  "max": 8
                }
              }
            ]
          },
          {
            "type": "item",
            "name": "minecraft:gold_ingot",
            "weight": 10,
            "functions":
            [
              {
                "function": "set_count",
                "count":
                {
                  "min": 1,
                  "max": 6
                }
              }
            ]
          },
          {
            "type": "item",
            "name": "minecraft:iron_helmet",
            "weight": 8,
            "functions":
            [
              {
                "function": "set_count",
                "count": 1
              }
            ]
          },
          "type": "item",
          "name": "minecraft:iron_chestplate",
          "weight": 5,
          "functions":
          [
            {
              "function": "set_count",
              "count": 1
            }
          ]
        },
        {
          "type": "item",
          "name": "minecraft:iron_leggings",
          "weight": 5,
          "functions":
          [
            {
              "function": "set_count",
              "count": 1
            }
          ]
        },
        {
          "type": "item",
          "name": "minecraft:iron_boots",
          "weight": 6,
          "functions":
          [
            {
              "function": "set_count",
              "count": 1
            }
          ]
        }
      ]
    }
  ]
}
  • 1
    Have you tried anything else? – snoozingnewt Jun 30 at 14:08
  • …like a simpler loot table or using one of the defaults to test? – Fabian Röling Jun 30 at 14:18
  • I have tested much simpler loot tables but they don't work either. I mean loot tables with just a single item. – TheNotoriousLaw Jun 30 at 22:09
1

Apparently the solution is as simple as changing the loot table name from

"minecraft:loot_tables/chests/buried_treasure.json"

to

"minecraft:chests/buried_treasure"

Now everything appears in the chest as things should.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.