3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-17 00:20:09 +01:00

add getter and setter for task

Dieser Commit ist enthalten in:
dordsor21 2023-07-21 12:37:04 +01:00
Ursprung 63b2d9bd9d
Commit 6afc7501db
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B

Datei anzeigen

@ -17,6 +17,8 @@ import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nonnull;
import java.util.Objects;
import java.util.function.Consumer;
/**
@ -28,7 +30,7 @@ public class OncePerChunkExtent extends AbstractDelegateExtent implements IBatch
private final LocalBlockVector2Set set = new LocalBlockVector2Set();
private final IQueueExtent<IQueueChunk> queue;
private final Consumer<IChunkGet> task;
private Consumer<IChunkGet> task;
private volatile long lastPair = Long.MAX_VALUE;
private volatile boolean isProcessing;
@ -40,10 +42,14 @@ public class OncePerChunkExtent extends AbstractDelegateExtent implements IBatch
* @param task Consumer task for the chunk GET
* @since TODO
*/
public OncePerChunkExtent(Extent extent, IQueueExtent<IQueueChunk> queue, Consumer<IChunkGet> task) {
public OncePerChunkExtent(
@Nonnull Extent extent,
@Nonnull IQueueExtent<IQueueChunk> queue,
@Nonnull Consumer<IChunkGet> task
) {
super(extent);
this.queue = queue;
this.task = task;
this.queue = Objects.requireNonNull(queue);
this.task = Objects.requireNonNull(task);
}
private boolean shouldRun(int chunkX, int chunkZ) {
@ -67,6 +73,14 @@ public class OncePerChunkExtent extends AbstractDelegateExtent implements IBatch
}
}
public Consumer<IChunkGet> getTask() {
return task;
}
public void setTask(Consumer<IChunkGet> task) {
this.task = task;
}
@Override
public IChunkSet processSet(final IChunk chunk, final IChunkGet get, final IChunkSet set) {
return set;