@@ -233,12 +233,15 @@ abstract static class VillagePiece extends StructurePiece {
233
233
protected PopulatorVillage .Type type ;
234
234
protected boolean isZombieVillage ;
235
235
236
+ protected int yOffset ;
237
+
236
238
protected VillagePiece (StartPiece start , int genDepth ) {
237
239
super (genDepth );
238
240
239
241
if (start != null ) {
240
242
this .type = start .type ;
241
243
this .isZombieVillage = start .isZombieVillage ;
244
+ this .yOffset = start .yOffset ;
242
245
} else {
243
246
this .type = PopulatorVillage .Type .PLAINS ;
244
247
}
@@ -307,21 +310,21 @@ protected int getAverageGroundHeight(ChunkManager level, BoundingBox boundingBox
307
310
308
311
for (int x = this .boundingBox .x0 ; x <= this .boundingBox .x1 ; ++x ) {
309
312
for (int z = this .boundingBox .z0 ; z <= this .boundingBox .z1 ; ++z ) {
310
- vec .setComponents (x , 64 , z );
313
+ vec .setComponents (x , 64 + this . yOffset , z );
311
314
312
315
if (boundingBox .isInside (vec )) {
313
316
BaseFullChunk chunk = level .getChunk (x >> 4 , z >> 4 );
314
317
if (chunk == null ) {
315
- sum += 63 + 1 - 1 ;
318
+ sum += 63 + 1 - 1 + this . yOffset ;
316
319
} else {
317
320
int cx = x & 0xf ;
318
321
int cz = z & 0xf ;
319
322
int y = chunk .getHighestBlockAt (cx , cz );
320
323
int id = chunk .getBlockId (cx , y , cz );
321
- while (Block .transparent [id ] && y > 63 + 1 - 1 ) {
324
+ while (Block .transparent [id ] && y > 63 + 1 - 1 + this . yOffset ) {
322
325
id = chunk .getBlockId (cx , --y , cz );
323
326
}
324
- sum += Math .max (y , 63 + 1 - 1 );
327
+ sum += Math .max (y , 63 + 1 - 1 + this . yOffset );
325
328
}
326
329
++count ;
327
330
}
@@ -508,7 +511,7 @@ public static class StartPiece extends Well {
508
511
public List <StructurePiece > pendingRoads = Lists .newArrayList ();
509
512
510
513
//\\ VillageStart::VillageStart(BiomeSource *,Random &,int,int,int)
511
- public StartPiece (ChunkManager level , int genDepth , NukkitRandom random , int x , int z , List <PieceWeight > availablePieces , int size ) {
514
+ public StartPiece (ChunkManager level , int genDepth , NukkitRandom random , int x , int z , List <PieceWeight > availablePieces , int size , boolean isNukkitGenerator ) {
512
515
super (null , 0 , random , x , z );
513
516
this .world = level ;
514
517
this .availablePieces = availablePieces ;
@@ -533,6 +536,8 @@ public StartPiece(ChunkManager level, int genDepth, NukkitRandom random, int x,
533
536
}
534
537
535
538
this .isZombieVillage = random .nextBoundedInt (50 ) == 0 ;
539
+
540
+ this .yOffset = isNukkitGenerator ? 2 : 0 ;
536
541
}
537
542
538
543
public StartPiece (CompoundTag tag ) {
@@ -1913,28 +1918,28 @@ public boolean postProcess(ChunkManager level, NukkitRandom random, BoundingBox
1913
1918
1914
1919
for (int x = this .boundingBox .x0 ; x <= this .boundingBox .x1 ; ++x ) {
1915
1920
for (int z = this .boundingBox .z0 ; z <= this .boundingBox .z1 ; ++z ) {
1916
- BlockVector3 vec = new BlockVector3 (x , 64 , z );
1921
+ BlockVector3 vec = new BlockVector3 (x , 64 + this . yOffset , z );
1917
1922
1918
1923
if (boundingBox .isInside (vec )) {
1919
1924
BaseFullChunk chunk = level .getChunk (chunkX , chunkZ );
1920
1925
if (chunk == null ) {
1921
- vec .y = 63 - 1 ;
1926
+ vec .y = 63 - 1 + this . yOffset ;
1922
1927
} else {
1923
1928
int cx = x & 0xf ;
1924
1929
int cz = z & 0xf ;
1925
1930
int y = chunk .getHighestBlockAt (cx , cz );
1926
1931
int id = chunk .getBlockId (cx , y , cz );
1927
- while (Block .transparent [id ] && y > 63 - 1 ) {
1932
+ while (Block .transparent [id ] && y > 63 - 1 + this . yOffset ) {
1928
1933
id = chunk .getBlockId (cx , --y , cz );
1929
1934
}
1930
1935
vec .y = y ;
1931
1936
}
1932
1937
1933
- if (vec .y < 63 ) {
1934
- vec .y = 63 - 1 ;
1938
+ if (vec .y < 63 + this . yOffset ) {
1939
+ vec .y = 63 - 1 + this . yOffset ;
1935
1940
}
1936
1941
1937
- while (vec .y >= 63 - 1 ) {
1942
+ while (vec .y >= 63 - 1 + this . yOffset ) {
1938
1943
int block = level .getBlockIdAt (vec .x , vec .y , vec .z );
1939
1944
1940
1945
if (block == Block .GRASS && level .getBlockIdAt (vec .x , vec .y + 1 , vec .z ) == Block .AIR ) {
0 commit comments