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

Inventory desync when clear and give command used with chain command blocks

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.2.9.1
    • None
    • Unconfirmed
    • Windows

      When clearing a players inventory of a certain item then giving another item, the first item does not show up until you force a manual update of the slot by trying to place something in the "empty" slot that actually has an item, but only if they didn't have the item to begin with. Slot count will remain 1 behind if you don't force an update.

      Steps to reproduce:
      1. Run "clear" command on yourself to make sure inventory state reset
      2. Give yourself a stack of gold_nugget items
      3. Place down a command block in impulse/need redstone mode, give it the command: "clear @p gold_nugget -1 2"
      4. Place down a command block with the first one pointing to it, put it in chain/conditional/always active mode, give it the command: "give @p spawn_egg 1 17"
      5. Put a button on the impulse command block, press it.

      Wether you are in creative or adventure mode, it should have taken 2 gold nuggets off you and given you a ghosted invisible spawn egg in the next logical inventory spot.

      You can confirm this by splitting the gold nugget stack and trying to place it where you would have expected the spawn egg to be, the game will then realize the issue and cancel the placement and actually show the spawn egg.

      Alternatively, you could just press the button a second time, and you will see you finally have 1 spawn egg, but its actually 2, select the spawn egg, press q to toss them, it'll cancel that action and show 2 spawn eggs now.

      After forcing a manual update, the problem appears to go away until you no longer have any of that item or have cleared your inventory.

      This is the only scenario I have found this issue, but also the only easy way I can trade 1 item for another as a form of currency so its a fairly major bug for what I need.

      Edit: appears to be mostly related to chain command blocks and use of clear command or maybe just multiple inventory based commands, if you replace the command from step 4 with "/enchant @p sharpness 3" and have a sword, the same type of issue happens, your sword doesnt appear enchanted until you try to move it in your inventory.

      Edit 2: the result message is also very weird for this type of clear command, despite filtering it for just a specific item for a specific count it will say stuff like "Cleared the inventory of NAME, removing 12 items", 12 items being the total count of everything I have, the code logic of the clear command probably needs a good cleanup.

            corosus Kevin Gagnon
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: