13
0
geforkt von Mirrors/Velocity
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_1(760, "1.19.1", "1.19.2"),
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;

Datei anzeigen

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

Datei anzeigen

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