mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-23 06:50:25 +01:00
Fix Anti-Xray using wrong data in chunk deserialize
This commit is contained in:
parent
e4efb590e4
commit
683ce2062e
2 changed files with 11 additions and 13 deletions
|
@ -1519,7 +1519,7 @@ index 303e59be721d0e16e8822cf4e407595348ee7abf..51f74dd7b276e858889803d7f341d735
|
||||||
int getSerializedSize();
|
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
|
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
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
|
||||||
+++ b/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;
|
@@ -79,7 +79,7 @@ import org.slf4j.Logger;
|
||||||
|
@ -1539,7 +1539,14 @@ index b86b3bf713668999a21c4120b1d16c295531b2ad..eba3e34e5b129050bf6eaed6ce4e6903
|
||||||
if (!nbt.contains("Status", 8)) {
|
if (!nbt.contains("Status", 8)) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} 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()) {
|
if (b0 >= world.getMinSectionY() && b0 <= world.getMaxSectionY()) {
|
||||||
PalettedContainer datapaletteblock;
|
PalettedContainer datapaletteblock;
|
||||||
|
@ -1550,7 +1557,7 @@ index b86b3bf713668999a21c4120b1d16c295531b2ad..eba3e34e5b129050bf6eaed6ce4e6903
|
||||||
if (nbttagcompound3.contains("block_states", 10)) {
|
if (nbttagcompound3.contains("block_states", 10)) {
|
||||||
- datapaletteblock = (PalettedContainer) SerializableChunkData.BLOCK_STATE_CODEC.parse(NbtOps.INSTANCE, nbttagcompound3.getCompound("block_states")).promotePartial((s1) -> {
|
- 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
|
+ 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);
|
logErrors(chunkcoordintpair, b0, s1);
|
||||||
}).getOrThrow(SerializableChunkData.ChunkReadException::new);
|
}).getOrThrow(SerializableChunkData.ChunkReadException::new);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -33286,7 +33286,7 @@ index 93972352cd4881dccba9b90ccc8dcced3563e340..c3beb7fcad46a917d2b61bd0a0e98e51
|
||||||
|
|
||||||
static record PackedChunk<T>(Int2ObjectMap<T> sectionsByY, boolean versionChanged) {
|
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
|
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
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java
|
||||||
+++ b/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
|
@@ -129,7 +129,7 @@ public record SerializableChunkData(Registry<Biome> biomeRegistry, ChunkPos chun
|
||||||
|
@ -33298,15 +33298,6 @@ index eba3e34e5b129050bf6eaed6ce4e690357a3de20..83c87b56205b68010016b58b7f6e4d02
|
||||||
DataResult dataresult;
|
DataResult dataresult;
|
||||||
Logger logger;
|
Logger logger;
|
||||||
BlendingData.Packed blendingdata_d;
|
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
|
@@ -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 nibblearray = nbttagcompound3.contains("BlockLight", 7) ? new DataLayer(nbttagcompound3.getByteArray("BlockLight")) : null;
|
||||||
DataLayer nibblearray1 = nbttagcompound3.contains("SkyLight", 7) ? new DataLayer(nbttagcompound3.getByteArray("SkyLight")) : null;
|
DataLayer nibblearray1 = nbttagcompound3.contains("SkyLight", 7) ? new DataLayer(nbttagcompound3.getByteArray("SkyLight")) : null;
|
||||||
|
|
Loading…
Reference in a new issue