@@ -307,19 +307,20 @@ public Blocks getBlocks()
307
307
if (tagBiomes !=null && tagBiomes .data .length > 0 ) {
308
308
int ymin = getYMin ();
309
309
int ymax = getYMax ();
310
- for (int x = 0 ; x < 16 ; x ++) {
310
+ for (int y = 0 ; y < ymax - ymin ; y ++) {
311
+ int sectionIdx = sectionsBlocks .getSectionIndex (y );
312
+ SectionBlocks section = sectionsBlocks .sections .get (sectionIdx );
313
+ if (section == null ) continue ;
314
+ int yInSection = y - sectionIdx * 16 ;
311
315
for (int z = 0 ; z < 16 ; z ++) {
312
- for (int y = 0 ; y < ymax - ymin ; y ++) {
316
+ for (int x = 0 ; x < 16 ; x ++) {
313
317
int biome ;
314
318
if (chunkVer >= 2203 ) {// >= 19w36a
315
319
biome = tagBiomes .data [x /4 + (z /4 )*4 + (y /4 )*4 *4 ];
316
320
} else {
317
321
biome = tagBiomes .data [x +z *16 ];
318
322
}
319
- int sectionIdx = sectionsBlocks .getSectionIndex (y );
320
- SectionBlocks section = sectionsBlocks .sections .get (sectionIdx );
321
- if (section == null ) continue ;
322
- section .biomes [section .getIndex (x , y - sectionIdx * 16 , z )] = IDConvert .convertBiome (biome );
323
+ section .biomes [section .getIndex (x , yInSection , z )] = IDConvert .convertBiome (biome );
323
324
}
324
325
}
325
326
}
@@ -567,12 +568,14 @@ boolean fillBiomes(TAG_Compound section) {
567
568
568
569
String biomeName = ((TAG_String ) tagBiomePalette .elements [(int ) biomePid ]).value ;
569
570
NamespaceID biome = NamespaceID .fromString (biomeName );
571
+ int baseInd = ((i %4 )*4 ) + ((i /4 )*16 *4 )%(16 *16 ) + ((i /(4 *4 ))*16 *16 *4 );
570
572
//Copy biome into 4x4x4 cube
571
- for (int x = 0 ; x < 4 ; x ++) {
572
- for (int y = 0 ; y < 4 ; y ++) {
573
- for (int z = 0 ; z < 4 ; z ++) {
574
- int baseInd = ((i %4 )*4 ) + ((i /4 )*16 *4 )%(16 *16 ) + ((i /(4 *4 ))*16 *16 *4 );
575
- int index = baseInd + (x + z *16 + y *16 *16 );
573
+ for (int y = 0 ; y < 4 ; y ++) {
574
+ int yOffset = y * 16 * 16 ;
575
+ for (int z = 0 ; z < 4 ; z ++) {
576
+ int zOffset = z * 16 ;
577
+ for (int x = 0 ; x < 4 ; x ++) {
578
+ int index = baseInd + x + zOffset + yOffset ;
576
579
biomes [index ] = biome ;
577
580
}
578
581
}
0 commit comments