From 38487c5bba0d2376312f663c47bbea906c32779e Mon Sep 17 00:00:00 2001 From: "Five (Xer)" Date: Sat, 23 May 2020 13:03:33 +0200 Subject: [PATCH] Server-change mechanics update --- .../client/ClientPlaySessionHandler.java | 15 +++++++++------ .../proxy/protocol/packet/Chat.java | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java index d0d21cbd8..d8e3d3718 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java @@ -334,12 +334,15 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { // to perform entity ID rewrites, eliminating potential issues from rewriting packets and // improving compatibility with mods. player.getMinecraftConnection().delayedWrite(joinGame); - int tempDim = joinGame.getDimension() == 0 ? -1 : 0; - player.getMinecraftConnection().delayedWrite( - new Respawn(tempDim, joinGame.getPartialHashedSeed(), joinGame.getDifficulty(), - joinGame.getGamemode(), joinGame.getLevelType(), joinGame.getShouldKeepPlayerData(), - joinGame.getIsDebug(), joinGame.getIsFlat(), - joinGame.getDimensionRegistryName())); + if (player.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_16) < 0) { + int tempDim = joinGame.getDimension() == 0 ? -1 : 0; + player.getMinecraftConnection().delayedWrite( + new Respawn(tempDim, joinGame.getPartialHashedSeed(), joinGame.getDifficulty(), + joinGame.getGamemode(), joinGame.getLevelType(), + joinGame.getShouldKeepPlayerData(), + joinGame.getIsDebug(), joinGame.getIsFlat(), + joinGame.getDimensionRegistryName())); + } player.getMinecraftConnection().delayedWrite( new Respawn(joinGame.getDimension(), joinGame.getPartialHashedSeed(), joinGame.getDifficulty(), joinGame.getGamemode(), joinGame.getLevelType(), diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Chat.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Chat.java index 61619d0e3..7905d7cab 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Chat.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/Chat.java @@ -86,7 +86,7 @@ public class Chat implements MinecraftPacket { ProtocolUtils.writeString(buf, message); if (direction == ProtocolUtils.Direction.CLIENTBOUND) { buf.writeByte(type); - if(version.compareTo(ProtocolVersion.MINECRAFT_1_16) >= 0) { + if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) >= 0) { ProtocolUtils.writeUuid(buf, sender == null ? EMPTY_SENDER : sender); } }