mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Allow fastmode to be used in a lot more places
- Option to stop fastmode from bothering to fix existing ticking blocks
This commit is contained in:
@ -34,6 +34,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
||||
public BlockVector3ChunkMap<CompoundTag> tiles;
|
||||
public HashSet<CompoundTag> entities;
|
||||
public HashSet<UUID> entityRemoves;
|
||||
private boolean fastMode = false;
|
||||
|
||||
private CharSetBlocks() {}
|
||||
|
||||
@ -131,6 +132,16 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
||||
entityRemoves.add(uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFastMode(boolean fastMode) {
|
||||
this.fastMode = fastMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFastMode() {
|
||||
return fastMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
if (biomes != null) {
|
||||
|
@ -42,6 +42,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
||||
private IQueueExtent<? extends IChunk> extent; // the parent queue extent which has this chunk
|
||||
private int chunkX;
|
||||
private int chunkZ;
|
||||
private boolean fastmode;
|
||||
|
||||
private ChunkHolder() {
|
||||
this.delegate = NULL;
|
||||
@ -100,6 +101,16 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
||||
return getOrCreateGet().load(layer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFastMode() {
|
||||
return fastmode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFastMode(boolean fastmode) {
|
||||
this.fastmode = fastmode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundTag getEntity(UUID uuid) {
|
||||
return delegate.get(this).getEntity(uuid);
|
||||
@ -313,6 +324,7 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk<T> {
|
||||
public void filterBlocks(Filter filter, ChunkFilterBlock block, @Nullable Region region, boolean full) {
|
||||
final IChunkGet get = getOrCreateGet();
|
||||
final IChunkSet set = getOrCreateSet();
|
||||
set.setFastMode(fastmode);
|
||||
try {
|
||||
block.filter(this, get, set, filter, region, full);
|
||||
} finally {
|
||||
|
@ -44,12 +44,14 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
|
||||
private final QueueHandler handler;
|
||||
private final BatchProcessorHolder processor;
|
||||
private int changes;
|
||||
private final boolean fastmode;
|
||||
|
||||
public ParallelQueueExtent(QueueHandler handler, World world) {
|
||||
public ParallelQueueExtent(QueueHandler handler, World world, boolean fastmode) {
|
||||
super(handler.getQueue(world, new BatchProcessorHolder()));
|
||||
this.world = world;
|
||||
this.handler = handler;
|
||||
this.processor = (BatchProcessorHolder) getExtent().getProcessor();
|
||||
this.fastmode = fastmode;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -94,6 +96,7 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
|
||||
final Filter newFilter = filter.fork();
|
||||
// Create a chunk that we will reuse/reset for each operation
|
||||
final IQueueExtent<IQueueChunk> queue = getNewQueue();
|
||||
queue.setFastMode(fastmode);
|
||||
synchronized (queue) {
|
||||
ChunkFilterBlock block = null;
|
||||
|
||||
|
@ -49,6 +49,8 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
||||
|
||||
private boolean enabledQueue = true;
|
||||
|
||||
private boolean fastmode = false;
|
||||
|
||||
/**
|
||||
* Safety check to ensure that the thread being used matches the one being initialized on. - Can
|
||||
* be removed later
|
||||
@ -80,6 +82,16 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
||||
return cacheSet.get(chunkX, chunkZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFastMode(boolean fastmode) {
|
||||
this.fastmode = fastmode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFastMode() {
|
||||
return fastmode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the queue.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user