mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-01 05:58:00 +01:00
Fix callback when no chunk generator is defined
This commit is contained in:
parent
8333eb9f70
commit
40d4af31c8
@ -776,7 +776,9 @@ public abstract class Instance implements BlockModifier, EventHandler, DataConta
|
||||
});
|
||||
}
|
||||
|
||||
final Chunk chunk = getChunkAt(entity.getPosition());
|
||||
final Position entityPosition = entity.getPosition();
|
||||
final Chunk chunk = getChunkAt(entityPosition);
|
||||
Check.notNull(chunk, "You tried to spawn an entity in an unloaded chunk, " + entityPosition);
|
||||
addEntityToChunk(entity, chunk);
|
||||
});
|
||||
}
|
||||
|
@ -453,6 +453,10 @@ public class InstanceContainer extends Instance {
|
||||
final ChunkBatch chunkBatch = createChunkBatch(chunk);
|
||||
|
||||
chunkBatch.flushChunkGenerator(chunkGenerator, callback);
|
||||
} else {
|
||||
// No chunk generator, execute the callback with the empty chunk
|
||||
if (callback != null)
|
||||
callback.accept(chunk);
|
||||
}
|
||||
|
||||
callChunkLoadEvent(chunkX, chunkZ);
|
||||
|
Loading…
Reference in New Issue
Block a user