TransWikia.com

"vanilla:entities" not working in Minecraft loot table

Arqade Asked on July 7, 2021

I have this loot table in my datapack:

{
    "type": "minecraft:entity",
    "pools": [
        {
            "rolls": 1,
            "entries": [
                {
                    "type": "minecraft:loot_table",
                    "name": "vanilla:entities/cow"
                }
            ]
        },
        {
            "rolls": 1,
            "entries": [
                {
                    "type": "item",
                    "weight": 1,
                    "name": "minecraft:player_head",
                    "functions": [
                        {
                            "function": "set_count",
                            "count": 1
                        },
                        {
                            "function": "set_nbt",
                            "tag": "{display:{Name:'{"text":"Cow.Head","italic":false}'},SkullOwner:MHF_Cow}"
                        }
                    ]
                }
            ]
        }
    ]
}

It’s located in datapackName/data/minecraft/loot_tables/entities/cow.json. But when I kill a cow, it only drops the head, no leather or beef. How do I fix this?

One Answer

I assume vanilla:entities/cow is supposed to mention the vanilla loot table for the cow. vanilla is not the namepsace you are looking for. In fact, the vanilla namespace is minecraft. So, you will need to change it to minecraft:entities/cow.

But wait. Your loot table has the same namespace and filename as the vanilla loot table. This means that your loot table is overwriting the old one, making the old one inaccessible.

But I assume you actually do want to overwrite the old loot table with this one, but reference the old loot table inside of it. In that case, you can create a new loot table named something like minecraft:entities/cow_old, and put the old contents there.

For reference, the default cow loot table looks like this:

{
  "type": "minecraft:entity",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 0.0,
                "max": 2.0,
                "type": "minecraft:uniform"
              }
            },
            {
              "function": "minecraft:looting_enchant",
              "count": {
                "min": 0.0,
                "max": 1.0
              }
            }
          ],
          "name": "minecraft:leather"
        }
      ]
    },
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 1.0,
                "max": 3.0,
                "type": "minecraft:uniform"
              }
            },
            {
              "function": "minecraft:furnace_smelt",
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "predicate": {
                    "flags": {
                      "is_on_fire": true
                    }
                  },
                  "entity": "this"
                }
              ]
            },
            {
              "function": "minecraft:looting_enchant",
              "count": {
                "min": 0.0,
                "max": 1.0
              }
            }
          ],
          "name": "minecraft:beef"
        }
      ]
    }
  ]
}

Answered by ExpertCoder14 on July 7, 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