From 359d1ea17cc06df8f75482b14c2d3b1b868ba897 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Thu, 26 Jul 2018 18:45:56 -0400 Subject: [PATCH] Fix transitions from dimensions when changing servers --- .../connection/client/ClientPlaySessionHandler.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java b/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java index 02dd4ba3b..969bd625e 100644 --- a/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java +++ b/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java @@ -90,14 +90,14 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { player.getConnection().write(joinGame); } else { // In order to handle switching to another server we will need send three packets: - // - The join game packet - // - A respawn packet, with a different dimension, if it differs + // - The join game packet from the backend server + // - A respawn packet with a different dimension // - Another respawn with the correct dimension + // We can't simply ignore the packet with the different dimension. If you try to be smart about it it doesn't + // work. player.getConnection().write(joinGame); - if (joinGame.getDimension() == currentDimension) { - int tempDim = joinGame.getDimension() == 0 ? -1 : 0; - player.getConnection().write(new Respawn(tempDim, joinGame.getDifficulty(), joinGame.getGamemode(), joinGame.getLevelType())); - } + int tempDim = joinGame.getDimension() == 0 ? -1 : 0; + player.getConnection().write(new Respawn(tempDim, joinGame.getDifficulty(), joinGame.getGamemode(), joinGame.getLevelType())); player.getConnection().write(new Respawn(joinGame.getDimension(), joinGame.getDifficulty(), joinGame.getGamemode(), joinGame.getLevelType())); currentDimension = joinGame.getDimension(); }