Class ChunkUtils

java.lang.Object
net.minestom.server.utils.chunk.ChunkUtils

@Internal public final class ChunkUtils extends Object
  • Method Details

    • optionalLoadAll

      @NotNull public static @NotNull CompletableFuture<Void> optionalLoadAll(@NotNull @NotNull Instance instance, long @NotNull [] chunks, @Nullable @Nullable Consumer<Chunk> eachCallback)
      Executes Instance.loadOptionalChunk(int, int) for the array of chunks chunks with multiple callbacks, eachCallback which is executed each time a new chunk is loaded and endCallback 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 if Instance.hasEnabledAutoChunkLoad() returns false and the chunk is not already loaded.

      Parameters:
      instance - the instance to load the chunks from
      chunks - the chunks to loaded, long value from CoordConversion.chunkIndex(int, int)
      eachCallback - the optional callback when a chunk get loaded
      Returns:
      a CompletableFuture completed once all chunks have been processed
    • isLoaded

      public static boolean isLoaded(@Nullable @Nullable Chunk chunk)
    • isLoaded

      public static boolean isLoaded(@NotNull @NotNull Instance instance, double x, double z)
      Gets if a chunk is loaded.
      Parameters:
      instance - the instance to check
      x - instance X coordinate
      z - instance Z coordinate
      Returns:
      true if the chunk is loaded, false otherwise
    • isLoaded

      public static boolean isLoaded(@NotNull @NotNull Instance instance, @NotNull @NotNull Point point)
    • retrieve

      public static Chunk retrieve(Instance instance, Chunk originChunk, double x, double z)
    • retrieve

      public static Chunk retrieve(Instance instance, Chunk originChunk, Point position)