mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-06 04:46:40 +00:00
Various minor
Disable P2's we region restrictions (so that it uses FAWE's) Fix extent binding Fix filtering on null sections
This commit is contained in:
@ -310,18 +310,19 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void filterBlocks(Filter filter, ChunkFilterBlock block, @Nullable Region region) {
|
||||
public void filterBlocks(Filter filter, ChunkFilterBlock block, @Nullable Region region, boolean full) {
|
||||
final IChunkGet get = getOrCreateGet();
|
||||
final IChunkSet set = getOrCreateSet();
|
||||
try {
|
||||
if (region != null) {
|
||||
region.filter(this, filter, block, get, set);
|
||||
region.filter(this, filter, block, get, set, full);
|
||||
} else {
|
||||
block = block.init(chunkX, chunkZ, get);
|
||||
for (int layer = 0; layer < 16; layer++) {
|
||||
if (!get.hasSection(layer) || !filter.appliesLayer(this, layer)) {
|
||||
if ((!full && !get.hasSection(layer)) || !filter.appliesLayer(this, layer)) {
|
||||
continue;
|
||||
}
|
||||
System.out.println("Apply layer " + full);
|
||||
block.init(get, set, layer);
|
||||
block.filter(filter);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public enum NullChunk implements IQueueChunk {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void filterBlocks(Filter filter, ChunkFilterBlock block, @Nullable Region region) {
|
||||
public void filterBlocks(Filter filter, ChunkFilterBlock block, @Nullable Region region, boolean full) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package com.boydti.fawe.beta.implementation.filter.block;
|
||||
|
||||
import static com.sk89q.worldedit.world.block.BlockTypesCache.states;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.Filter;
|
||||
import com.boydti.fawe.beta.FilterBlockMask;
|
||||
import com.boydti.fawe.beta.Flood;
|
||||
@ -65,7 +66,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
|
||||
FilterBlockMask mask) {
|
||||
final int maxDepth = flood.getMaxDepth();
|
||||
final boolean checkDepth = maxDepth < Character.MAX_VALUE;
|
||||
if (init(iget, iset, layer) != null) {
|
||||
if (init(iget, iset, layer) != null) { // TODO replace with hasSection
|
||||
while ((index = flood.poll()) != -1) {
|
||||
x = index & 15;
|
||||
z = index >> 4 & 15;
|
||||
@ -89,10 +90,11 @@ public class CharFilterBlock extends ChunkFilterBlock {
|
||||
this.layer = layer;
|
||||
final CharGetBlocks get = (CharGetBlocks) iget;
|
||||
if (!get.hasSection(layer)) {
|
||||
return null;
|
||||
getArr = FaweCache.IMP.EMPTY_CHAR_4096;
|
||||
} else {
|
||||
getArr = get.sections[layer].get(get, layer);
|
||||
}
|
||||
this.set = iset;
|
||||
getArr = get.sections[layer].get(get, layer);
|
||||
if (set.hasSection(layer)) {
|
||||
setArr = set.load(layer);
|
||||
delegate = FULL;
|
||||
|
@ -449,11 +449,11 @@ public class LimitExtent extends PassthroughExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Filter> T apply(Region region, T filter) {
|
||||
public <T extends Filter> T apply(Region region, T filter, boolean full) {
|
||||
limit.THROW_MAX_CHECKS(region.getArea());
|
||||
limit.THROW_MAX_CHANGES(region.getArea());
|
||||
try {
|
||||
return getExtent().apply(region, filter);
|
||||
return getExtent().apply(region, filter, full);
|
||||
} catch (FaweException e) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
throw e;
|
||||
|
@ -73,7 +73,7 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Filter> T apply(Region region, T filter) {
|
||||
public <T extends Filter> T apply(Region region, T filter, boolean full) {
|
||||
// The chunks positions to iterate over
|
||||
final Set<BlockVector2> chunks = region.getChunks();
|
||||
final Iterator<BlockVector2> chunksIter = chunks.iterator();
|
||||
@ -82,7 +82,7 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
|
||||
final int size = Math.min(chunks.size(), Settings.IMP.QUEUE.PARALLEL_THREADS);
|
||||
if (size <= 1) {
|
||||
BlockVector2 pos = chunksIter.next();
|
||||
getExtent().apply(null, filter, region, pos.getX(), pos.getZ());
|
||||
getExtent().apply(null, filter, region, pos.getX(), pos.getZ(), full);
|
||||
} else {
|
||||
final ForkJoinTask[] tasks = IntStream.range(0, size).mapToObj(i -> handler.submit(() -> {
|
||||
try {
|
||||
@ -103,7 +103,7 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
|
||||
X = pos.getX();
|
||||
Z = pos.getZ();
|
||||
}
|
||||
block = queue.apply(block, newFilter, region, X, Z);
|
||||
block = queue.apply(block, newFilter, region, X, Z, full);
|
||||
}
|
||||
queue.flush();
|
||||
}
|
||||
@ -131,20 +131,20 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
|
||||
return
|
||||
// Apply a filter over a region
|
||||
apply(region, searchMask
|
||||
.toFilter(new CountFilter())) // Adapt the mask to a filter which counts
|
||||
.toFilter(new CountFilter()), false) // Adapt the mask to a filter which counts
|
||||
.getParent() // Get the counter of this mask
|
||||
.getTotal(); // Get the total from the counter
|
||||
}
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> int setBlocks(Region region, B block) throws MaxChangedBlocksException {
|
||||
apply(region, block);
|
||||
apply(region, block, true);
|
||||
return getChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int setBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException {
|
||||
apply(region, pattern);
|
||||
apply(region, pattern, true);
|
||||
return getChanges();
|
||||
}
|
||||
|
||||
@ -163,18 +163,18 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
|
||||
@Override
|
||||
public int replaceBlocks(Region region, Mask mask, Pattern pattern)
|
||||
throws MaxChangedBlocksException {
|
||||
apply(region, mask.toFilter(pattern));
|
||||
apply(region, mask.toFilter(pattern), false);
|
||||
return getChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Countable<BlockState>> getBlockDistributionWithData(Region region) {
|
||||
return apply(region, new DistrFilter()).getDistribution();
|
||||
return apply(region, new DistrFilter(), false).getDistribution();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Countable<BlockType>> getBlockDistribution(Region region) {
|
||||
return apply(region, new DistrFilter()).getTypeDistribution();
|
||||
return apply(region, new DistrFilter(), false).getTypeDistribution();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user