diff --git a/pom.xml b/pom.xml index d4e5f7ac..c8476c29 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.github.steveice10 mcprotocollib - 1.16.4-SNAPSHOT + 20w45a-SNAPSHOT jar MCProtocolLib diff --git a/src/main/java/com/github/steveice10/mc/protocol/MinecraftConstants.java b/src/main/java/com/github/steveice10/mc/protocol/MinecraftConstants.java index 3c2655eb..d70cdf44 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/MinecraftConstants.java +++ b/src/main/java/com/github/steveice10/mc/protocol/MinecraftConstants.java @@ -12,12 +12,12 @@ public final class MinecraftConstants { /** * Current supported game version. */ - public static final String GAME_VERSION = "1.16.4"; + public static final String GAME_VERSION = "20w45a"; /** * Current supported protocol version. */ - public static final int PROTOCOL_VERSION = 754; + public static final int PROTOCOL_VERSION = (1 << 30) | 5; // General Key Constants diff --git a/src/main/java/com/github/steveice10/mc/protocol/data/game/chunk/Column.java b/src/main/java/com/github/steveice10/mc/protocol/data/game/chunk/Column.java index 1313f889..8a945cfa 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/data/game/chunk/Column.java +++ b/src/main/java/com/github/steveice10/mc/protocol/data/game/chunk/Column.java @@ -13,13 +13,13 @@ public class Column { private final @NonNull Chunk[] chunks; private final @NonNull CompoundTag[] tileEntities; private final @NonNull CompoundTag heightMaps; - private final int[] biomeData; + private final @NonNull int[] biomeData; public Column(int x, int z, @NonNull Chunk[] chunks, @NonNull CompoundTag[] tileEntities, @NonNull CompoundTag heightMaps) { - this(x, z, chunks, tileEntities, heightMaps, null); + this(x, z, chunks, tileEntities, heightMaps, new int[0]); } - public Column(int x, int z, @NonNull Chunk[] chunks, @NonNull CompoundTag[] tileEntities, @NonNull CompoundTag heightMaps, int[] biomeData) { + public Column(int x, int z, @NonNull Chunk[] chunks, @NonNull CompoundTag[] tileEntities, @NonNull CompoundTag heightMaps, @NonNull int[] biomeData) { if(chunks.length != 16) { throw new IllegalArgumentException("Chunk array length must be 16."); } diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/ServerResourcePackSendPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/ServerResourcePackSendPacket.java index 8f45ab2d..674518a6 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/ServerResourcePackSendPacket.java +++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/ServerResourcePackSendPacket.java @@ -19,17 +19,20 @@ import java.io.IOException; public class ServerResourcePackSendPacket implements Packet { private @NonNull String url; private @NonNull String hash; + private boolean mustAcceptPack; @Override public void read(NetInput in) throws IOException { this.url = in.readString(); this.hash = in.readString(); + this.mustAcceptPack = in.readBoolean(); } @Override public void write(NetOutput out) throws IOException { out.writeString(this.url); out.writeString(this.hash); + out.writeBoolean(this.mustAcceptPack); } @Override diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/world/ServerChunkDataPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/world/ServerChunkDataPacket.java index e45cbbe2..1d59bb5f 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/world/ServerChunkDataPacket.java +++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/world/ServerChunkDataPacket.java @@ -31,14 +31,11 @@ public class ServerChunkDataPacket implements Packet { public void read(NetInput in) throws IOException { int x = in.readInt(); int z = in.readInt(); - boolean fullChunk = in.readBoolean(); int chunkMask = in.readVarInt(); CompoundTag heightMaps = NBT.read(in); - int[] biomeData = fullChunk ? new int[in.readVarInt()] : null; - if (fullChunk) { - for (int index = 0; index < biomeData.length; index++) { - biomeData[index] = in.readVarInt(); - } + int[] biomeData = new int[in.readVarInt()]; + for (int index = 0; index < biomeData.length; index++) { + biomeData[index] = in.readVarInt(); } byte[] data = in.readBytes(in.readVarInt()); @@ -73,18 +70,13 @@ public class ServerChunkDataPacket implements Packet { } } - boolean fullChunk = this.column.getBiomeData() != null; - out.writeInt(this.column.getX()); out.writeInt(this.column.getZ()); - out.writeBoolean(fullChunk); out.writeVarInt(mask); NBT.write(out, this.column.getHeightMaps()); - if (fullChunk) { - out.writeVarInt(this.column.getBiomeData().length); - for (int biomeData : this.column.getBiomeData()) { - out.writeVarInt(biomeData); - } + out.writeVarInt(this.column.getBiomeData().length); + for (int biomeData : this.column.getBiomeData()) { + out.writeVarInt(biomeData); } out.writeVarInt(dataBytes.size()); out.writeBytes(dataBytes.toByteArray(), dataBytes.size()); diff --git a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/world/ServerUpdateLightPacket.java b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/world/ServerUpdateLightPacket.java index 1e644d72..8a97eb66 100644 --- a/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/world/ServerUpdateLightPacket.java +++ b/src/main/java/com/github/steveice10/mc/protocol/packet/ingame/server/world/ServerUpdateLightPacket.java @@ -49,10 +49,10 @@ public class ServerUpdateLightPacket implements Packet { this.z = in.readVarInt(); this.trustEdges = in.readBoolean(); - int skyLightMask = in.readVarInt(); - int blockLightMask = in.readVarInt(); - int emptySkyLightMask = in.readVarInt(); - int emptyBlockLightMask = in.readVarInt(); + long skyLightMask = in.readVarLong(); + long blockLightMask = in.readVarLong(); + long emptySkyLightMask = in.readVarLong(); + long emptyBlockLightMask = in.readVarLong(); this.skyLight = new NibbleArray3d[NUM_ENTRIES]; for (int i = 0; i < NUM_ENTRIES; i++) { @@ -108,10 +108,10 @@ public class ServerUpdateLightPacket implements Packet { } } - out.writeVarInt(skyLightMask); - out.writeVarInt(blockLightMask); - out.writeVarInt(emptySkyLightMask); - out.writeVarInt(emptyBlockLightMask); + out.writeVarLong(skyLightMask); + out.writeVarLong(blockLightMask); + out.writeVarLong(emptySkyLightMask); + out.writeVarLong(emptyBlockLightMask); for(int i = 0; i < NUM_ENTRIES; i++) { if((skyLightMask & 1 << i) != 0) {