3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-19 14:30:17 +01:00

Don't send inventories to the client before initialization

Fixes #2677
Dieser Commit ist enthalten in:
Camotoy 2021-12-07 14:51:58 -05:00
Ursprung 2953ea9513
Commit b0baf1670d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
2 geänderte Dateien mit 11 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -30,6 +30,7 @@ import org.geysermc.geyser.session.auth.AuthType;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator;
import org.geysermc.geyser.util.InventoryUtils;
import org.geysermc.geyser.util.LoginEncryptionUtils;
@Translator(packet = SetLocalPlayerAsInitializedPacket.class)
@ -47,8 +48,13 @@ public class BedrockSetLocalPlayerAsInitializedTranslator extends PacketTranslat
// else we were able to log the user in
}
if (session.isLoggedIn()) {
// Sigh
// Sigh - as of Bedrock 1.18
session.getEntityCache().updateBossBars();
// Double sigh - https://github.com/GeyserMC/Geyser/issues/2677 - as of Bedrock 1.18
if (session.getOpenInventory() != null && session.getOpenInventory().isPending()) {
InventoryUtils.openInventory(session, session.getOpenInventory());
}
}
}
}

Datei anzeigen

@ -66,9 +66,10 @@ public class InventoryUtils {
public static void openInventory(GeyserSession session, Inventory inventory) {
session.setOpenInventory(inventory);
if (session.isClosingInventory()) {
//Wait for close confirmation from client before opening the new inventory.
//Handled in BedrockContainerCloseTranslator
if (session.isClosingInventory() || !session.getUpstream().isInitialized()) {
// Wait for close confirmation from client before opening the new inventory.
// Handled in BedrockContainerCloseTranslator
// or - client hasn't yet loaded in; wait until inventory is shown
inventory.setPending(true);
return;
}