r/MinecraftCommands • • 5h ago

Help | Java 1.21.11 Loot Table not working

{
  "type": "vault",
  "pools": [
    {
      "rolls": 2,
      "entries": [
        {
          "type": "item",
          "weight": 1,
          "name": "minecraft:crossbow",
          "functions": [
            {
              "function": "set_count",
              "count": 1
            },
            {
              "function": "set_components",
              "components": {
                "minecraft:enchantments": {
                  "multishot": 1,
                  "piercing": 4
                }
              }
            }
          ]
        },
        {
          "type": "item",
          "weight": 1,
          "name": "minecraft:tipped_arrow",
          "functions": [
            {
              "function": "set_count",
              "count": 8
            },
            {
              "function": "set_components",
              "components": {
                "minecraft:potion_contents": {
                  "potion": "minecraft:infested"
                }
              }
            }
          ]
        },
        {
          "type": "item",
          "weight": 1,
          "name": "minecraft:tipped_arrow",
          "functions": [
            {
              "function": "set_count",
              "count": 8
            },
            {
              "function": "set_components",
              "components": {
                "minecraft:potion_contents": {
                  "potion": "minecraft:weakness"
                }
              }
            }
          ]
        },
        {
          "type": "item",
          "weight": 1,
          "name": "minecraft:spectral_arrow",
          "functions": [
            {
              "function": "set_count",
              "count": 32
            }
          ]
        },
        {
          "type": "item",
          "weight": 1,
          "name": "minecraft:enchanted_golden_apple",
          "functions": [
            {
              "function": "set_count",
              "count": 1
            }
          ]
        },
        {
          "type": "item",
          "weight": 1,
          "name": "minecraft:golden_spear",
          "functions": [
            {
              "function": "set_count",
              "count": 1
            },
            {
              "function": "set_components",
              "components": {
                "minecraft:enchantments": {
                  "lunge": 3
                }
              }
            }
          ]
        },
        {
          "type": "item",
          "weight": 1,
          "name": "minecraft:golden_carrot",
          "functions": [
            {
              "function": "set_count",
              "count": 8
            }
          ]
        },
        {
          "type": "item",
          "weight": 1,
          "name": "minecraft:trident",
          "functions": [
            {
              "function": "set_count",
              "count": 1
            },
            {
              "function": "set_components",
              "components": {
                "minecraft:enchantments": {
                  "loyalty": 3
                }
              }
            },
            {
              "function": "set_damage",
              "damage": 150
            }
          ]
        },
        {
          "type": "item",
          "weight": 1,
          "name": "minecraft:totem_of_undying",
          "functions": [
            {
              "function": "set_count",
              "count": 1
            }
          ]
        },
        {
          "type": "item",
          "weight": 1,
          "name": "minecraft:cobweb",
          "functions": [
            {
              "function": "set_count",
              "count": 8
            }
          ]
        },
        {
          "type": "item",
          "weight": 1,
          "name": "minecraft:wind_charge",
          "functions": [
            {
              "function": "set_count",
              "count": 16
            }
          ]
        },
        {
          "type": "item",
          "weight": 1,
          "name": "minecraft:water_bucket",
          "functions": [
            {
              "function": "set_count",
              "count": 1
            }
          ]
        },
        {
          "type": "item",
          "weight": 1,
          "name": "minecraft:ender_pearl",
          "functions": [
            {
              "function": "set_count",
              "count": 2
            }
          ]
        },
        {
          "type": "item",
          "weight": 1,
          "name": "minecraft:goat_horn",
          "functions": [
            {
              "function": "set_count",
              "count": 1
            },
            {
              "function": "set_components",
              "components": {
                "minecraft:instrument": "minecraft:dream_goat_horn"
              }
            }
          ]
        },
        {
          "type": "item",
          "weight": 1,
          "name": "minecraft:blaze_rod",
          "functions": [
            {
              "function": "set_count",
              "count": 1
            },
            {
              "function": "set_components",
              "components": {
                "minecraft:enchantments": {
                  "fire_aspect": 2
                }
              }
            }
          ]
        }
      ]
    }
  ]
}
2 Upvotes

3 comments sorted by

1

u/GalSergey Datapack Experienced 2h ago

Try using your loot table with a command similar to this one in a command block.

loot give @p loot <loot_table>

If specifying the resource name doesn't work, try using the loot table itself defined inline instead. If there is an error in the loot table, you will see it reported in the command block.

If there are no errors and the loot table works, please provide more details about exactly what you are trying to achieve.

1

u/WarriorOfTheInfinity 2h ago

am trying to create a custom loot table to override vault rewards over vanilla for a minigame server, minecraft sees the datapack (testing in singleplayer) but still uses vanilla loot

in the datapack the path is data/minecraft/loot_table/loot_table.json

im unsure if the path might be wrong

1

u/GalSergey Datapack Experienced 1h ago

To replace the vanilla loot table, your loot table must have the exact same name and path as the loot table you want to replace. The path you specified does not use any vanilla loot table.

By default, vault uses the loot table minecraft:chests/trial_chambers/reward, which is located in data/minecraft/loot_table/chests/trial_chambers/reward.json. You can view the contents of this loot table here: https://mcasset.cloud/1.21.11/data/minecraft/loot_table/chests/trial_chambers/reward.json. Therefore, your loot table needs to have exactly this name and path if you want to replace this vanilla loot table.

Alternatively, you can create your own vault by specifying your loot table in the block data, something like this:

give @s vault[block_entity_data={id:"vault",config:{loot_table:"minecraft:loot_table"}}]