Class AbsoluteBlockBatch

java.lang.Object
net.minestom.server.instance.batch.AbsoluteBlockBatch
All Implemented Interfaces:
Batch<Runnable>, Block.Setter

public class AbsoluteBlockBatch extends Object implements Batch<Runnable>
A Batch which can be used when changes are required across chunk borders, but the changes do not need any translation. If translation is required, use a RelativeBlockBatch instead.

Coordinates are relative to the world origin.

See Also:
  • Field Details

  • Constructor Details

    • AbsoluteBlockBatch

      public AbsoluteBlockBatch()
    • AbsoluteBlockBatch

      public AbsoluteBlockBatch(BatchOption options)
  • Method Details

    • setBlock

      public void setBlock(int x, int y, int z, @NotNull @NotNull Block block)
      Specified by:
      setBlock in interface Block.Setter
    • clear

      public void clear()
      Description copied from interface: Batch
      Removes all block data from this batch.
      Specified by:
      clear in interface Batch<Runnable>
    • isReady

      public boolean isReady()
      Description copied from interface: Batch
      Gets if the batch is ready to be applied to an instance.
      Specified by:
      isReady in interface Batch<Runnable>
      Returns:
      true if the batch is ready to apply
    • awaitReady

      public void awaitReady()
      Description copied from interface: Batch
      Blocks the current thread until the batch is ready to be applied.
      Specified by:
      awaitReady in interface Batch<Runnable>
      See Also:
    • apply

      public AbsoluteBlockBatch apply(@NotNull @NotNull Instance instance, @Nullable @Nullable Runnable callback)
      Applies this batch to the given instance.
      Specified by:
      apply in interface Batch<Runnable>
      Parameters:
      instance - The instance in which the batch should be applied
      callback - The callback to be executed when the batch is applied
      Returns:
      The inverse of this batch, if inverse is enabled in the BatchOption
    • unsafeApply

      public AbsoluteBlockBatch unsafeApply(@NotNull @NotNull Instance instance, @Nullable @Nullable Runnable callback)
      Applies this batch to the given instance, and execute the callback immediately when the blocks have been applied, in an unknown thread.
      Parameters:
      instance - The instance in which the batch should be applied
      callback - The callback to be executed when the batch is applied
      Returns:
      The inverse of this batch, if inverse is enabled in the BatchOption
    • apply

      protected AbsoluteBlockBatch apply(@NotNull @NotNull Instance instance, @Nullable @Nullable Runnable callback, boolean safeCallback)
      Applies this batch to the given instance, and execute the callback depending on safeCallback.
      Parameters:
      instance - The instance in which the batch should be applied
      callback - The callback to be executed when the batch is applied
      safeCallback - If true, the callback will be executed in the next instance update. Otherwise it will be executed immediately upon completion
      Returns:
      The inverse of this batch, if inverse is enabled in the BatchOption
    • getInverseOption

      @NotNull public @NotNull BatchOption getInverseOption()
    • setInverseOption

      public void setInverseOption(@NotNull @NotNull BatchOption inverseOption)