--- a/net/minecraft/world/level/chunk/PalettedContainerFactory.java
+++ b/net/minecraft/world/level/chunk/PalettedContainerFactory.java
@@ -18,6 +_,7 @@
     Strategy<Holder<Biome>> biomeStrategy,
     Holder<Biome> defaultBiome,
     Codec<PalettedContainerRO<Holder<Biome>>> biomeContainerCodec
+    , Codec<PalettedContainer<Holder<Biome>>> biomeContainerRWCodec // Paper
 ) {
     public static PalettedContainerFactory create(RegistryAccess registries) {
         Strategy<BlockState> strategy = Strategy.createForBlockStates(Block.BLOCK_STATE_REGISTRY);
@@ -28,18 +_,31 @@
         return new PalettedContainerFactory(
             strategy,
             blockState,
-            PalettedContainer.codecRW(BlockState.CODEC, strategy, blockState),
+            PalettedContainer.codecRW(BlockState.CODEC, strategy, blockState, null), // Paper - Anti-Xray
             strategy1,
             orThrow,
             PalettedContainer.codecRO(registry.holderByNameCodec(), strategy1, orThrow)
+            , PalettedContainer.codecRW(registry.holderByNameCodec(), strategy1, orThrow, null) // Paper // Anti-Xray
         );
     }
 
     public PalettedContainer<BlockState> createForBlockStates() {
-        return new PalettedContainer<>(this.defaultBlockState, this.blockStatesStrategy);
+        // Paper start - Anti-Xray
+        return new PalettedContainer<>(this.defaultBlockState, this.blockStatesStrategy, null);
+    }
+
+    public PalettedContainer<BlockState> createForBlockStates(net.minecraft.world.level.@org.jspecify.annotations.Nullable Level level, net.minecraft.world.level.ChunkPos chunkPos, int chunkSectionY) {
+        net.minecraft.world.level.block.state.BlockState[] states = null;
+        if (level != null
+            // This check is needed because of a circular reference in ChunkPacketBlockControllerAntiXray when creating an empty chunk section
+            && level.chunkPacketBlockController != null) {
+            states = level.chunkPacketBlockController.getPresetBlockStates(level, chunkPos, chunkSectionY);
+        }
+        return new PalettedContainer<>(this.defaultBlockState, this.blockStatesStrategy, states);
     }
 
     public PalettedContainer<Holder<Biome>> createForBiomes() {
-        return new PalettedContainer<>(this.defaultBiome, this.biomeStrategy);
+        return new PalettedContainer<>(this.defaultBiome, this.biomeStrategy, null);
+        // Paper end - Anti-Xray
     }
 }
