mojira.dev
MC-200707

Item drops from iron golems and cats aren't affected by the looting enchantment

The Bug:

Item drops from iron golems and cats aren't affected by the looting enchantment.

Steps to Reproduce:

  1. Give yourself a sword with a high level of looting by using the command provided below.

    /give @s minecraft:diamond_sword[minecraft:enchantments={"minecraft:looting":100}]
  2. Summon both an iron golem and a cat.

  3. Kill both of them using the sword enchanted with looting and observe the loot that they drop upon death.

  4. Take note as to whether or not item drops from iron golems and cats are affected by the looting enchantment.

Observed Behavior:

Item drops aren't affected by the looting enchantment.

Expected Behavior:

Item drops would be affected by the looting enchantment.

Code Analysis:

Code analysis by @Avoma can be found below.

data > minecraft > loot_tables > entities > cat.json

{
  "type": "minecraft:entity",
  "pools": [
    {
      "bonus_rolls": 0.0,
      "entries": [
        {
          "type": "minecraft:item",
          "functions": [
            {
              "add": false,
              "count": {
                "type": "minecraft:uniform",
                "max": 2.0,
                "min": 0.0
              },
              "function": "minecraft:set_count"
            }
          ],
          "name": "minecraft:string"
        }
      ],
      "rolls": 1.0
    }
  ]
}

data > minecraft > loot_tables > entities > iron_golem.json

{
  "type": "minecraft:entity",
  "pools": [
    {
      "bonus_rolls": 0.0,
      "entries": [
        {
          "type": "minecraft:item",
          "functions": [
            {
              "add": false,
              "count": {
                "type": "minecraft:uniform",
                "max": 2.0,
                "min": 0.0
              },
              "function": "minecraft:set_count"
            }
          ],
          "name": "minecraft:poppy"
        }
      ],
      "rolls": 1.0
    },
    {
      "bonus_rolls": 0.0,
      "entries": [
        {
          "type": "minecraft:item",
          "functions": [
            {
              "add": false,
              "count": {
                "type": "minecraft:uniform",
                "max": 5.0,
                "min": 3.0
              },
              "function": "minecraft:set_count"
            }
          ],
          "name": "minecraft:iron_ingot"
        }
      ],
      "rolls": 1.0
    }
  ]
}

If we look at the above json files, we can see that the "minecraft:looting_enchant" function (the function that's responsible for modifying the count of how many items are returned when an entity is killed by an item with the looting enchantment) isn't present anywhere within the cat's or the iron golem's loot table, therefore resulting in the drops of cats and iron golems not being affected by the looting enchantment.

Linked issues

Attachments

Comments 16

Can you provide a screenshot with your debug screen enabled (F3)

I forgot about my mods. Tested it in vanilla and added a new screenshot with F3 open.

Panda is already being tracked at MC-160006.

Can confirm in 20w51a.

Can confirm in 21w03a.

6 more comments

Can confirm in 1.17.1.

Can confirm in 1.18.2.

Can confirm in 1.19.1.

Removed pandas since they're already tracked in MC-160006.

Here's a code analysis of this issue.

Code Analysis:

data > minecraft > loot_tables > entities > cat.json

{
  "type": "minecraft:entity",
  "pools": [
    {
      "bonus_rolls": 0.0,
      "entries": [
        {
          "type": "minecraft:item",
          "functions": [
            {
              "add": false,
              "count": {
                "type": "minecraft:uniform",
                "max": 2.0,
                "min": 0.0
              },
              "function": "minecraft:set_count"
            }
          ],
          "name": "minecraft:string"
        }
      ],
      "rolls": 1.0
    }
  ]
}

data > minecraft > loot_tables > entities > iron_golem.json

{
  "type": "minecraft:entity",
  "pools": [
    {
      "bonus_rolls": 0.0,
      "entries": [
        {
          "type": "minecraft:item",
          "functions": [
            {
              "add": false,
              "count": {
                "type": "minecraft:uniform",
                "max": 2.0,
                "min": 0.0
              },
              "function": "minecraft:set_count"
            }
          ],
          "name": "minecraft:poppy"
        }
      ],
      "rolls": 1.0
    },
    {
      "bonus_rolls": 0.0,
      "entries": [
        {
          "type": "minecraft:item",
          "functions": [
            {
              "add": false,
              "count": {
                "type": "minecraft:uniform",
                "max": 5.0,
                "min": 3.0
              },
              "function": "minecraft:set_count"
            }
          ],
          "name": "minecraft:iron_ingot"
        }
      ],
      "rolls": 1.0
    }
  ]
}

If we look at the above json files, we can see that the "minecraft:looting_enchant" function (the function that's responsible for modifying the count of how many items are returned when an entity is killed by an item with the looting enchantment) isn't present anywhere within the cat's or the iron golem's loot table, therefore resulting in the drops of cats and iron golems not being affected by the looting enchantment.

Max Muster

Avoma

(Unassigned)

Confirmed

Loot tables

iron_golem, looting, panda

1.16.3, 1.16.4 Release Candidate 1, 1.16.4, 20w46a, 20w48a, ..., 1.21, 1.21.3, 1.21.4, 25w08a, 1.21.7

Retrieved