TransWikia.com

Why is my loot table not showing up in the /loot command?

Arqade Asked by A Banana on June 25, 2021

I’ve created a loot table[1] and I’m having issues using it with the loot command:

loot insert ~ ~ ~ loot minecraft:op

Executing the command above drops zero items. The JSON for the loot table is:

{
    "pools": [
        {
            "rolls": {
                "min": 1,
                "max": 2
            },
            "bonus_rolls": {
                "min": 0,
                "max": 2.5
            },
            "entries": [
                {
                    "type": "item",
                    "name": "minecraft:",
                    "weight": 1,
                    "functions": [
                        {
                            "function": "set_count",
                            "count": {
                                "min": 1,
                                "max": 2
                            }
                        }
                    ]
                },
                {
                    "type": "item",
                    "name": "minecraft:diamond",
                    "weight": 3,
                    "functions": [
                        {
                            "function": "set_count",
                            "count": {
                                "min": 1,
                                "max": 7
                            }
                        }
                    ]
                },
                {
                    "type": "item",
                    "name": "minecraft:totem_of_undying",
                    "weight": 1,
                    "functions": [
                        {
                            "function": "set_count",
                            "count": 1
                        }
                    ]
                },
                {
                    "type": "item",
                    "name": "minecraft:enchanted_book",
                    "weight": 2,
                    "functions": [
                        {
                            "function": "enchant_randomly",
                            "enchantments": [
                                "protection"
                            ]
                        }
                    ]
                },
                {
                    "type": "item",
                    "name": "minecraft:iron_block",
                    "weight": 3,
                    "functions": [
                        {
                            "function": "set_count",
                            "count": {
                                "min": 1,
                                "max": 5
                            }
                        }
                    ]
                },
                {
                    "type": "item",
                    "name": "minecraft:stick",
                    "weight": 1,
                    "functions": [
                        {
                            "function": "enchant_randomly",
                            "enchantments": [
                                "knockback"
                            ]
                        }
                    ]
                },
                {
                    "type": "item",
                    "name": "minecraft:gold_block",
                    "weight": 1,
                    "functions": [
                        {
                            "function": "set_count",
                            "count": {
                                "min": 1,
                                "max": 5
                            }
                        }
                    ]
                },
                {
                    "type": "item",
                    "name": "minecraft:potion",
                    "weight": 1,
                    "functions": [
                        {
                            "function": "set_nbt",
                            "tag": "{Potion:"minecraft:strength"}"
                        }
                    ]
                }
            ]
        }
    ]
}

Why is my loot table not showing up for the loot command?

[1]: The JSON file is located at datapackName/data/minecraft/loot_tables.

One Answer

Your loot table contains an error on line 10 and on line 15.

...
8.            "bonus_rolls": {
9.                "min": 0,
10.               "max": 2.5
11.           },
12.           "entries": [
13.               {
14.                   "type": "item",
15.                   "name": "minecraft:",
16.                   "weight": 1,
17.                   "functions": [
18.                       {
19.                           "function": "set_count",
20.                           "count": {
21.                               "min": 1,
22.                               "max": 2
...

On line 10, you have set the max bonus_rolls to 2.5; this is not a valid number, since the rolls must be integers (i.e. whole numbers). Use 2 or 3 instead.

On line 15, you left it as "name": "minecraft:" and did not specify what item is to be given.


I also recommend to place your loot table into your namespace instead of minecraft's namespace. Your folder structure would then look like this:

datapackName > data > your_namespace > loot_tables > op.json

...and you would use /loot insert ~ ~ ~ loot your_namespace:op

Additionally, make sure that the targeted location is a container to insert the loot into or the command will fail with the error, "The target block is not a container"

If you are trying to give the loot to a player directly, you should use /loot give @p loot your_namespace:op


I use https://amaury.carrade.eu/minecraft/loot_tables to generate my loot tables.

Correct answer by ginkgo on June 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP