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

`apply_bonus` loot table function doesn't work on entity kills

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 1.15.1, 1.15.2
    • Fix Version/s: None
    • Labels:
      None
    • Confirmation Status:
      Confirmed
    • Category:
      Loot tables
    • Mojang Priority:
      Normal

      Description

      The bug

      The function apply_bonus takes an enchantment and some parameters to increase the item count of a loot table entry. This function is used in various vanilla block loot tables.

      However it appears this does not work for entity loot tables although the enchantment context is still available, proven by the usage of the looting_enchant function, used in almost every mob loot table. This is inconsistent and no warning is given in the log.

      How to reproduce

      1. Put the following loot table in a data pack:
        {
          "type": "entity",
          "pools": [
            {
              "rolls": 1,
              "entries": [
                {
                  "type": "item",
                  "name": "diamond",
                  "functions": [
                    {
                      "function": "apply_bonus",
                      "enchantment": "looting",
                      "formula": "binomial_with_bonus_count",
                      "parameters": {
                        "extra": 10,
                        "probability": 0.5
                      }
                    }
                  ]
                }
              ]
            }
          ]
        }
      2. /reload the data pack
      3. Summon a mob with this loot table
        /summon pig ~ ~ ~ {DeathLootTable:"namespace:foo"}
      1. Kill the mob with a normal sword
      2.  Exactly one diamond is dropped
      3. Resummon the mob with the command in step 3.
      4. Kill the mob with a looting 3 sword
      5.  Only one diamond is dropped, while you would expect 6.5 on average 

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Misoloo [Helper] Misode
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                CHK: