diff options
author | Jason Penilla <[email protected]> | 2021-12-09 04:09:31 -0800 |
---|---|---|
committer | Jason Penilla <[email protected]> | 2021-12-09 04:11:04 -0800 |
commit | 188a8dfc4c00e01387d0400f7c371bc0ae76f255 (patch) | |
tree | c15b438f2aec036555d1f8573fb8619dd4c39b97 | |
parent | 0e91b6ae9bcbbcefe0b8548b3e1322fe085749c6 (diff) | |
download | Paper-188a8dfc4c00e01387d0400f7c371bc0ae76f255.tar.gz Paper-188a8dfc4c00e01387d0400f7c371bc0ae76f255.zip |
Fix ChunkSnapshot#isSectionEmpty(int)
-rw-r--r-- | patches/server/0829-Fix-ChunkSnapshot-isSectionEmpty-int.patch | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/patches/server/0829-Fix-ChunkSnapshot-isSectionEmpty-int.patch b/patches/server/0829-Fix-ChunkSnapshot-isSectionEmpty-int.patch new file mode 100644 index 0000000000..c1b3bea0a2 --- /dev/null +++ b/patches/server/0829-Fix-ChunkSnapshot-isSectionEmpty-int.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <[email protected]> +Date: Thu, 9 Dec 2021 00:08:11 -0800 +Subject: [PATCH] Fix ChunkSnapshot#isSectionEmpty(int) + + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +index db344e5b9f96f317a232304587e6b1673fc6067d..ca9282a0e608541837573d155bf9b95a105ba87d 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +@@ -53,6 +53,7 @@ public class CraftChunk implements Chunk { + private final int x; + private final int z; + private static final PalettedContainer<net.minecraft.world.level.block.state.BlockState> emptyBlockIDs = new PalettedContainer<>(net.minecraft.world.level.block.Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES, null); // Paper - Anti-Xray - Add preset block states ++ private static final PalettedContainer<net.minecraft.world.level.biome.Biome> EMPTY_BIOMES = new PalettedContainer<>(net.minecraft.server.MinecraftServer.getServer().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), net.minecraft.server.MinecraftServer.getServer().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).getOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES, null); // Paper + private static final byte[] emptyLight = new byte[2048]; + + public CraftChunk(net.minecraft.world.level.chunk.LevelChunk chunk) { +@@ -284,6 +285,20 @@ public class CraftChunk implements Chunk { + Codec<PalettedContainer<Biome>> biomeCodec = PalettedContainer.codec(iregistry, iregistry.byNameCodec(), PalettedContainer.Strategy.SECTION_BIOMES, iregistry.getOrThrow(Biomes.PLAINS), null); // Paper - Anti-Xray - Add preset biomes + + for (int i = 0; i < cs.length; i++) { ++ // Paper start ++ if (cs[i].hasOnlyAir()) { ++ sectionEmpty[i] = true; ++ sectionBlockIDs[i] = emptyBlockIDs; ++ sectionSkyLights[i] = emptyLight; ++ sectionEmitLights[i] = emptyLight; ++ if (biome != null) { ++ biome[i] = EMPTY_BIOMES; ++ } ++ continue; ++ } else { ++ sectionEmpty[i] = false; ++ } ++ // Paper end + CompoundTag data = new CompoundTag(); + + data.put("block_states", ChunkSerializer.BLOCK_STATE_CODEC.encodeStart(NbtOps.INSTANCE, cs[i].getStates()).get().left().get()); |