Remove unneeded IQueueWrapper, clean up some queue classes slightly

(cherry picked from commit 66e22df3f4c505a0a302d47c0c10302275e2a191)
This commit is contained in:
dordsor21 2021-09-12 11:35:28 +01:00
parent d60d178513
commit 66b79b4ea2
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
4 changed files with 8 additions and 35 deletions

View File

@ -31,7 +31,7 @@ public class MaskFilter<T extends Filter> extends DelegateFilter<T> {
@Override
public void applyBlock(FilterBlock block) {
if (mask instanceof AbstractExtentMask) {
if (((AbstractExtentMask) mask).test(block, block)) {
if (((AbstractExtentMask) mask).test(block.getExtent(), block)) {
getParent().applyBlock(block);
this.changes.incrementAndGet();
}

View File

@ -41,36 +41,27 @@ public interface IQueueExtent<T extends IChunk> extends Flushable, Trimable, ICh
/**
* Initialize the queue (for reusability)
*
* @param extent
* @param get
* @param set
* @param extent extent to use
* @param get cache of chunk GET
* @param set cache of chunk SET
*/
void init(Extent extent, IChunkCache<IChunkGet> get, IChunkCache<IChunkSet> set);
/**
* Get the cached get object. This is faster than getting the object using NMS and allows for
* wrapping.
*
* @param chunkX
* @param chunkZ
* @return
*/
IChunkGet getCachedGet(@Range(from = 0, to = 15) int chunkX, @Range(from = 0, to = 15) int chunkZ);
/**
* Get the cached chunk set object.
*
* @param chunkX
* @param chunkZ
* @return
*/
IChunkSet getCachedSet(@Range(from = 0, to = 15) int chunkX, @Range(from = 0, to = 15) int chunkZ);
/**
* Submit the chunk so that it's changes are applied to the world
*
* @param chunk
* @return result
* @return Future
*/
<V extends Future<V>> V submit(T chunk);

View File

@ -1,9 +0,0 @@
package com.fastasyncworldedit.core.queue;
public interface IQueueWrapper {
default IQueueExtent<IQueueChunk> wrapQueue(IQueueExtent<IQueueChunk> queue) {
return queue;
}
}

View File

@ -17,7 +17,6 @@ import com.fastasyncworldedit.core.internal.exception.FaweException;
import com.fastasyncworldedit.core.queue.Filter;
import com.fastasyncworldedit.core.queue.IQueueChunk;
import com.fastasyncworldedit.core.queue.IQueueExtent;
import com.fastasyncworldedit.core.queue.IQueueWrapper;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.function.mask.BlockMask;
@ -43,7 +42,7 @@ import java.util.Set;
import java.util.concurrent.ForkJoinTask;
import java.util.stream.IntStream;
public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrapper {
public class ParallelQueueExtent extends PassthroughExtent {
private static final Logger LOGGER = LogManagerCompat.getLogger();
@ -54,8 +53,8 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
// Array for lazy avoidance of concurrent modification exceptions and needless overcomplication of code (synchronisation is
// not very important)
private final boolean[] faweExceptionReasonsUsed = new boolean[FaweException.Type.values().length];
private int changes;
private final boolean fastmode;
private int changes;
private int lastException = Integer.MIN_VALUE;
private int exceptionCount = 0;
@ -90,15 +89,7 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
}
private IQueueExtent<IQueueChunk> getNewQueue() {
return wrapQueue(handler.getQueue(this.world, this.processor, this.postProcessor));
}
@Override
public IQueueExtent<IQueueChunk> wrapQueue(IQueueExtent<IQueueChunk> queue) {
// TODO wrap
queue.setProcessor(this.processor);
queue.setPostProcessor(this.postProcessor);
return queue;
return handler.getQueue(world, this.processor, this.postProcessor);
}
@Override