From 6c4ca5f7a08143c6ace16f2c3002a5ccfd68d282 Mon Sep 17 00:00:00 2001 From: RootBeer Date: Sat, 14 Nov 2026 21:19:51 -0500 Subject: [PATCH] Ignore packets received after the window was closed If a packet closed the window, e.g. through a click handler, the packets queued behind it in the same tick were still processed on the closed window. Clicks could then take items that a close handler had already given back. --- .../xenondevs/invui/internal/menu/CustomContainerMenu.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/invui/src/main/java/xyz/xenondevs/invui/internal/menu/CustomContainerMenu.java b/invui/src/main/java/xyz/xenondevs/invui/internal/menu/CustomContainerMenu.java index 022eb1a4..6578d630 100644 --- a/invui/src/main/java/xyz/xenondevs/invui/internal/menu/CustomContainerMenu.java +++ b/invui/src/main/java/xyz/xenondevs/invui/internal/menu/CustomContainerMenu.java @@ -473,6 +473,10 @@ public UpdateType processIncoming() { Packet packet; UpdateType updateType = UpdateType.NONE; while ((packet = incoming.poll()) != null) { + if (serverPlayer.containerMenu != proxy) { // closed by a previous packet + incoming.clear(); + break; + } updateType = updateType.or(processPacket(packet)); }