mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-04 21:01:02 -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>
|
<groupId>com.github.steveice10</groupId>
|
||||||
<artifactId>mcprotocollib</artifactId>
|
<artifactId>mcprotocollib</artifactId>
|
||||||
<version>1.16.4-SNAPSHOT</version>
|
<version>20w45a-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>MCProtocolLib</name>
|
<name>MCProtocolLib</name>
|
||||||
|
|
|
@ -12,12 +12,12 @@ public final class MinecraftConstants {
|
||||||
/**
|
/**
|
||||||
* Current supported game version.
|
* Current supported game version.
|
||||||
*/
|
*/
|
||||||
public static final String GAME_VERSION = "1.16.4";
|
public static final String GAME_VERSION = "20w45a";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current supported protocol version.
|
* Current supported protocol version.
|
||||||
*/
|
*/
|
||||||
public static final int PROTOCOL_VERSION = 754;
|
public static final int PROTOCOL_VERSION = (1 << 30) | 5;
|
||||||
|
|
||||||
// General Key Constants
|
// General Key Constants
|
||||||
|
|
||||||
|
|
|
@ -13,13 +13,13 @@ public class Column {
|
||||||
private final @NonNull Chunk[] chunks;
|
private final @NonNull Chunk[] chunks;
|
||||||
private final @NonNull CompoundTag[] tileEntities;
|
private final @NonNull CompoundTag[] tileEntities;
|
||||||
private final @NonNull CompoundTag heightMaps;
|
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) {
|
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) {
|
if(chunks.length != 16) {
|
||||||
throw new IllegalArgumentException("Chunk array length must be 16.");
|
throw new IllegalArgumentException("Chunk array length must be 16.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,17 +19,20 @@ import java.io.IOException;
|
||||||
public class ServerResourcePackSendPacket implements Packet {
|
public class ServerResourcePackSendPacket implements Packet {
|
||||||
private @NonNull String url;
|
private @NonNull String url;
|
||||||
private @NonNull String hash;
|
private @NonNull String hash;
|
||||||
|
private boolean mustAcceptPack;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(NetInput in) throws IOException {
|
public void read(NetInput in) throws IOException {
|
||||||
this.url = in.readString();
|
this.url = in.readString();
|
||||||
this.hash = in.readString();
|
this.hash = in.readString();
|
||||||
|
this.mustAcceptPack = in.readBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(NetOutput out) throws IOException {
|
public void write(NetOutput out) throws IOException {
|
||||||
out.writeString(this.url);
|
out.writeString(this.url);
|
||||||
out.writeString(this.hash);
|
out.writeString(this.hash);
|
||||||
|
out.writeBoolean(this.mustAcceptPack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,14 +31,11 @@ public class ServerChunkDataPacket implements Packet {
|
||||||
public void read(NetInput in) throws IOException {
|
public void read(NetInput in) throws IOException {
|
||||||
int x = in.readInt();
|
int x = in.readInt();
|
||||||
int z = in.readInt();
|
int z = in.readInt();
|
||||||
boolean fullChunk = in.readBoolean();
|
|
||||||
int chunkMask = in.readVarInt();
|
int chunkMask = in.readVarInt();
|
||||||
CompoundTag heightMaps = NBT.read(in);
|
CompoundTag heightMaps = NBT.read(in);
|
||||||
int[] biomeData = fullChunk ? new int[in.readVarInt()] : null;
|
int[] biomeData = new int[in.readVarInt()];
|
||||||
if (fullChunk) {
|
for (int index = 0; index < biomeData.length; index++) {
|
||||||
for (int index = 0; index < biomeData.length; index++) {
|
biomeData[index] = in.readVarInt();
|
||||||
biomeData[index] = in.readVarInt();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
byte[] data = in.readBytes(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.getX());
|
||||||
out.writeInt(this.column.getZ());
|
out.writeInt(this.column.getZ());
|
||||||
out.writeBoolean(fullChunk);
|
|
||||||
out.writeVarInt(mask);
|
out.writeVarInt(mask);
|
||||||
NBT.write(out, this.column.getHeightMaps());
|
NBT.write(out, this.column.getHeightMaps());
|
||||||
if (fullChunk) {
|
out.writeVarInt(this.column.getBiomeData().length);
|
||||||
out.writeVarInt(this.column.getBiomeData().length);
|
for (int biomeData : this.column.getBiomeData()) {
|
||||||
for (int biomeData : this.column.getBiomeData()) {
|
out.writeVarInt(biomeData);
|
||||||
out.writeVarInt(biomeData);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
out.writeVarInt(dataBytes.size());
|
out.writeVarInt(dataBytes.size());
|
||||||
out.writeBytes(dataBytes.toByteArray(), dataBytes.size());
|
out.writeBytes(dataBytes.toByteArray(), dataBytes.size());
|
||||||
|
|
|
@ -49,10 +49,10 @@ public class ServerUpdateLightPacket implements Packet {
|
||||||
this.z = in.readVarInt();
|
this.z = in.readVarInt();
|
||||||
this.trustEdges = in.readBoolean();
|
this.trustEdges = in.readBoolean();
|
||||||
|
|
||||||
int skyLightMask = in.readVarInt();
|
long skyLightMask = in.readVarLong();
|
||||||
int blockLightMask = in.readVarInt();
|
long blockLightMask = in.readVarLong();
|
||||||
int emptySkyLightMask = in.readVarInt();
|
long emptySkyLightMask = in.readVarLong();
|
||||||
int emptyBlockLightMask = in.readVarInt();
|
long emptyBlockLightMask = in.readVarLong();
|
||||||
|
|
||||||
this.skyLight = new NibbleArray3d[NUM_ENTRIES];
|
this.skyLight = new NibbleArray3d[NUM_ENTRIES];
|
||||||
for (int i = 0; i < NUM_ENTRIES; i++) {
|
for (int i = 0; i < NUM_ENTRIES; i++) {
|
||||||
|
@ -108,10 +108,10 @@ public class ServerUpdateLightPacket implements Packet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out.writeVarInt(skyLightMask);
|
out.writeVarLong(skyLightMask);
|
||||||
out.writeVarInt(blockLightMask);
|
out.writeVarLong(blockLightMask);
|
||||||
out.writeVarInt(emptySkyLightMask);
|
out.writeVarLong(emptySkyLightMask);
|
||||||
out.writeVarInt(emptyBlockLightMask);
|
out.writeVarLong(emptyBlockLightMask);
|
||||||
|
|
||||||
for(int i = 0; i < NUM_ENTRIES; i++) {
|
for(int i = 0; i < NUM_ENTRIES; i++) {
|
||||||
if((skyLightMask & 1 << i) != 0) {
|
if((skyLightMask & 1 << i) != 0) {
|
||||||
|
|
Loading…
Reference in a new issue