3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-09-29 06:30:16 +02:00
Dieser Commit ist enthalten in:
Gero 2023-05-13 09:59:55 +02:00
Ursprung e0cf2e211f
Commit 5ef90c46e3
3 geänderte Dateien mit 42 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -61,7 +61,8 @@ public enum ProtocolVersion {
MINECRAFT_1_19(759, "1.19"), MINECRAFT_1_19(759, "1.19"),
MINECRAFT_1_19_1(760, "1.19.1", "1.19.2"), MINECRAFT_1_19_1(760, "1.19.1", "1.19.2"),
MINECRAFT_1_19_3(761, "1.19.3"), MINECRAFT_1_19_3(761, "1.19.3"),
MINECRAFT_1_19_4(762, "1.19.4"); MINECRAFT_1_19_4(762, "1.19.4"),
MINECRAFT_1_20(763, "1.20");
private static final int SNAPSHOT_BIT = 30; private static final int SNAPSHOT_BIT = 30;

Datei anzeigen

@ -49,6 +49,7 @@ public class JoinGame implements MinecraftPacket {
private short previousGamemode; // 1.16+ private short previousGamemode; // 1.16+
private int simulationDistance; // 1.18+ private int simulationDistance; // 1.18+
private @Nullable Pair<String, Long> lastDeathPosition; // 1.19+ private @Nullable Pair<String, Long> lastDeathPosition; // 1.19+
private int portalCooldown; // 1.20+
public int getEntityId() { public int getEntityId() {
return entityId; return entityId;
@ -162,6 +163,14 @@ public class JoinGame implements MinecraftPacket {
this.lastDeathPosition = lastDeathPosition; this.lastDeathPosition = lastDeathPosition;
} }
public int getPortalCooldown() {
return portalCooldown;
}
public void setPortalCooldown(int portalCooldown) {
this.portalCooldown = portalCooldown;
}
public CompoundBinaryTag getRegistry() { public CompoundBinaryTag getRegistry() {
return registry; return registry;
} }
@ -187,6 +196,7 @@ public class JoinGame implements MinecraftPacket {
+ ", previousGamemode=" + previousGamemode + ", previousGamemode=" + previousGamemode
+ ", simulationDistance=" + simulationDistance + ", simulationDistance=" + simulationDistance
+ ", lastDeathPosition='" + lastDeathPosition + '\'' + ", lastDeathPosition='" + lastDeathPosition + '\''
+ ", portalCooldown=" + portalCooldown
+ '}'; + '}';
} }
@ -279,6 +289,10 @@ public class JoinGame implements MinecraftPacket {
if (version.compareTo(ProtocolVersion.MINECRAFT_1_19) >= 0 && buf.readBoolean()) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_19) >= 0 && buf.readBoolean()) {
this.lastDeathPosition = Pair.of(ProtocolUtils.readString(buf), buf.readLong()); this.lastDeathPosition = Pair.of(ProtocolUtils.readString(buf), buf.readLong());
} }
if (version.compareTo(ProtocolVersion.MINECRAFT_1_20) >= 0) {
this.portalCooldown = ProtocolUtils.readVarInt(buf);
}
} }
@Override @Override
@ -376,6 +390,10 @@ public class JoinGame implements MinecraftPacket {
buf.writeBoolean(false); buf.writeBoolean(false);
} }
} }
if (version.compareTo(ProtocolVersion.MINECRAFT_1_20) >= 0) {
ProtocolUtils.writeVarInt(buf, portalCooldown);
}
} }
@Override @Override

Datei anzeigen

@ -40,6 +40,7 @@ public class Respawn implements MinecraftPacket {
private short previousGamemode; // 1.16+ private short previousGamemode; // 1.16+
private CompoundBinaryTag currentDimensionData; // 1.16.2+ private CompoundBinaryTag currentDimensionData; // 1.16.2+
private @Nullable Pair<String, Long> lastDeathPosition; // 1.19+ private @Nullable Pair<String, Long> lastDeathPosition; // 1.19+
private int portalCooldown; // 1.20+
public Respawn() { public Respawn() {
} }
@ -47,7 +48,7 @@ public class Respawn implements MinecraftPacket {
public Respawn(int dimension, long partialHashedSeed, short difficulty, short gamemode, public Respawn(int dimension, long partialHashedSeed, short difficulty, short gamemode,
String levelType, byte dataToKeep, DimensionInfo dimensionInfo, String levelType, byte dataToKeep, DimensionInfo dimensionInfo,
short previousGamemode, CompoundBinaryTag currentDimensionData, short previousGamemode, CompoundBinaryTag currentDimensionData,
@Nullable Pair<String, Long> lastDeathPosition) { @Nullable Pair<String, Long> lastDeathPosition, int portalCooldown) {
this.dimension = dimension; this.dimension = dimension;
this.partialHashedSeed = partialHashedSeed; this.partialHashedSeed = partialHashedSeed;
this.difficulty = difficulty; this.difficulty = difficulty;
@ -58,13 +59,14 @@ public class Respawn implements MinecraftPacket {
this.previousGamemode = previousGamemode; this.previousGamemode = previousGamemode;
this.currentDimensionData = currentDimensionData; this.currentDimensionData = currentDimensionData;
this.lastDeathPosition = lastDeathPosition; this.lastDeathPosition = lastDeathPosition;
this.portalCooldown = portalCooldown;
} }
public static Respawn fromJoinGame(JoinGame joinGame) { public static Respawn fromJoinGame(JoinGame joinGame) {
return new Respawn(joinGame.getDimension(), joinGame.getPartialHashedSeed(), return new Respawn(joinGame.getDimension(), joinGame.getPartialHashedSeed(),
joinGame.getDifficulty(), joinGame.getGamemode(), joinGame.getLevelType(), joinGame.getDifficulty(), joinGame.getGamemode(), joinGame.getLevelType(),
(byte) 0, joinGame.getDimensionInfo(), joinGame.getPreviousGamemode(), (byte) 0, joinGame.getDimensionInfo(), joinGame.getPreviousGamemode(),
joinGame.getCurrentDimensionData(), joinGame.getLastDeathPosition()); joinGame.getCurrentDimensionData(), joinGame.getLastDeathPosition(), joinGame.getPortalCooldown());
} }
public int getDimension() { public int getDimension() {
@ -123,12 +125,20 @@ public class Respawn implements MinecraftPacket {
this.previousGamemode = previousGamemode; this.previousGamemode = previousGamemode;
} }
public Pair<String, Long> getLastDeathPosition() {
return lastDeathPosition;
}
public void setLastDeathPosition(Pair<String, Long> lastDeathPosition) { public void setLastDeathPosition(Pair<String, Long> lastDeathPosition) {
this.lastDeathPosition = lastDeathPosition; this.lastDeathPosition = lastDeathPosition;
} }
public Pair<String, Long> getLastDeathPosition() { public int getPortalCooldown() {
return lastDeathPosition; return portalCooldown;
}
public void setPortalCooldown(int portalCooldown) {
this.portalCooldown = portalCooldown;
} }
@Override @Override
@ -144,6 +154,7 @@ public class Respawn implements MinecraftPacket {
+ ", dimensionInfo=" + dimensionInfo + ", dimensionInfo=" + dimensionInfo
+ ", previousGamemode=" + previousGamemode + ", previousGamemode=" + previousGamemode
+ ", dimensionData=" + currentDimensionData + ", dimensionData=" + currentDimensionData
+ ", portalCooldown=" + portalCooldown
+ '}'; + '}';
} }
@ -188,6 +199,9 @@ public class Respawn implements MinecraftPacket {
if (version.compareTo(ProtocolVersion.MINECRAFT_1_19) >= 0 && buf.readBoolean()) { if (version.compareTo(ProtocolVersion.MINECRAFT_1_19) >= 0 && buf.readBoolean()) {
this.lastDeathPosition = Pair.of(ProtocolUtils.readString(buf), buf.readLong()); this.lastDeathPosition = Pair.of(ProtocolUtils.readString(buf), buf.readLong());
} }
if (version.compareTo(ProtocolVersion.MINECRAFT_1_20) >= 0) {
this.portalCooldown = ProtocolUtils.readVarInt(buf);
}
} }
@Override @Override
@ -234,6 +248,10 @@ public class Respawn implements MinecraftPacket {
buf.writeBoolean(false); buf.writeBoolean(false);
} }
} }
if (version.compareTo(ProtocolVersion.MINECRAFT_1_20) >= 0) {
ProtocolUtils.writeVarInt(buf, portalCooldown);
}
} }
@Override @Override