13
0
geforkt von Mirrors/Velocity

Changes 1.16-pre6

Dieser Commit ist enthalten in:
Five (Xer) 2020-06-16 17:56:56 +02:00
Ursprung 6577b08bdd
Commit a1ab29186b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: A3F306B10E6330E7
4 geänderte Dateien mit 34 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -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;

Datei anzeigen

@ -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
}

Datei anzeigen

@ -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());

Datei anzeigen

@ -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);