Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-156153

"add" option in "set_count" loot table function does not work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.18.31
    • None
    • Confirmed
    • Windows
    • 789570

      The bug

      The set_count loot table function has an add field. It's used in some ancient city loot tables.

      Normally, the set_count function replaces the quantity of the resulting item, but setting add to true is supposed to make it increase or decrease the quantity instead. This doesn't work, the field is always treated as false.

      How to reproduce

      1. Download and open the attached world
      2. /loot give @s loot test

      Expected result
      You get 25 diamond ore: 5 + 20

      Actual result
      You get 20, the 20 overwrote the 5 even though it was supposed to add

      Alternative
      If this function is not implemented, the game should yield a content log error for including an invalid field.

      Notes
      After fixing this, please fix MCPE-35307 which is very similar! The problem is that set_count and looting_enchant don't work on stacks of size zero!

      Also, here is the loot table definition for convenience:

      {
         "pools": [
            {
               "rolls": 1.0,
               "entries": [
                  {
                     "type": "item",
                     "name": "minecraft:diamond_ore",
                     "functions": [
                        {
                           "function": "set_count",
                           "count": 5
                        },
                        {
                           "function": "set_count",
                           "count": 20,
                           "add": true
                        }
                     ]
                  }
               ]
            }
         ]
      }
      

            tryashtar [Mod] tryashtar
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              CHK: