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

SetSlot packet can no longer set item under cursor



    • Bug
    • Status: Resolved
    • Resolution: Fixed
    • Minecraft 1.7.2, Minecraft 13w48b
    • Minecraft 13w49a
    • None
    • Unconfirmed


      In 1.6.4, sending a SetSlot packet (0x2F in 1.7.2, 0x67 in 1.6.4) with window id ( the first byte ) set to -1 would allow the server to set the item displayed under the mouse cursor while the client was in an inventory window.

      This no longer works in 1.7.2. Without the ability to change the item under the cursor, Bukkit can't cancel Inventory events. This has the effect of breaking all plugins that use the "Inventory as a menu" system. After looking at a decompilation of the client source, it appears to be a pretty easy fix.

      In the client code, when the Packet class for SetSlot reads from the network, it now reads the first byte as unsigned and saves the results as an integer.

       public void read(ep in)
          this.a = in.readUnsignedByte();
          this.b = in.readShort();
          this.c = in.c();

      When the packet is processed, the code that checks if the window is -1 is still there, but because the data is now read as unsigned, we should check for the value 255 instead of -1;

       public void a(gh pgh) {
        bje lbje = this.f.h;
        if (pgh.getA() == -1) {
            lbje.bn.b(pgh.e());  //This sets the item under the cursor.
        } else {




            dinnerbone [Mojang] Nathan Adams
            basicer Rob Blanckaert
            10 Vote for this issue
            4 Start watching this issue