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

Client misses inventory updates while player is manipulating items - causes invisible items

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 21w10a
    • Minecraft 1.6.2, Minecraft 14w30c, Minecraft 1.8.1, Minecraft 1.8.2-pre6, Minecraft 15w44b, Minecraft 1.8.9, Minecraft 16w05b, Minecraft 1.9 Pre-Release 4, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 1, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.9.4, Minecraft 1.10.2, Minecraft 16w35a, Minecraft 16w36a, Minecraft 16w39c, Minecraft 1.12, Minecraft 1.12.2, Minecraft 18w14b, Minecraft 1.13-pre2, Minecraft 1.13-pre5, Minecraft 1.13-pre6, Minecraft 1.13-pre8, Minecraft 1.13, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w48a, Minecraft 18w48b, Minecraft 18w49a, Minecraft 1.14 Pre-Release 1, Minecraft 1.14, Minecraft 1.14.1 Pre-Release 2, Minecraft 1.14.2, Minecraft 1.14.3, 1.14.4, 19w35a, 19w37a, 1.15.1, 1.15.2, 20w07a, 20w17a, 20w18a, 20w20b, 20w21a, 20w30a, 1.16.2, 1.16.3, 20w46a, 20w51a
    • Confirmed
    • Networking
    • Important

      The bug

      When using whatever container that automatically updates the contents of a slot (like a furnace) and if the player, with the container GUI open, is constantly moving items into the inventory, the player won't see the container slot update (like a raw steak being cooked).

      How to reproduce

      1. Open the furnace gui
      2. Place charcoal/coal and keep some item in your inventory
      3. Place something to be cooked into the furnace
      4. When the progress bar is almost at the end, start continuously left clicking an item in the inventory

      What should happen is that the item to be cooked doesn't update (if it doesn't happen the first time, just retry), the progress bar has finished, and you won't have any item in the output slot, but if you click in it you will get the item cooked.



      This also occurs with the /replaceitem command:

      How to reproduce

      1. Put a command block on a clock, with a command such as:
        /replaceitem entity @p inventory.0 golden_apple
        

        → This will put a golden apple in the first slot of your inventory

      2. Open your inventory, and move the golden apple to another slot
      3. As soon as a new one appears, grab it and move it to another slot as well
        → If you got the timing right, the slot will appear blank, even though the command block output in the chat window continues to say "[@: Replaced slot 9 with 1 x [Golden Apple]]"
      4. Turn off the clock
      5. Exit the world
      6. Re-enter the world, and open your inventory
        → There will be a golden apple in the first slot

      Why this happens:

      This happen because there's a boolean in EntityPlayerMP that's set to true when the server receives a window click packet and then there the function that should send the slot updates is called, though if this boolean is true it will not send the packet to the client to update it (while the server-side thinks from the next update on that the client has received the update).
      Basically if the server code updates the content of some slots in the container (raw food to be removed, output slot set to cooked food) while the player is moving other items in the inventory.. it won't get the update.

      So one way to fix this would be to know which slot is getting modified by player and block the updates only for that slot and not all the container slots. Another way would be having a resend list where clients that didn't got a certain slot update, get a resend of the packet from the server.

            boq [Mojang] Bartosz Bok
            smjert Stefano Bonicatti
            Votes:
            39 Vote for this issue
            Watchers:
            22 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: