mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-04 12:51:09 -05:00
Update for 20w45a
Notably: biome data is currently set to non-null as there is no full chunk indicator anymore.
This commit is contained in:
parent
7321e8f0d7
commit
ea3d99d0f9
6 changed files with 23 additions and 28 deletions
2
pom.xml
2
pom.xml
|
@ -5,7 +5,7 @@
|
|||
|
||||
<groupId>com.github.steveice10</groupId>
|
||||
<artifactId>mcprotocollib</artifactId>
|
||||
<version>1.16.4-SNAPSHOT</version>
|
||||
<version>20w45a-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>MCProtocolLib</name>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue