diff options
author | Spottedleaf <[email protected]> | 2024-10-25 12:57:20 -0700 |
---|---|---|
committer | Spottedleaf <[email protected]> | 2024-10-25 13:05:26 -0700 |
commit | 683ce2062eef97381b7b2254d06eb170ac203059 (patch) | |
tree | 6080c8ca759f0b6759f0ba0834de5da371e908c0 /patches | |
parent | e4efb590e49d30c9abe606838572aa5b4e9b5572 (diff) | |
download | Paper-683ce2062eef97381b7b2254d06eb170ac203059.tar.gz Paper-683ce2062eef97381b7b2254d06eb170ac203059.zip |
Fix Anti-Xray using wrong data in chunk deserialize
Diffstat (limited to 'patches')
-rw-r--r-- | patches/server/0979-Anti-Xray.patch | 13 | ||||
-rw-r--r-- | patches/server/1038-Moonrise-optimisation-patches.patch | 11 |
2 files changed, 11 insertions, 13 deletions
diff --git a/patches/server/0979-Anti-Xray.patch b/patches/server/0979-Anti-Xray.patch index dba0bf0bbc..7ab86199c5 100644 --- a/patches/server/0979-Anti-Xray.patch +++ b/patches/server/0979-Anti-Xray.patch @@ -1519,7 +1519,7 @@ index 303e59be721d0e16e8822cf4e407595348ee7abf..51f74dd7b276e858889803d7f341d735 int getSerializedSize(); diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java -index b86b3bf713668999a21c4120b1d16c295531b2ad..eba3e34e5b129050bf6eaed6ce4e690357a3de20 100644 +index b86b3bf713668999a21c4120b1d16c295531b2ad..4bc7fa3324e9af3abce2acf960c7b0650aca2e36 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java @@ -79,7 +79,7 @@ import org.slf4j.Logger; @@ -1539,7 +1539,14 @@ index b86b3bf713668999a21c4120b1d16c295531b2ad..eba3e34e5b129050bf6eaed6ce4e6903 if (!nbt.contains("Status", 8)) { return null; } else { -@@ -214,13 +215,17 @@ public record SerializableChunkData(Registry<Biome> biomeRegistry, ChunkPos chun +@@ -208,19 +209,23 @@ public record SerializableChunkData(Registry<Biome> biomeRegistry, ChunkPos chun + Codec<PalettedContainer<Holder<Biome>>> codec = makeBiomeCodecRW(iregistry); // CraftBukkit - read/write + + for (int i1 = 0; i1 < nbttaglist2.size(); ++i1) { +- CompoundTag nbttagcompound3 = nbttaglist2.getCompound(i1); ++ CompoundTag nbttagcompound3 = nbttaglist2.getCompound(i1); final CompoundTag sectionData = nbttagcompound3; // Paper - Anti-Xray - OBFHELPER + byte b0 = nbttagcompound3.getByte("Y"); + LevelChunkSection chunksection; if (b0 >= world.getMinSectionY() && b0 <= world.getMaxSectionY()) { PalettedContainer datapaletteblock; @@ -1550,7 +1557,7 @@ index b86b3bf713668999a21c4120b1d16c295531b2ad..eba3e34e5b129050bf6eaed6ce4e6903 if (nbttagcompound3.contains("block_states", 10)) { - datapaletteblock = (PalettedContainer) SerializableChunkData.BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, nbttagcompound3.getCompound("block_states")).promotePartial((s1) -> { + Codec<PalettedContainer<BlockState>> blockStateCodec = presetBlockStates == null ? BLOCK_STATE_CODEC : PalettedContainer.codecRW(Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), presetBlockStates); // Paper - Anti-Xray -+ datapaletteblock = blockStateCodec.parse(NbtOps.INSTANCE, nbttagcompound1.getCompound("block_states")).promotePartial((s1) -> { // Paper - Anti-Xray ++ datapaletteblock = blockStateCodec.parse(NbtOps.INSTANCE, sectionData.getCompound("block_states")).promotePartial((s1) -> { // Paper - Anti-Xray logErrors(chunkcoordintpair, b0, s1); }).getOrThrow(SerializableChunkData.ChunkReadException::new); } else { diff --git a/patches/server/1038-Moonrise-optimisation-patches.patch b/patches/server/1038-Moonrise-optimisation-patches.patch index 3f638ea9d1..1ee8b3dec8 100644 --- a/patches/server/1038-Moonrise-optimisation-patches.patch +++ b/patches/server/1038-Moonrise-optimisation-patches.patch @@ -33286,7 +33286,7 @@ index 93972352cd4881dccba9b90ccc8dcced3563e340..c3beb7fcad46a917d2b61bd0a0e98e51 static record PackedChunk<T>(Int2ObjectMap<T> sectionsByY, boolean versionChanged) { diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java -index eba3e34e5b129050bf6eaed6ce4e690357a3de20..83c87b56205b68010016b58b7f6e4d02f1fa5681 100644 +index 4bc7fa3324e9af3abce2acf960c7b0650aca2e36..e939810f3cc094a4b17f0b60a441773997cb788f 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java @@ -129,7 +129,7 @@ public record SerializableChunkData(Registry<Biome> biomeRegistry, ChunkPos chun @@ -33298,15 +33298,6 @@ index eba3e34e5b129050bf6eaed6ce4e690357a3de20..83c87b56205b68010016b58b7f6e4d02 DataResult dataresult; Logger logger; BlendingData.Packed blendingdata_d; -@@ -209,7 +209,7 @@ public record SerializableChunkData(Registry<Biome> biomeRegistry, ChunkPos chun - Codec<PalettedContainer<Holder<Biome>>> codec = makeBiomeCodecRW(iregistry); // CraftBukkit - read/write - - for (int i1 = 0; i1 < nbttaglist2.size(); ++i1) { -- CompoundTag nbttagcompound3 = nbttaglist2.getCompound(i1); -+ CompoundTag nbttagcompound3 = nbttaglist2.getCompound(i1); final CompoundTag sectionData = nbttagcompound3; // Paper - starlight - OBFHELPER - byte b0 = nbttagcompound3.getByte("Y"); - LevelChunkSection chunksection; - @@ -246,7 +246,17 @@ public record SerializableChunkData(Registry<Biome> biomeRegistry, ChunkPos chun DataLayer nibblearray = nbttagcompound3.contains("BlockLight", 7) ? new DataLayer(nbttagcompound3.getByteArray("BlockLight")) : null; DataLayer nibblearray1 = nbttagcompound3.contains("SkyLight", 7) ? new DataLayer(nbttagcompound3.getByteArray("SkyLight")) : null; |