1919import net .minecraft .world .level .block .state .BlockState ;
2020import net .minecraft .world .level .chunk .LevelChunkSection ;
2121import net .minecraft .world .level .chunk .PalettedContainer ;
22+ import net .minecraft .world .level .chunk .Strategy ;
2223import net .minecraft .world .level .chunk .status .ChunkStatus ;
2324import net .minecraft .world .level .chunk .storage .SerializableChunkData ;
24- import net .minecraft .world .level .storage .TagValueInput ;
25- import net .minecraft .world .level .storage .ValueInput ;
2625import org .bukkit .Chunk ;
2726import org .bukkit .Material ;
2827import org .bukkit .World ;
@@ -90,8 +89,9 @@ public void getUnloadedChunkSections(World world, int chunkX, int chunkZ, Consum
9089 if (sectionIndex < 0 || sectionIndex >= sectionsCount ) continue ;
9190
9291 PalettedContainer <BlockState > blockStateContainer ;
92+ Strategy <BlockState > strategy = serverLevel .palettedContainerFactory ().blockStatesStrategy ();
9393 if (sectionTag .contains ("block_states" )) {
94- Codec <PalettedContainer <BlockState >> blockStateCodec = SerializableChunkData . BLOCK_STATE_CODEC ;
94+ Codec <PalettedContainer <BlockState >> blockStateCodec = PalettedContainer . codecRW ( BlockState . CODEC , strategy , Blocks . AIR . defaultBlockState (), new BlockState [ 0 ]) ;
9595 dataResult = blockStateCodec .parse (NbtOps .INSTANCE , sectionTag .getCompound ("block_states" ).orElseThrow ())
9696 .promotePartial (message -> logger .severe (String .format (
9797 CHUNK_ERROR ,
@@ -108,12 +108,13 @@ public void getUnloadedChunkSections(World world, int chunkX, int chunkZ, Consum
108108 throw ex ;
109109 }
110110 } else {
111- blockStateContainer = new PalettedContainer <>(
112- Block .BLOCK_STATE_REGISTRY ,
113- Blocks .AIR .defaultBlockState (),
114- PalettedContainer .Strategy .SECTION_STATES ,
115- null
116- );
111+ blockStateContainer = new PalettedContainer <>(Blocks .AIR .defaultBlockState (), strategy , new BlockState [0 ]);
112+ // blockStateContainer = new PalettedContainer<BlockState>(
113+ // Block.BLOCK_STATE_REGISTRY,
114+ // Blocks.AIR.defaultBlockState(),
115+ // Strategy.SECTION_STATES,
116+ // null
117+ // );
117118 }
118119
119120 LevelChunkSection chunkSection = new LevelChunkSection (blockStateContainer , null );
0 commit comments