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

Loot table entry of type "dynamic" copies list reference rather than deep copying items

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.18.2 Release Candidate 1, 1.19.3, 23w04a
    • None
    • Confirmed
    • Loot tables
    • Low
    • Platform

      When using /loot replace ... to transfer the contents of a shulker box to another container (e.g. a chest) using this loot table (see below), the item list REFERENCE is transferred rather than the list contents being deep-copied. This results in a pair of "entangled" containers where removing any of the items from either container will result in the respective item being removed from the other.

      minecraft/loot_tables/blocks/shulker_box.json:

      {
        "type": "block",
        "pools": [
          {
            "rolls": 1,
            "entries": [
              { 
                "type": "dynamic", 
                "name": "contents"
              }
            ]
          }
        ]
      }
      

       

      Setup:

      • Create a world (a flat world will do)
      • Download this datapack and enable it in the world (it only contains the loot table in question)
      • Place down a shulker box and a chest
      • Place items inside the shulker box
      • Run this command: /loot replace block <CHEST coords> container.0 27 mine <SHULKER BOX coords>
      • See that the contents of the shulker box seem to have been copied to the chest.

      Observations:

       

      • When taking any items out of either the chest or the shulker box, the respective item will be removed from the other container, too
      • When destroying the chest (dropping all the items onto the ground), all the transferred items will no longer be in the shulker box
      • Putting items in either of the containers does not transfer them to the other, and they will not be deleted when either of the blocks is destroyed

        1. loot_command_bug_video_breaking_chest.mp4
          6.40 MB
          DorkOrc
        2. loot_command_bug_video_removing_items.mp4
          7.07 MB
          DorkOrc

            Unassigned Unassigned
            Deoxyribonucleic Evans DorkOrc
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              CHK: