Class AbsoluteBlockBatch
java.lang.Object
net.minestom.server.instance.batch.AbsoluteBlockBatch
- All Implemented Interfaces:
Batch<Runnable>
,Block.Setter
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 Summary
Fields inherited from interface net.minestom.server.instance.batch.Batch
BLOCK_BATCH_POOL
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionApplies this batch to the given instance.protected AbsoluteBlockBatch
Applies this batch to the given instance, and execute the callback depending on safeCallback.void
Blocks the current thread until the batch is ready to be applied.void
clear()
Removes all block data from this batch.@NotNull BatchOption
boolean
isReady()
Gets if the batch is ready to be applied to an instance.void
void
setInverseOption
(@NotNull BatchOption inverseOption) unsafeApply
(@NotNull Instance instance, @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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minestom.server.instance.block.Block.Setter
setBlock
-
Field Details
-
readyLatch
-
-
Constructor Details
-
AbsoluteBlockBatch
public AbsoluteBlockBatch() -
AbsoluteBlockBatch
-
-
Method Details
-
setBlock
- Specified by:
setBlock
in interfaceBlock.Setter
-
clear
public void clear()Description copied from interface:Batch
Removes all block data from this batch. -
isReady
public boolean isReady()Description copied from interface:Batch
Gets if the batch is ready to be applied to an instance. -
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 interfaceBatch<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 interfaceBatch<Runnable>
- Parameters:
instance
- The instance in which the batch should be appliedcallback
- 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 appliedcallback
- 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 appliedcallback
- The callback to be executed when the batch is appliedsafeCallback
- 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
-
setInverseOption
-