• Icon: Bug Bug
    • Resolution: Awaiting Response
    • None
    • 1.15.2, 20w06a
    • None
    • Community Consensus
    • Networking
    • Important
    • Platform

      The bug

      When transferring items in inventories, some desync issues can show up to create ghost items or have items disappear from the player inventory. When clicking on them or in empty slots, the items show back up or update to their corresponding correct states. The most common place they show up is a hopper transferring into a chest while a player edits the content. It's most easily spotted when non-stackable items are used. It also shows up in other instances and creates confusion.

      The most easy way to reproduce this bug is to feed a chest from a hopper with non-stackable items such as swords. If getting the timing right as to pickup one of the swords already in the chest just as a new sword is about to show up then the next sword that should show up never does. Clicking in that slot makes the invisible sword show back up.

      The bug is related to a hackfix found in ServerGamePacketListenerImpl.handleContainerClick around lines 1140.

      this.player.connection.send(new ClientboundContainerAckPacket(lvt1.getContainerId(), lvt1.getUid(), true));
      this.player.ignoreSlotUpdateHack = true;
      this.player.containerMenu.broadcastChanges();
      this.player.broadcastCarriedItem();
      this.player.ignoreSlotUpdateHack = false;
      

      The broadcastChanges method sends all inventory changes including any that was altered prior in the same gametick up to that point. ignoreSlotUpdateHack prevents any inventory update be sent to the client.

      Given that changes in inventories can be done in the same gametick before hitting this part of the code and having the updates get flushed when ignoreSlotUpdateHack is true results in some needed updates getting suppressed. Fix would be to flush out all updates, broadcastChanges before setting the flag true. Alternatively removing it altogether given its not exactly harmful to send 1 extra packet.

            Unassigned Unassigned
            Xcom6000 Xcom6000
            Votes:
            14 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: