Class ChunkUtils
java.lang.Object
net.minestom.server.utils.chunk.ChunkUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic booleanGets if a chunk is loaded.static booleanstatic CompletableFuture<Void> optionalLoadAll(Instance instance, long[] chunks, @Nullable Consumer<Chunk> eachCallback) ExecutesInstance.loadOptionalChunk(int, int)for the array of chunkschunkswith multiple callbacks,eachCallbackwhich is executed each time a new chunk is loaded andendCallbackwhen all the chunks in the array have been loaded.static Chunkstatic Chunk
-
Method Details
-
optionalLoadAll
public static CompletableFuture<Void> optionalLoadAll(Instance instance, long[] chunks, @Nullable @Nullable Consumer<Chunk> eachCallback) ExecutesInstance.loadOptionalChunk(int, int)for the array of chunkschunkswith multiple callbacks,eachCallbackwhich is executed each time a new chunk is loaded andendCallbackwhen all the chunks in the array have been loaded.Be aware that
Instance.loadOptionalChunk(int, int)can give a null chunk in the callback ifInstance.hasEnabledAutoChunkLoad()returns false and the chunk is not already loaded.- Parameters:
instance- the instance to load the chunks fromchunks- the chunks to loaded, long value fromCoordConversion.chunkIndex(int, int)eachCallback- the optional callback when a chunk get loaded- Returns:
- a
CompletableFuturecompleted once all chunks have been processed
-
isLoaded
-
isLoaded
Gets if a chunk is loaded.- Parameters:
instance- the instance to checkx- instance X coordinatez- instance Z coordinate- Returns:
- true if the chunk is loaded, false otherwise
-
isLoaded
-
retrieve
-
retrieve
-