Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-16 21:10:30 +01:00
fix: Respawn
packet codec for 1.20.2+ (#1156)
Dieser Commit ist enthalten in:
Ursprung
b270206d2e
Commit
c8ca28cd30
@ -186,12 +186,10 @@ public class Respawn implements MinecraftPacket {
|
||||
boolean isDebug = buf.readBoolean();
|
||||
boolean isFlat = buf.readBoolean();
|
||||
this.dimensionInfo = new DimensionInfo(dimensionIdentifier, levelName, isFlat, isDebug);
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_19_3) >= 0) {
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_19_3) < 0) {
|
||||
this.dataToKeep = (byte) (buf.readBoolean() ? 1 : 0);
|
||||
} else if (version.compareTo(ProtocolVersion.MINECRAFT_1_20_2) < 0) {
|
||||
this.dataToKeep = buf.readByte();
|
||||
} else if (buf.readBoolean()) {
|
||||
this.dataToKeep = 1;
|
||||
} else {
|
||||
this.dataToKeep = 0;
|
||||
}
|
||||
} else {
|
||||
this.levelType = ProtocolUtils.readString(buf, 16);
|
||||
@ -202,6 +200,9 @@ public class Respawn implements MinecraftPacket {
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_20) >= 0) {
|
||||
this.portalCooldown = ProtocolUtils.readVarInt(buf);
|
||||
}
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_20_2) >= 0) {
|
||||
this.dataToKeep = buf.readByte();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -229,10 +230,10 @@ public class Respawn implements MinecraftPacket {
|
||||
buf.writeByte(previousGamemode);
|
||||
buf.writeBoolean(dimensionInfo.isDebugType());
|
||||
buf.writeBoolean(dimensionInfo.isFlat());
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_19_3) >= 0) {
|
||||
buf.writeByte(dataToKeep);
|
||||
} else {
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_19_3) < 0) {
|
||||
buf.writeBoolean(dataToKeep != 0);
|
||||
} else if (version.compareTo(ProtocolVersion.MINECRAFT_1_20_2) < 0) {
|
||||
buf.writeByte(dataToKeep);
|
||||
}
|
||||
} else {
|
||||
ProtocolUtils.writeString(buf, levelType);
|
||||
@ -252,6 +253,10 @@ public class Respawn implements MinecraftPacket {
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_20) >= 0) {
|
||||
ProtocolUtils.writeVarInt(buf, portalCooldown);
|
||||
}
|
||||
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_20_2) >= 0) {
|
||||
buf.writeByte(dataToKeep);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren