mirror of
https://github.com/Minestom/Minestom.git
synced 2024-10-03 00:47:28 +02:00
Fixed the chunk generator not being executed when no populator is defined
This commit is contained in:
parent
f1d046753c
commit
beebf18af2
@ -79,18 +79,25 @@ public class ChunkBatch implements InstanceBatch {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to fill the chunk batch.
|
||||
*
|
||||
* @param chunkGenerator the chunk generator
|
||||
* @param callback the optional callback executed once the batch is done
|
||||
*/
|
||||
public void flushChunkGenerator(@NotNull ChunkGenerator chunkGenerator, @Nullable ChunkCallback callback) {
|
||||
final List<ChunkPopulator> populators = chunkGenerator.getPopulators();
|
||||
final boolean hasPopulator = populators != null && !populators.isEmpty();
|
||||
|
||||
// Check if there is anything to process
|
||||
if (blocks.isEmpty() && !hasPopulator) {
|
||||
OptionalCallback.execute(callback, chunk);
|
||||
return;
|
||||
}
|
||||
|
||||
BLOCK_BATCH_POOL.execute(() -> {
|
||||
final List<ChunkPopulator> populators = chunkGenerator.getPopulators();
|
||||
final boolean hasPopulator = populators != null && !populators.isEmpty();
|
||||
|
||||
chunkGenerator.generateChunkData(this, chunk.getChunkX(), chunk.getChunkZ());
|
||||
|
||||
// Check if there is anything to process
|
||||
if (blocks.isEmpty() && !hasPopulator) {
|
||||
OptionalCallback.execute(callback, chunk);
|
||||
return;
|
||||
}
|
||||
|
||||
singleThreadFlush(hasPopulator ? null : callback, true);
|
||||
|
||||
clearData(); // So the populators won't place those blocks again
|
||||
|
@ -43,7 +43,7 @@ public class PlayerInit {
|
||||
NoiseTestGenerator noiseTestGenerator = new NoiseTestGenerator();
|
||||
instanceContainer = MinecraftServer.getInstanceManager().createInstanceContainer(DimensionType.OVERWORLD);
|
||||
instanceContainer.enableAutoChunkLoad(true);
|
||||
instanceContainer.setChunkGenerator(noiseTestGenerator);
|
||||
instanceContainer.setChunkGenerator(chunkGeneratorDemo);
|
||||
|
||||
// Load some chunks beforehand
|
||||
final int loopStart = -3;
|
||||
|
Loading…
Reference in New Issue
Block a user