@@ -94,20 +94,17 @@ public class PopulatorShipwreck extends Populator implements CallbackableTemplat
94
94
95
95
@ Override
96
96
public void populate (ChunkManager level , int chunkX , int chunkZ , NukkitRandom random , FullChunk chunk ) {
97
- int biome = chunk .getBiomeId (0 , 0 );
97
+ int biome = chunk .getBiomeId (5 , 5 );
98
98
if ((biome == EnumBiome .OCEAN .id || biome == EnumBiome .DEEP_OCEAN .id || biome == EnumBiome .FROZEN_OCEAN .id
99
99
|| biome == EnumBiome .BEACH .id || (biome >= 44 && biome <= 50 ))
100
100
&& chunkX == (((chunkX < 0 ? (chunkX - SPACING + 1 ) : chunkX ) / SPACING ) * SPACING ) + random .nextBoundedInt (SPACING - SEPARATION )
101
101
&& chunkZ == (((chunkZ < 0 ? (chunkZ - SPACING + 1 ) : chunkZ ) / SPACING ) * SPACING ) + random .nextBoundedInt (SPACING - SEPARATION )) {
102
102
ReadableStructureTemplate template ;
103
- boolean isBeached ;
104
103
105
104
if (biome == EnumBiome .BEACH .id ) {
106
105
template = STRUCTURE_LOCATION_BEACHED [random .nextBoundedInt (STRUCTURE_LOCATION_BEACHED .length )];
107
- isBeached = true ;
108
106
} else {
109
107
template = STRUCTURE_LOCATION_OCEAN [random .nextBoundedInt (STRUCTURE_LOCATION_OCEAN .length )];
110
- isBeached = false ;
111
108
}
112
109
113
110
BlockVector3 size = template .getSize ();
@@ -118,13 +115,9 @@ public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom ra
118
115
for (int z = 0 ; z < size .getZ () && z < 16 ; z ++) {
119
116
int y = chunk .getHighestBlockAt (x , z );
120
117
121
- if (!isBeached ) {
122
- y = Math .min (64 , y );
123
-
124
- int id = chunk .getBlockId (x , y , z );
125
- while ((id == WATER || id == STILL_WATER ) && y > 0 ) {
126
- id = level .getBlockIdAt (x , --y , z );
127
- }
118
+ int id = chunk .getBlockId (x , y , z );
119
+ while (FILTER [id ] && y > 0 ) {
120
+ id = chunk .getBlockId (x , --y , z );
128
121
}
129
122
130
123
sumY += y ;
@@ -133,9 +126,6 @@ public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom ra
133
126
}
134
127
135
128
int y = sumY / blockCount ;
136
- if (!isBeached ) {
137
- y = Math .min (64 , y );
138
- }
139
129
140
130
int seed = random .nextInt ();
141
131
boolean isLarge = false ;
@@ -163,13 +153,11 @@ public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom ra
163
153
}
164
154
165
155
if (!chunks .isEmpty ()) {
166
- int definiteY = y ;
167
-
168
156
this .waitingChunks .put (Level .chunkHash (chunkX , chunkZ ), indexes );
169
157
for (BaseFullChunk ck : chunks ) {
170
158
Server .getInstance ().getScheduler ().scheduleAsyncTask (null , new CallbackableChunkGenerationTask (
171
159
chunk .getProvider ().getLevel (), ck , this ,
172
- populator -> populator .generateChunkCallback (template , seed , level , chunkX , chunkZ , definiteY , ck .getX (), ck .getZ ())));
160
+ populator -> populator .generateChunkCallback (template , seed , level , chunkX , chunkZ , y , ck .getX (), ck .getZ ())));
173
161
}
174
162
return ;
175
163
}
@@ -237,7 +225,36 @@ protected static Consumer<CompoundTag> getBlockActorProcessor(FullChunk chunk, N
237
225
};
238
226
}
239
227
228
+ public static final boolean [] FILTER = new boolean [256 ];
229
+
240
230
public static void init () {
241
- //NOOP
231
+ FILTER [AIR ] = true ;
232
+ FILTER [LOG ] = true ;
233
+ FILTER [WATER ] = true ;
234
+ FILTER [STILL_WATER ] = true ;
235
+ FILTER [LAVA ] = true ;
236
+ FILTER [STILL_LAVA ] = true ;
237
+ FILTER [LEAVES ] = true ;
238
+ FILTER [TALL_GRASS ] = true ;
239
+ FILTER [DEAD_BUSH ] = true ;
240
+ FILTER [DANDELION ] = true ;
241
+ FILTER [RED_FLOWER ] = true ;
242
+ FILTER [BROWN_MUSHROOM ] = true ;
243
+ FILTER [RED_MUSHROOM ] = true ;
244
+ FILTER [SNOW_LAYER ] = true ;
245
+ FILTER [ICE ] = true ;
246
+ FILTER [CACTUS ] = true ;
247
+ FILTER [REEDS ] = true ;
248
+ FILTER [PUMPKIN ] = true ;
249
+ FILTER [BROWN_MUSHROOM_BLOCK ] = true ;
250
+ FILTER [RED_MUSHROOM_BLOCK ] = true ;
251
+ FILTER [MELON_BLOCK ] = true ;
252
+ FILTER [VINE ] = true ;
253
+ FILTER [WATER_LILY ] = true ;
254
+ FILTER [COCOA ] = true ;
255
+ FILTER [LEAVES2 ] = true ;
256
+ FILTER [LOG2 ] = true ;
257
+ FILTER [PACKED_ICE ] = true ;
258
+ FILTER [DOUBLE_PLANT ] = true ;
242
259
}
243
260
}
0 commit comments