Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-24 15:20:35 +01:00
Changes 1.16-pre6
Dieser Commit ist enthalten in:
Ursprung
6577b08bdd
Commit
a1ab29186b
@ -35,7 +35,7 @@ public enum ProtocolVersion {
|
||||
MINECRAFT_1_15(573, "1.15"),
|
||||
MINECRAFT_1_15_1(575, "1.15.1"),
|
||||
MINECRAFT_1_15_2(578, "1.15.2"),
|
||||
MINECRAFT_1_16(729, "1.16");
|
||||
MINECRAFT_1_16(730, "1.16");
|
||||
|
||||
private final int protocol;
|
||||
private final String name;
|
||||
|
@ -339,13 +339,13 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
||||
player.getMinecraftConnection().delayedWrite(
|
||||
new Respawn(tempDim, joinGame.getPartialHashedSeed(), joinGame.getDifficulty(),
|
||||
joinGame.getGamemode(), joinGame.getLevelType(),
|
||||
false, joinGame.getDimensionInfo()));
|
||||
false, joinGame.getDimensionInfo(), joinGame.getPreviousGamemode()));
|
||||
}
|
||||
|
||||
player.getMinecraftConnection().delayedWrite(
|
||||
new Respawn(joinGame.getDimension(), joinGame.getPartialHashedSeed(),
|
||||
joinGame.getDifficulty(), joinGame.getGamemode(), joinGame.getLevelType(),
|
||||
false, joinGame.getDimensionInfo()));
|
||||
false, joinGame.getDimensionInfo(), joinGame.getPreviousGamemode()));
|
||||
|
||||
destination.setActiveDimensionRegistry(joinGame.getDimensionRegistry()); // 1.16
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ public class JoinGame implements MinecraftPacket {
|
||||
private boolean showRespawnScreen;
|
||||
private DimensionRegistry dimensionRegistry; // 1.16+
|
||||
private DimensionInfo dimensionInfo; // 1.16+
|
||||
private short previousGamemode; // 1.16+
|
||||
|
||||
public int getEntityId() {
|
||||
return entityId;
|
||||
@ -69,10 +70,7 @@ public class JoinGame implements MinecraftPacket {
|
||||
this.maxPlayers = maxPlayers;
|
||||
}
|
||||
|
||||
public String getLevelType() {
|
||||
if (levelType == null) {
|
||||
throw new IllegalStateException("No level type specified.");
|
||||
}
|
||||
public @Nullable String getLevelType() {
|
||||
return levelType;
|
||||
}
|
||||
|
||||
@ -112,6 +110,14 @@ public class JoinGame implements MinecraftPacket {
|
||||
this.dimensionRegistry = dimensionRegistry;
|
||||
}
|
||||
|
||||
public short getPreviousGamemode() {
|
||||
return previousGamemode;
|
||||
}
|
||||
|
||||
public void setPreviousGamemode(short previousGamemode) {
|
||||
this.previousGamemode = previousGamemode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "JoinGame{"
|
||||
@ -126,16 +132,18 @@ public class JoinGame implements MinecraftPacket {
|
||||
+ ", reducedDebugInfo=" + reducedDebugInfo
|
||||
+ ", dimensionRegistry='" + dimensionRegistry.toString() + '\''
|
||||
+ ", dimensionInfo='" + dimensionInfo.toString() + '\''
|
||||
+ ", previousGamemode=" + previousGamemode
|
||||
+ '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||
this.entityId = buf.readInt();
|
||||
this.gamemode = buf.readUnsignedByte();
|
||||
this.gamemode = buf.readByte();
|
||||
String dimensionIdentifier = null;
|
||||
String levelName = null;
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) >= 0) {
|
||||
this.previousGamemode = buf.readByte();
|
||||
ImmutableSet<String> levelNames = ImmutableSet.copyOf(ProtocolUtils.readStringArray(buf));
|
||||
ImmutableSet<DimensionData> readData = DimensionRegistry.fromGameData(ProtocolUtils.readCompoundTag(buf));
|
||||
this.dimensionRegistry = new DimensionRegistry(readData, levelNames);
|
||||
@ -155,8 +163,6 @@ public class JoinGame implements MinecraftPacket {
|
||||
this.maxPlayers = buf.readUnsignedByte();
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) < 0) {
|
||||
this.levelType = ProtocolUtils.readString(buf, 16);
|
||||
} else {
|
||||
this.levelType = "default"; // I didn't have the courage to rework this yet.
|
||||
}
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_14) >= 0) {
|
||||
this.viewDistance = ProtocolUtils.readVarInt(buf);
|
||||
@ -177,6 +183,7 @@ public class JoinGame implements MinecraftPacket {
|
||||
buf.writeInt(entityId);
|
||||
buf.writeByte(gamemode);
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) >= 0) {
|
||||
buf.writeByte(previousGamemode);
|
||||
ProtocolUtils.writeStringArray(buf, dimensionRegistry.getLevelNames().toArray(
|
||||
new String[dimensionRegistry.getLevelNames().size()]));
|
||||
ProtocolUtils.writeCompoundTag(buf, dimensionRegistry.encodeRegistry());
|
||||
|
@ -15,13 +15,15 @@ public class Respawn implements MinecraftPacket {
|
||||
private short gamemode;
|
||||
private String levelType = "";
|
||||
private boolean shouldKeepPlayerData; // 1.16+
|
||||
private DimensionInfo dimensionInfo;
|
||||
private DimensionInfo dimensionInfo; // 1.16+
|
||||
private short previousGamemode; // 1.16+
|
||||
|
||||
public Respawn() {
|
||||
}
|
||||
|
||||
public Respawn(int dimension, long partialHashedSeed, short difficulty, short gamemode,
|
||||
String levelType, boolean shouldKeepPlayerData, DimensionInfo dimensionInfo) {
|
||||
String levelType, boolean shouldKeepPlayerData, DimensionInfo dimensionInfo,
|
||||
short previousGamemode) {
|
||||
this.dimension = dimension;
|
||||
this.partialHashedSeed = partialHashedSeed;
|
||||
this.difficulty = difficulty;
|
||||
@ -29,6 +31,7 @@ public class Respawn implements MinecraftPacket {
|
||||
this.levelType = levelType;
|
||||
this.shouldKeepPlayerData = shouldKeepPlayerData;
|
||||
this.dimensionInfo = dimensionInfo;
|
||||
this.previousGamemode = previousGamemode;
|
||||
}
|
||||
|
||||
public int getDimension() {
|
||||
@ -79,6 +82,14 @@ public class Respawn implements MinecraftPacket {
|
||||
this.shouldKeepPlayerData = shouldKeepPlayerData;
|
||||
}
|
||||
|
||||
public short getPreviousGamemode() {
|
||||
return previousGamemode;
|
||||
}
|
||||
|
||||
public void setPreviousGamemode(short previousGamemode) {
|
||||
this.previousGamemode = previousGamemode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Respawn{"
|
||||
@ -89,6 +100,7 @@ public class Respawn implements MinecraftPacket {
|
||||
+ ", levelType='" + levelType + '\''
|
||||
+ ", shouldKeepPlayerData=" + shouldKeepPlayerData
|
||||
+ ", dimensionRegistryName='" + dimensionInfo.toString() + '\''
|
||||
+ ", previousGamemode=" + previousGamemode
|
||||
+ '}';
|
||||
}
|
||||
|
||||
@ -108,8 +120,9 @@ public class Respawn implements MinecraftPacket {
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_15) >= 0) {
|
||||
this.partialHashedSeed = buf.readLong();
|
||||
}
|
||||
this.gamemode = buf.readUnsignedByte();
|
||||
this.gamemode = buf.readByte();
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) >= 0) {
|
||||
this.previousGamemode = buf.readByte();
|
||||
boolean isDebug = buf.readBoolean();
|
||||
boolean isFlat = buf.readBoolean();
|
||||
this.dimensionInfo = new DimensionInfo(dimensionIdentifier, levelName, isFlat, isDebug);
|
||||
@ -135,6 +148,7 @@ public class Respawn implements MinecraftPacket {
|
||||
}
|
||||
buf.writeByte(gamemode);
|
||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) >= 0) {
|
||||
buf.writeByte(previousGamemode);
|
||||
buf.writeBoolean(dimensionInfo.isDebugType());
|
||||
buf.writeBoolean(dimensionInfo.isFlat());
|
||||
buf.writeBoolean(shouldKeepPlayerData);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren