Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-200707

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.16.3, 1.16.4 Release Candidate 1, 1.16.4, 20w46a, 20w48a, 20w49a, 20w51a, 21w03a, 21w07a, 21w08b, 21w13a, 21w15a, 21w16a, 1.17, 1.17.1, 1.18.2, 1.19.1, 1.19.2, 1.19.4, 23w14a, 1.20.1, 1.20.4, 23w51b, 24w20a, 1.21, 1.21.3, 1.21.4
    • Confirmed
    • Loot tables

      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={levels:{"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.

            Unassigned Unassigned
            Avoma [Mod] Avoma
            Votes:
            18 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              CHK: