Skip to content

Commit 33f4d37

Browse files
Fix container close packets using id 0
The InventoryCloseEvent is fired in ServerPlayer#closeContainer before the container close packet is sent. However, InvUI's CustomContainerMenu#handleClosed unsets the active container menu while handling the event. This results in a close packet with id 0 being sent.
1 parent 002181d commit 33f4d37

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

invui/src/main/java/xyz/xenondevs/invui/internal/menu/CustomContainerMenu.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,6 @@ public void handleClosed() {
351351
serverPlayer.inventoryMenu.setRemoteSlotUnsafe(9 + i, item);
352352
}
353353
serverPlayer.inventoryMenu.setRemoteSlotUnsafe(OFF_HAND_SLOT, remoteOffHand);
354-
355-
serverPlayer.containerMenu = serverPlayer.inventoryMenu;
356354
}
357355

358356
/**
@@ -402,6 +400,7 @@ private void handleClose(ServerboundContainerClosePacket packet) {
402400

403401
if (getWindow().isCloseable()) {
404402
getWindowEvents().handleClose(InventoryCloseEvent.Reason.PLAYER);
403+
serverPlayer.containerMenu = serverPlayer.inventoryMenu;
405404
} else {
406405
sendOpenPacket(title);
407406
}

0 commit comments

Comments
 (0)