3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-27 00:23:03 +01:00

Update latency translator for 1.20.10 (#3993)

Dieser Commit ist enthalten in:
Konicai 2023-07-17 14:45:45 -04:00 committet von GitHub
Ursprung c1d8009b40
Commit 396f4e4900
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 13 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -87,6 +87,10 @@ public final class GameProtocol {
return session.getUpstream().getProtocolVersion() < Bedrock_v589.CODEC.getProtocolVersion(); return session.getUpstream().getProtocolVersion() < Bedrock_v589.CODEC.getProtocolVersion();
} }
public static boolean isPre1_20_10(GeyserSession session) {
return session.getUpstream().getProtocolVersion() < Bedrock_v594.CODEC.getProtocolVersion();
}
/** /**
* Gets the {@link PacketCodec} for Minecraft: Java Edition. * Gets the {@link PacketCodec} for Minecraft: Java Edition.
* *

Datei anzeigen

@ -31,6 +31,7 @@ import org.cloudburstmc.protocol.bedrock.packet.NetworkStackLatencyPacket;
import org.cloudburstmc.protocol.bedrock.packet.UpdateAttributesPacket; import org.cloudburstmc.protocol.bedrock.packet.UpdateAttributesPacket;
import org.geysermc.floodgate.util.DeviceOs; import org.geysermc.floodgate.util.DeviceOs;
import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.entity.attribute.GeyserAttributeType;
import org.geysermc.geyser.network.GameProtocol;
import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.translator.protocol.PacketTranslator; import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator; import org.geysermc.geyser.translator.protocol.Translator;
@ -50,10 +51,15 @@ public class BedrockNetworkStackLatencyTranslator extends PacketTranslator<Netwo
// so apparently, as of 1.16.200 // so apparently, as of 1.16.200
// PS4 divides the network stack latency timestamp FOR US!!! // PS4 divides the network stack latency timestamp FOR US!!!
// WTF // WTF
if (session.getClientData().getDeviceOs().equals(DeviceOs.PS4)) { if (GameProtocol.isPre1_20_10(session)) {
pingId = packet.getTimestamp(); if (session.getClientData().getDeviceOs().equals(DeviceOs.PS4)) {
pingId = packet.getTimestamp();
} else {
pingId = packet.getTimestamp() / 1000;
}
} else { } else {
pingId = packet.getTimestamp() / 1000; // changed in 1.20.10 todo: is ps4 still different?
pingId = packet.getTimestamp() / (1000 * 1000 * 1000);
} }
// negative timestamps are used as hack to fix the url image loading bug // negative timestamps are used as hack to fix the url image loading bug