Package net.minestom.server.utils.chunk
Class ChunkUtils
java.lang.Object
net.minestom.server.utils.chunk.ChunkUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Gets if a chunk is loaded.static boolean
static boolean
static @NotNull CompletableFuture
<Void> optionalLoadAll
(@NotNull Instance instance, long @NotNull [] chunks, @Nullable Consumer<Chunk> eachCallback) ExecutesInstance.loadOptionalChunk(int, int)
for the array of chunkschunks
with multiple callbacks,eachCallback
which is executed each time a new chunk is loaded andendCallback
when all the chunks in the array have been loaded.static Chunk
static Chunk
-
Method Details
-
optionalLoadAll
@NotNull public static @NotNull CompletableFuture<Void> optionalLoadAll(@NotNull @NotNull Instance instance, long @NotNull [] chunks, @Nullable @Nullable Consumer<Chunk> eachCallback) ExecutesInstance.loadOptionalChunk(int, int)
for the array of chunkschunks
with multiple callbacks,eachCallback
which is executed each time a new chunk is loaded andendCallback
when 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
CompletableFuture
completed 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
-