mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-03 12:27:08 -05:00
Update to 20w18a
This commit is contained in:
parent
b90ee7ec73
commit
39bb8ff08c
8 changed files with 28 additions and 28 deletions
|
@ -578,8 +578,6 @@ public class MinecraftCodecHelper extends BasePacketCodecHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public LightUpdateData readLightUpdateData(ByteBuf buf) {
|
public LightUpdateData readLightUpdateData(ByteBuf buf) {
|
||||||
boolean trustEdges = buf.readBoolean();
|
|
||||||
|
|
||||||
BitSet skyYMask = BitSet.valueOf(this.readLongArray(buf));
|
BitSet skyYMask = BitSet.valueOf(this.readLongArray(buf));
|
||||||
BitSet blockYMask = BitSet.valueOf(this.readLongArray(buf));
|
BitSet blockYMask = BitSet.valueOf(this.readLongArray(buf));
|
||||||
BitSet emptySkyYMask = BitSet.valueOf(this.readLongArray(buf));
|
BitSet emptySkyYMask = BitSet.valueOf(this.readLongArray(buf));
|
||||||
|
@ -597,12 +595,10 @@ public class MinecraftCodecHelper extends BasePacketCodecHelper {
|
||||||
blockUpdates.add(this.readByteArray(buf));
|
blockUpdates.add(this.readByteArray(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new LightUpdateData(skyYMask, blockYMask, emptySkyYMask, emptyBlockYMask, skyUpdates, blockUpdates, trustEdges);
|
return new LightUpdateData(skyYMask, blockYMask, emptySkyYMask, emptyBlockYMask, skyUpdates, blockUpdates);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeLightUpdateData(ByteBuf buf, LightUpdateData data) {
|
public void writeLightUpdateData(ByteBuf buf, LightUpdateData data) {
|
||||||
buf.writeBoolean(data.isTrustEdges());
|
|
||||||
|
|
||||||
writeBitSet(buf, data.getSkyYMask());
|
writeBitSet(buf, data.getSkyYMask());
|
||||||
writeBitSet(buf, data.getBlockYMask());
|
writeBitSet(buf, data.getBlockYMask());
|
||||||
writeBitSet(buf, data.getEmptySkyYMask());
|
writeBitSet(buf, data.getEmptySkyYMask());
|
||||||
|
|
|
@ -16,17 +16,18 @@ public class Advancement {
|
||||||
private final @NonNull List<List<String>> requirements;
|
private final @NonNull List<List<String>> requirements;
|
||||||
private final String parentId;
|
private final String parentId;
|
||||||
private final DisplayData displayData;
|
private final DisplayData displayData;
|
||||||
|
private final boolean sendsTelemetryEvent;
|
||||||
|
|
||||||
public Advancement(@NonNull String id, @NonNull List<String> criteria, @NonNull List<List<String>> requirements) {
|
public Advancement(@NonNull String id, @NonNull List<String> criteria, @NonNull List<List<String>> requirements, boolean sendsTelemetryEvent) {
|
||||||
this(id, criteria, requirements, null, null);
|
this(id, criteria, requirements, null, null, sendsTelemetryEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Advancement(@NonNull String id, @NonNull List<String> criteria, @NonNull List<List<String>> requirements, String parentId) {
|
public Advancement(@NonNull String id, @NonNull List<String> criteria, @NonNull List<List<String>> requirements, String parentId, boolean sendsTelemetryEvent) {
|
||||||
this(id, criteria, requirements, parentId, null);
|
this(id, criteria, requirements, parentId, null, sendsTelemetryEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Advancement(@NonNull String id, @NonNull List<String> criteria, @NonNull List<List<String>> requirements, DisplayData displayData) {
|
public Advancement(@NonNull String id, @NonNull List<String> criteria, @NonNull List<List<String>> requirements, DisplayData displayData, boolean sendsTelemetryEvent) {
|
||||||
this(id, criteria, requirements, null, displayData);
|
this(id, criteria, requirements, null, displayData, sendsTelemetryEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|
|
@ -20,15 +20,12 @@ public class LightUpdateData {
|
||||||
private final @NonNull BitSet emptyBlockYMask;
|
private final @NonNull BitSet emptyBlockYMask;
|
||||||
private final @NonNull List<byte[]> skyUpdates;
|
private final @NonNull List<byte[]> skyUpdates;
|
||||||
private final @NonNull List<byte[]> blockUpdates;
|
private final @NonNull List<byte[]> blockUpdates;
|
||||||
private final boolean trustEdges;
|
|
||||||
|
|
||||||
public static LightUpdateData read(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
|
public static LightUpdateData read(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
|
||||||
return new LightUpdateData(in, helper);
|
return new LightUpdateData(in, helper);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LightUpdateData(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
|
private LightUpdateData(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
|
||||||
this.trustEdges = in.readBoolean();
|
|
||||||
|
|
||||||
this.skyYMask = BitSet.valueOf(helper.readLongArray(in));
|
this.skyYMask = BitSet.valueOf(helper.readLongArray(in));
|
||||||
this.blockYMask = BitSet.valueOf(helper.readLongArray(in));
|
this.blockYMask = BitSet.valueOf(helper.readLongArray(in));
|
||||||
this.emptySkyYMask = BitSet.valueOf(helper.readLongArray(in));
|
this.emptySkyYMask = BitSet.valueOf(helper.readLongArray(in));
|
||||||
|
@ -52,8 +49,6 @@ public class LightUpdateData {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void write(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
|
private void write(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
|
||||||
out.writeBoolean(this.trustEdges);
|
|
||||||
|
|
||||||
writeBitSet(out, helper, this.skyYMask);
|
writeBitSet(out, helper, this.skyYMask);
|
||||||
writeBitSet(out, helper, this.blockYMask);
|
writeBitSet(out, helper, this.blockYMask);
|
||||||
writeBitSet(out, helper, this.emptySkyYMask);
|
writeBitSet(out, helper, this.emptySkyYMask);
|
||||||
|
|
|
@ -808,6 +808,7 @@ public enum BuiltinSound implements Sound {
|
||||||
MUSIC_DISC_WAIT("music_disc.wait"),
|
MUSIC_DISC_WAIT("music_disc.wait"),
|
||||||
MUSIC_DISC_WARD("music_disc.ward"),
|
MUSIC_DISC_WARD("music_disc.ward"),
|
||||||
MUSIC_DISC_OTHERSIDE("music_disc.otherside"),
|
MUSIC_DISC_OTHERSIDE("music_disc.otherside"),
|
||||||
|
MUSIC_DISC_RELIC("music_disc.relic"),
|
||||||
MUSIC_DRAGON("music.dragon"),
|
MUSIC_DRAGON("music.dragon"),
|
||||||
MUSIC_END("music.end"),
|
MUSIC_END("music.end"),
|
||||||
MUSIC_GAME("music.game"),
|
MUSIC_GAME("music.game"),
|
||||||
|
@ -820,7 +821,7 @@ public enum BuiltinSound implements Sound {
|
||||||
MUSIC_OVERWORLD_JAGGED_PEAKS("music.overworld.jagged_peaks"),
|
MUSIC_OVERWORLD_JAGGED_PEAKS("music.overworld.jagged_peaks"),
|
||||||
MUSIC_OVERWORLD_LUSH_CAVES("music.overworld.lush_caves"),
|
MUSIC_OVERWORLD_LUSH_CAVES("music.overworld.lush_caves"),
|
||||||
MUSIC_OVERWORLD_SWAMP("music.overworld.swamp"),
|
MUSIC_OVERWORLD_SWAMP("music.overworld.swamp"),
|
||||||
MUSIC_OVERWORLD_JUNGLE_AND_FOREST("music.overworld.jungle_and_forest"),
|
MUSIC_OVERWORLD_FOREST("music.overworld.forest"),
|
||||||
MUSIC_OVERWORLD_OLD_GROWTH_TAIGA("music.overworld.old_growth_taiga"),
|
MUSIC_OVERWORLD_OLD_GROWTH_TAIGA("music.overworld.old_growth_taiga"),
|
||||||
MUSIC_OVERWORLD_MEADOW("music.overworld.meadow"),
|
MUSIC_OVERWORLD_MEADOW("music.overworld.meadow"),
|
||||||
MUSIC_OVERWORLD_CHERRY_GROVE("music.overworld.cherry_grove"),
|
MUSIC_OVERWORLD_CHERRY_GROVE("music.overworld.cherry_grove"),
|
||||||
|
@ -830,6 +831,12 @@ public enum BuiltinSound implements Sound {
|
||||||
MUSIC_NETHER_SOUL_SAND_VALLEY("music.nether.soul_sand_valley"),
|
MUSIC_NETHER_SOUL_SAND_VALLEY("music.nether.soul_sand_valley"),
|
||||||
MUSIC_OVERWORLD_STONY_PEAKS("music.overworld.stony_peaks"),
|
MUSIC_OVERWORLD_STONY_PEAKS("music.overworld.stony_peaks"),
|
||||||
MUSIC_NETHER_WARPED_FOREST("music.nether.warped_forest"),
|
MUSIC_NETHER_WARPED_FOREST("music.nether.warped_forest"),
|
||||||
|
MUSIC_OVERWORLD_FLOWER_FOREST("music.overworld.flower_forest"),
|
||||||
|
MUSIC_OVERWORLD_DESERT("music.overworld.desert"),
|
||||||
|
MUSIC_OVERWORLD_BADLANDS("music.overworld.badlands"),
|
||||||
|
MUSIC_OVERWORLD_JUNGLE("music.overworld.jungle"),
|
||||||
|
MUSIC_OVERWORLD_SPARSE_JUNGLE("music.overworld.sparse_jungle"),
|
||||||
|
MUSIC_OVERWORLD_BAMBOO_JUNGLE("music.overworld.bamboo_jungle"),
|
||||||
MUSIC_UNDER_WATER("music.under_water"),
|
MUSIC_UNDER_WATER("music.under_water"),
|
||||||
BLOCK_NETHER_BRICKS_BREAK("block.nether_bricks.break"),
|
BLOCK_NETHER_BRICKS_BREAK("block.nether_bricks.break"),
|
||||||
BLOCK_NETHER_BRICKS_STEP("block.nether_bricks.step"),
|
BLOCK_NETHER_BRICKS_STEP("block.nether_bricks.step"),
|
||||||
|
@ -1238,8 +1245,9 @@ public enum BuiltinSound implements Sound {
|
||||||
ENTITY_SNIFFER_DIGGING("entity.sniffer.digging"),
|
ENTITY_SNIFFER_DIGGING("entity.sniffer.digging"),
|
||||||
ENTITY_SNIFFER_DIGGING_STOP("entity.sniffer.digging_stop"),
|
ENTITY_SNIFFER_DIGGING_STOP("entity.sniffer.digging_stop"),
|
||||||
ENTITY_SNIFFER_HAPPY("entity.sniffer.happy"),
|
ENTITY_SNIFFER_HAPPY("entity.sniffer.happy"),
|
||||||
ENTITY_SNIFFER_EGG_CRACK("entity.sniffer.egg_crack"),
|
BLOCK_SNIFFER_EGG_PLOP("block.sniffer_egg.plop"),
|
||||||
ENTITY_SNIFFER_EGG_HATCH("entity.sniffer.egg_hatch"),
|
BLOCK_SNIFFER_EGG_CRACK("block.sniffer_egg.crack"),
|
||||||
|
BLOCK_SNIFFER_EGG_HATCH("block.sniffer_egg.hatch"),
|
||||||
ENTITY_SNOWBALL_THROW("entity.snowball.throw"),
|
ENTITY_SNOWBALL_THROW("entity.snowball.throw"),
|
||||||
BLOCK_SNOW_BREAK("block.snow.break"),
|
BLOCK_SNOW_BREAK("block.snow.break"),
|
||||||
BLOCK_SNOW_FALL("block.snow.fall"),
|
BLOCK_SNOW_FALL("block.snow.fall"),
|
||||||
|
|
|
@ -90,7 +90,9 @@ public class ClientboundUpdateAdvancementsPacket implements MinecraftPacket {
|
||||||
requirements.add(requirement);
|
requirements.add(requirement);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.advancements[i] = new Advancement(id, criteria, requirements, parentId, displayData);
|
boolean sendTelemetryEvent = in.readBoolean();
|
||||||
|
|
||||||
|
this.advancements[i] = new Advancement(id, criteria, requirements, parentId, displayData, sendTelemetryEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.removedAdvancements = new String[helper.readVarInt(in)];
|
this.removedAdvancements = new String[helper.readVarInt(in)];
|
||||||
|
@ -175,6 +177,8 @@ public class ClientboundUpdateAdvancementsPacket implements MinecraftPacket {
|
||||||
helper.writeString(out, criterion);
|
helper.writeString(out, criterion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out.writeBoolean(advancement.isSendsTelemetryEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
helper.writeVarInt(out, this.removedAdvancements.length);
|
helper.writeVarInt(out, this.removedAdvancements.length);
|
||||||
|
|
|
@ -17,13 +17,12 @@ public class ClientboundSectionBlocksUpdatePacket implements MinecraftPacket {
|
||||||
private final int chunkX;
|
private final int chunkX;
|
||||||
private final int chunkY;
|
private final int chunkY;
|
||||||
private final int chunkZ;
|
private final int chunkZ;
|
||||||
private final boolean ignoreOldLight;
|
|
||||||
/**
|
/**
|
||||||
* The server sends the record position in terms of the local chunk coordinate but it is stored here in terms of global coordinates.
|
* The server sends the record position in terms of the local chunk coordinate but it is stored here in terms of global coordinates.
|
||||||
*/
|
*/
|
||||||
private final @NonNull BlockChangeEntry[] entries;
|
private final @NonNull BlockChangeEntry[] entries;
|
||||||
|
|
||||||
public ClientboundSectionBlocksUpdatePacket(int chunkX, int chunkY, int chunkZ, boolean ignoreOldLight, BlockChangeEntry... entries) {
|
public ClientboundSectionBlocksUpdatePacket(int chunkX, int chunkY, int chunkZ, BlockChangeEntry... entries) {
|
||||||
if (entries == null || entries.length == 0) {
|
if (entries == null || entries.length == 0) {
|
||||||
throw new IllegalArgumentException("Entries must contain at least 1 value.");
|
throw new IllegalArgumentException("Entries must contain at least 1 value.");
|
||||||
}
|
}
|
||||||
|
@ -31,7 +30,6 @@ public class ClientboundSectionBlocksUpdatePacket implements MinecraftPacket {
|
||||||
this.chunkX = chunkX;
|
this.chunkX = chunkX;
|
||||||
this.chunkY = chunkY;
|
this.chunkY = chunkY;
|
||||||
this.chunkZ = chunkZ;
|
this.chunkZ = chunkZ;
|
||||||
this.ignoreOldLight = ignoreOldLight;
|
|
||||||
this.entries = entries;
|
this.entries = entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +38,6 @@ public class ClientboundSectionBlocksUpdatePacket implements MinecraftPacket {
|
||||||
this.chunkX = (int) (chunkPosition >> 42);
|
this.chunkX = (int) (chunkPosition >> 42);
|
||||||
this.chunkY = (int) (chunkPosition << 44 >> 44);
|
this.chunkY = (int) (chunkPosition << 44 >> 44);
|
||||||
this.chunkZ = (int) (chunkPosition << 22 >> 42);
|
this.chunkZ = (int) (chunkPosition << 22 >> 42);
|
||||||
this.ignoreOldLight = in.readBoolean();
|
|
||||||
this.entries = new BlockChangeEntry[helper.readVarInt(in)];
|
this.entries = new BlockChangeEntry[helper.readVarInt(in)];
|
||||||
for (int index = 0; index < this.entries.length; index++) {
|
for (int index = 0; index < this.entries.length; index++) {
|
||||||
long blockData = helper.readVarLong(in);
|
long blockData = helper.readVarLong(in);
|
||||||
|
@ -58,7 +55,6 @@ public class ClientboundSectionBlocksUpdatePacket implements MinecraftPacket {
|
||||||
chunkPosition |= (this.chunkX & 0x3FFFFFL) << 42;
|
chunkPosition |= (this.chunkX & 0x3FFFFFL) << 42;
|
||||||
chunkPosition |= (this.chunkZ & 0x3FFFFFL) << 20;
|
chunkPosition |= (this.chunkZ & 0x3FFFFFL) << 20;
|
||||||
out.writeLong(chunkPosition | (this.chunkY & 0xFFFFFL));
|
out.writeLong(chunkPosition | (this.chunkY & 0xFFFFFL));
|
||||||
out.writeBoolean(this.ignoreOldLight);
|
|
||||||
helper.writeVarInt(out, this.entries.length);
|
helper.writeVarInt(out, this.entries.length);
|
||||||
for (BlockChangeEntry entry : this.entries) {
|
for (BlockChangeEntry entry : this.entries) {
|
||||||
short position = (short) ((entry.getPosition().getX() - (this.chunkX << 4)) << 8 | (entry.getPosition().getZ() - (this.chunkZ << 4)) << 4 | (entry.getPosition().getY() - (this.chunkY << 4)));
|
short position = (short) ((entry.getPosition().getX() - (this.chunkX << 4)) << 8 | (entry.getPosition().getZ() - (this.chunkZ << 4)) << 4 | (entry.getPosition().getY() - (this.chunkY << 4)));
|
||||||
|
|
|
@ -17,12 +17,12 @@ public class ClientboundLevelChunkWithLightPacketTest extends PacketTest {
|
||||||
this.setPackets(
|
this.setPackets(
|
||||||
new ClientboundLevelChunkWithLightPacket(0, 0,
|
new ClientboundLevelChunkWithLightPacket(0, 0,
|
||||||
new byte[0], new CompoundTag("HeightMaps"), new BlockEntityInfo[0],
|
new byte[0], new CompoundTag("HeightMaps"), new BlockEntityInfo[0],
|
||||||
new LightUpdateData(new BitSet(), new BitSet(), new BitSet(), new BitSet(), Collections.emptyList(), Collections.emptyList(), false)
|
new LightUpdateData(new BitSet(), new BitSet(), new BitSet(), new BitSet(), Collections.emptyList(), Collections.emptyList())
|
||||||
),
|
),
|
||||||
new ClientboundLevelChunkWithLightPacket(1, 1,
|
new ClientboundLevelChunkWithLightPacket(1, 1,
|
||||||
new byte[256], new CompoundTag("HeightMaps"), new BlockEntityInfo[] {
|
new byte[256], new CompoundTag("HeightMaps"), new BlockEntityInfo[] {
|
||||||
new BlockEntityInfo(1, 0, 1, BlockEntityType.CHEST, null)
|
new BlockEntityInfo(1, 0, 1, BlockEntityType.CHEST, null)
|
||||||
}, new LightUpdateData(new BitSet(), new BitSet(), new BitSet(), new BitSet(), Collections.emptyList(), Collections.emptyList(), true)
|
}, new LightUpdateData(new BitSet(), new BitSet(), new BitSet(), new BitSet(), Collections.emptyList(), Collections.emptyList())
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class ClientboundSectionBlocksUpdatePacketTest extends PacketTest {
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
this.setPackets(
|
this.setPackets(
|
||||||
new ClientboundSectionBlocksUpdatePacket(3, 4, 12, false, new BlockChangeEntry(Vector3i.from(50, 65, 200), 3))
|
new ClientboundSectionBlocksUpdatePacket(3, 4, 12, new BlockChangeEntry(Vector3i.from(50, 65, 200), 3))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue