Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-25 15:50:19 +01:00
Reintroduce two-packet respawn sequence for older clients
Fixes #372
Dieser Commit ist enthalten in:
Ursprung
53b2400682
Commit
e20c37fcba
@ -1,6 +1,7 @@
|
|||||||
package com.velocitypowered.proxy.connection.client;
|
package com.velocitypowered.proxy.connection.client;
|
||||||
|
|
||||||
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_13;
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_13;
|
||||||
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_16;
|
||||||
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_8;
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_8;
|
||||||
import static com.velocitypowered.proxy.protocol.util.PluginMessageUtil.constructChannelsPacket;
|
import static com.velocitypowered.proxy.protocol.util.PluginMessageUtil.constructChannelsPacket;
|
||||||
|
|
||||||
@ -329,20 +330,18 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
// Most notably, by having the client accept the join game packet, we can work around the need
|
// Most notably, by having the client accept the join game packet, we can work around the need
|
||||||
// to perform entity ID rewrites, eliminating potential issues from rewriting packets and
|
// to perform entity ID rewrites, eliminating potential issues from rewriting packets and
|
||||||
// improving compatibility with mods.
|
// improving compatibility with mods.
|
||||||
player.getConnection().delayedWrite(joinGame);
|
|
||||||
// Since 1.16 this dynamic changed:
|
int sentOldDim = joinGame.getDimension();
|
||||||
// We don't need to send two dimension swiches anymore!
|
if (player.getProtocolVersion().compareTo(MINECRAFT_1_16) < 0) {
|
||||||
if (player.getProtocolVersion().compareTo(ProtocolVersion.MINECRAFT_1_16) < 0) {
|
// Before Minecraft 1.16, we could not switch to the same dimension without sending an
|
||||||
int tempDim = joinGame.getDimension() == 0 ? -1 : 0;
|
// additional respawn. On older versions of Minecraft this forces the client to perform
|
||||||
player.getConnection().delayedWrite(
|
// garbage collection which adds additional latency.
|
||||||
new Respawn(tempDim, joinGame.getPartialHashedSeed(), joinGame.getDifficulty(),
|
joinGame.setDimension(joinGame.getDimension() == 0 ? -1 : 0);
|
||||||
joinGame.getGamemode(), joinGame.getLevelType(),
|
|
||||||
false, joinGame.getDimensionInfo(), joinGame.getPreviousGamemode(),
|
|
||||||
joinGame.getCurrentDimensionData()));
|
|
||||||
}
|
}
|
||||||
|
player.getConnection().delayedWrite(joinGame);
|
||||||
|
|
||||||
player.getConnection().delayedWrite(
|
player.getConnection().delayedWrite(
|
||||||
new Respawn(joinGame.getDimension(), joinGame.getPartialHashedSeed(),
|
new Respawn(sentOldDim, joinGame.getPartialHashedSeed(),
|
||||||
joinGame.getDifficulty(), joinGame.getGamemode(), joinGame.getLevelType(),
|
joinGame.getDifficulty(), joinGame.getGamemode(), joinGame.getLevelType(),
|
||||||
false, joinGame.getDimensionInfo(), joinGame.getPreviousGamemode(),
|
false, joinGame.getDimensionInfo(), joinGame.getPreviousGamemode(),
|
||||||
joinGame.getCurrentDimensionData()));
|
joinGame.getCurrentDimensionData()));
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren