3131import de .bluecolored .bluemap .core .world .Biome ;
3232import de .bluecolored .bluemap .core .world .BlockState ;
3333import de .bluecolored .bluemap .core .world .LightData ;
34+ import net .querz .nbt .ByteArrayTag ;
3435import net .querz .nbt .CompoundTag ;
36+ import net .querz .nbt .IntArrayTag ;
3537import net .querz .nbt .ListTag ;
38+ import net .querz .nbt .Tag ;
3639import net .querz .nbt .mca .MCAUtil ;
3740
3841public class ChunkAnvil112 extends Chunk {
@@ -41,7 +44,7 @@ public class ChunkAnvil112 extends Chunk {
4144
4245 private boolean isGenerated ;
4346 private Section [] sections ;
44- private byte [] biomes ;
47+ private int [] biomes ;
4548
4649 @ SuppressWarnings ("unchecked" )
4750 public ChunkAnvil112 (MCAWorld world , CompoundTag chunkTag ) {
@@ -62,10 +65,21 @@ public ChunkAnvil112(MCAWorld world, CompoundTag chunkTag) {
6265 sections [section .getSectionY ()] = section ;
6366 }
6467
65- biomes = levelData .getByteArray ("Biomes" );
68+ Tag <?> tag = levelData .get ("Biomes" ); //tag can be byte-array or int-array
69+ if (tag instanceof ByteArrayTag ) {
70+ byte [] bs = ((ByteArrayTag ) tag ).getValue ();
71+ biomes = new int [bs .length ];
72+
73+ for (int i = 0 ; i < bs .length ; i ++) {
74+ biomes [i ] = bs [i ] & 0xFF ;
75+ }
76+ }
77+ else if (tag instanceof IntArrayTag ) {
78+ biomes = ((IntArrayTag ) tag ).getValue ();
79+ }
6680
6781 if (biomes == null || biomes .length == 0 ) {
68- biomes = new byte [2048 ];
82+ biomes = new int [2048 ];
6983 }
7084 }
7185
0 commit comments