1515import com .sk89q .worldedit .math .BlockVector3 ;
1616import com .sk89q .worldedit .regions .Region ;
1717import com .sk89q .worldedit .world .biome .BiomeType ;
18+ import com .sk89q .worldedit .world .biome .BiomeTypes ;
1819import com .sk89q .worldedit .world .block .BaseBlock ;
19- import com .sk89q .worldedit .world .block .BlockStateHolder ;
2020import com .sk89q .worldedit .world .block .BlockTypesCache ;
2121import net .jpountz .lz4 .LZ4BlockInputStream ;
2222import net .jpountz .lz4 .LZ4BlockOutputStream ;
@@ -145,7 +145,7 @@ private void writeBlocks(NBTOutputStream blocks, Clipboard clipboard) throws IOE
145145 }
146146 return ordinal ;
147147 },
148- BlockStateHolder :: getAsString ,
148+ ordinal -> BlockTypesCache . states [ ordinal ]. getAsString () ,
149149 clipboard
150150 );
151151 lz4Stream .finish ();
@@ -168,7 +168,7 @@ private void writeBiomes(NBTOutputStream biomes, Clipboard clipboard) throws IOE
168168 biomes , BiomeType .REGISTRY .size (),
169169 pos -> pos .getBiome (clipboard ),
170170 biome -> (char ) biome .getInternalId (),
171- BiomeType :: id ,
171+ ordinal -> BiomeTypes . get ( ordinal ). id () ,
172172 clipboard
173173 );
174174 }
@@ -218,7 +218,7 @@ private <T> void writePalette(
218218 NBTOutputStream out , int capacity ,
219219 Function <BlockVector3 , T > objectResolver ,
220220 Function <T , Character > ordinalResolver ,
221- Function <T , String > paletteEntryResolver ,
221+ Function <Character , String > paletteEntryResolver ,
222222 Clipboard clipboard
223223 ) throws IOException {
224224 int dataBytesUsed = 0 ;
@@ -240,7 +240,7 @@ private <T> void writePalette(
240240 if (index >= palette .length ) {
241241 throw new IOException ("insufficient palette capacity: " + palette .length + ", index: " + index );
242242 }
243- out .writeNamedTag (paletteEntryResolver .apply (obj ), value );
243+ out .writeNamedTag (paletteEntryResolver .apply (ordinal ), value );
244244 }
245245 if ((value & -128 ) != 0 ) {
246246 dataBytesUsed ++;
0 commit comments