Fix: Inventory handling when client tries to open the player inventory when it shouldn't (#4499)

* attempt at fixing <https://github.com/GeyserMC/Geyser/issues/4497>

* Fix wrong handling of OPEN_INVENTORY case in BedrockInteractTranslator
This commit is contained in:
chris 2024-03-15 17:33:48 +01:00 committed by GitHub
parent c3d4277ae6
commit 112f4ddb8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -127,9 +127,9 @@ public class BedrockInteractTranslator extends PacketTranslator<InteractPacket>
InventoryUtils.openInventory(session, session.getPlayerInventory());
}
} else {
// Case: Player opens a player inventory, while we think it shouldn't have!
// Close all inventories, reset to player inventory.
InventoryUtils.closeInventory(session, session.getOpenInventory().getJavaId(), false);
// Case: Player tries to open a player inventory, while we think it should be in a different inventory
// Now: Open the inventory that we're supposed to be in.
InventoryUtils.openInventory(session, session.getOpenInventory());
}
break;
}