3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-20 06:50:09 +01:00

Fix: Update inventory names (#4106)

Ensure inventory name updates used for e.g. JsonUI work properly.
Dieser Commit ist enthalten in:
chris 2023-09-09 00:13:57 +02:00 committet von GitHub
Ursprung acf24d4d6b
Commit 007edcbf11
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -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());
} }