mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix: Update inventory names (#4106)
Ensure inventory name updates used for e.g. JsonUI work properly.
This commit is contained in:
parent
acf24d4d6b
commit
007edcbf11
1 changed files with 2 additions and 1 deletions
|
@ -73,7 +73,8 @@ public class JavaOpenScreenTranslator extends PacketTranslator<ClientboundOpenSc
|
||||||
if (openInventory != null) {
|
if (openInventory != null) {
|
||||||
// If the window type is the same, don't close.
|
// If the window type is the same, don't close.
|
||||||
// In rare cases, inventories can do funny things where it keeps the same window type up but change the contents.
|
// In rare cases, inventories can do funny things where it keeps the same window type up but change the contents.
|
||||||
if (openInventory.getContainerType() != packet.getType()) {
|
// Or, inventory names can change (useful for JsonUI). In these cases, we need to close the old inventory.
|
||||||
|
if (openInventory.getContainerType() != packet.getType() || !openInventory.getTitle().equals(name)) {
|
||||||
// Sometimes the server can double-open an inventory with the same ID - don't confirm in that instance.
|
// Sometimes the server can double-open an inventory with the same ID - don't confirm in that instance.
|
||||||
InventoryUtils.closeInventory(session, openInventory.getJavaId(), openInventory.getJavaId() != packet.getContainerId());
|
InventoryUtils.closeInventory(session, openInventory.getJavaId(), openInventory.getJavaId() != packet.getContainerId());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue