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

Creative survival inventory is not saved immediately when using pick-block

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.15.2, 20w08a, 1.16 Pre-release 3
    • None
    • Confirmed
    • (Unassigned)

       While attempting to make a datapack with middle-click detection, I encountered some strange behavior that prevented my code from working properly. After experimenting for a decent amount of time, I discovered the mechanics of a hidden buffer used when an item is displaced with pick-block when in creative mode.

      To access this buffer

      1) Be in creative mode

      2) Fill your hotbar with items

      3) Make sure you have at least one empty inventory space

      4) Use pick-block to put a new item in your hotbar, replacing a current one

      5) Congratulations! The item that was displaced has been stored in the buffer and is not part of your inventory data

      6) Open your inventory

      7) The buffer's contents are now placed back into your inventory

       

      This appears to be an intended behavior and to be related to the ability to pick blocks not in your inventory while in creative mode. However, it has some unintended side effects, as listed below.

      -Items in the buffer are stored in RAM and are not saved. When logging out and back in, they disappear. If you switched in a block that was in your inventory, the original copy stays behind as well.

      -Items in the buffer are assigned a slot when they are placed there. If you pick an item that is not in your inventory, then /give yourself an item or pick up an item, the copy placed into the buffer will not reappear as it can not overwrite the item in its slot.

      -If you instead pick up an item that is in your inventory, the buffered item is bound to that slot and that item. If that item is not there when you open your inventory (for example if you /clear it away) then the buffered item that would replace it does not appear.

      -The buffer is cleared when entering a block gui such as a chest or crafting table, with all items in it at the time being deleted. If you used pick-block to pull an item out of your inventory, you will now have 2 copies of that item, the new copy and the original copy

      -This is another intended behavior, with some visual glitches involved: When you have buffered items, switch your gamemode out of creative, then open your inventory the buffered items appear but are not copied over to NBT. Upon interacting with them, they will disappear. (I assume this is done to prevent item smuggling on servers with creative and survival areas)

      -This is the big one: Items stored in the buffer are not part of the player's NBT and can not be viewed or manipulated with commands. /data get can not sense them, /clear can not delete them.

            Unassigned Unassigned
            garlicbreath Garlicbreath
            Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: