13
0
geforkt von Mirrors/Velocity

Fix transitions from dimensions when changing servers

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-07-26 18:45:56 -04:00
Ursprung 0f7489beb7
Commit 359d1ea17c

Datei anzeigen

@ -90,14 +90,14 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
player.getConnection().write(joinGame); player.getConnection().write(joinGame);
} else { } else {
// In order to handle switching to another server we will need send three packets: // In order to handle switching to another server we will need send three packets:
// - The join game packet // - The join game packet from the backend server
// - A respawn packet, with a different dimension, if it differs // - A respawn packet with a different dimension
// - Another respawn with the correct 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); player.getConnection().write(joinGame);
if (joinGame.getDimension() == currentDimension) { int tempDim = joinGame.getDimension() == 0 ? -1 : 0;
int tempDim = joinGame.getDimension() == 0 ? -1 : 0; player.getConnection().write(new Respawn(tempDim, joinGame.getDifficulty(), joinGame.getGamemode(), joinGame.getLevelType()));
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())); player.getConnection().write(new Respawn(joinGame.getDimension(), joinGame.getDifficulty(), joinGame.getGamemode(), joinGame.getLevelType()));
currentDimension = joinGame.getDimension(); currentDimension = joinGame.getDimension();
} }