Remove unneeded IQueueWrapper, clean up some queue classes slightly

Dieser Commit ist enthalten in:
dordsor21 2021-09-12 11:35:28 +01:00
Ursprung 74f1d21f6e
Commit 66e22df3f4
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
4 geänderte Dateien mit 8 neuen und 35 gelöschten Zeilen

Datei anzeigen

@ -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();
}

Datei anzeigen

@ -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);

Datei anzeigen

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

Datei anzeigen

@ -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