mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Update latency translator for 1.20.10 (#3993)
This commit is contained in:
parent
c1d8009b40
commit
396f4e4900
2 changed files with 13 additions and 3 deletions
|
@ -87,6 +87,10 @@ public final class GameProtocol {
|
|||
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.
|
||||
*
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.cloudburstmc.protocol.bedrock.packet.NetworkStackLatencyPacket;
|
|||
import org.cloudburstmc.protocol.bedrock.packet.UpdateAttributesPacket;
|
||||
import org.geysermc.floodgate.util.DeviceOs;
|
||||
import org.geysermc.geyser.entity.attribute.GeyserAttributeType;
|
||||
import org.geysermc.geyser.network.GameProtocol;
|
||||
import org.geysermc.geyser.session.GeyserSession;
|
||||
import org.geysermc.geyser.translator.protocol.PacketTranslator;
|
||||
import org.geysermc.geyser.translator.protocol.Translator;
|
||||
|
@ -50,10 +51,15 @@ public class BedrockNetworkStackLatencyTranslator extends PacketTranslator<Netwo
|
|||
// so apparently, as of 1.16.200
|
||||
// PS4 divides the network stack latency timestamp FOR US!!!
|
||||
// WTF
|
||||
if (session.getClientData().getDeviceOs().equals(DeviceOs.PS4)) {
|
||||
pingId = packet.getTimestamp();
|
||||
if (GameProtocol.isPre1_20_10(session)) {
|
||||
if (session.getClientData().getDeviceOs().equals(DeviceOs.PS4)) {
|
||||
pingId = packet.getTimestamp();
|
||||
} else {
|
||||
pingId = packet.getTimestamp() / 1000;
|
||||
}
|
||||
} 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
|
||||
|
|
Loading…
Reference in a new issue