Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 08:02:50 +02:00
Various minor
Disable P2's we region restrictions (so that it uses FAWE's) Fix extent binding Fix filtering on null sections
Dieser Commit ist enthalten in:
Ursprung
9d6f2df908
Commit
7aa0d9c122
@ -58,7 +58,7 @@ public interface IChunk extends Trimable, IChunkGet, IChunkSet {
|
|||||||
* @param block The filter block
|
* @param block The filter block
|
||||||
* @param region The region allowed to filter (may be null)
|
* @param region The region allowed to filter (may be null)
|
||||||
*/
|
*/
|
||||||
void filterBlocks(Filter filter, ChunkFilterBlock block, @Nullable Region region);
|
void filterBlocks(Filter filter, ChunkFilterBlock block, @Nullable Region region, boolean full);
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * Flood through all the blocks in the chunk
|
// * Flood through all the blocks in the chunk
|
||||||
|
@ -116,8 +116,8 @@ public interface IDelegateChunk<U extends IQueueChunk> extends IQueueChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void filterBlocks(Filter filter, ChunkFilterBlock block, @Nullable Region region) {
|
default void filterBlocks(Filter filter, ChunkFilterBlock block, @Nullable Region region, boolean full) {
|
||||||
getParent().filterBlocks(filter, block, region);
|
getParent().filterBlocks(filter, block, region, full);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -144,7 +144,7 @@ public interface IQueueExtent<T extends IChunk> extends Flushable, Trimable, ICh
|
|||||||
*/
|
*/
|
||||||
boolean isEmpty();
|
boolean isEmpty();
|
||||||
|
|
||||||
default ChunkFilterBlock apply(ChunkFilterBlock block, Filter filter, Region region, int chunkX, int chunkZ) {
|
default ChunkFilterBlock apply(ChunkFilterBlock block, Filter filter, Region region, int chunkX, int chunkZ, boolean full) {
|
||||||
if (!filter.appliesChunk(chunkX, chunkZ)) {
|
if (!filter.appliesChunk(chunkX, chunkZ)) {
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
@ -158,18 +158,18 @@ public interface IQueueExtent<T extends IChunk> extends Flushable, Trimable, ICh
|
|||||||
if (block == null) {
|
if (block == null) {
|
||||||
block = this.initFilterBlock();
|
block = this.initFilterBlock();
|
||||||
}
|
}
|
||||||
chunk.filterBlocks(filter, block, region);
|
chunk.filterBlocks(filter, block, region, full);
|
||||||
}
|
}
|
||||||
this.submit(chunk);
|
this.submit(chunk);
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default <T extends Filter> T apply(Region region, T filter) {
|
default <T extends Filter> T apply(Region region, T filter, boolean full) {
|
||||||
final Set<BlockVector2> chunks = region.getChunks();
|
final Set<BlockVector2> chunks = region.getChunks();
|
||||||
ChunkFilterBlock block = null;
|
ChunkFilterBlock block = null;
|
||||||
for (BlockVector2 chunk : chunks) {
|
for (BlockVector2 chunk : chunks) {
|
||||||
block = apply(block, filter, region, chunk.getX(), chunk.getZ());
|
block = apply(block, filter, region, chunk.getX(), chunk.getZ(), full);
|
||||||
}
|
}
|
||||||
flush();
|
flush();
|
||||||
return filter;
|
return filter;
|
||||||
|
@ -310,18 +310,19 @@ public class ChunkHolder<T extends Future<T>> implements IQueueChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 IChunkGet get = getOrCreateGet();
|
||||||
final IChunkSet set = getOrCreateSet();
|
final IChunkSet set = getOrCreateSet();
|
||||||
try {
|
try {
|
||||||
if (region != null) {
|
if (region != null) {
|
||||||
region.filter(this, filter, block, get, set);
|
region.filter(this, filter, block, get, set, full);
|
||||||
} else {
|
} else {
|
||||||
block = block.init(chunkX, chunkZ, get);
|
block = block.init(chunkX, chunkZ, get);
|
||||||
for (int layer = 0; layer < 16; layer++) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
System.out.println("Apply layer " + full);
|
||||||
block.init(get, set, layer);
|
block.init(get, set, layer);
|
||||||
block.filter(filter);
|
block.filter(filter);
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ public enum NullChunk implements IQueueChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 static com.sk89q.worldedit.world.block.BlockTypesCache.states;
|
||||||
|
|
||||||
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.beta.Filter;
|
import com.boydti.fawe.beta.Filter;
|
||||||
import com.boydti.fawe.beta.FilterBlockMask;
|
import com.boydti.fawe.beta.FilterBlockMask;
|
||||||
import com.boydti.fawe.beta.Flood;
|
import com.boydti.fawe.beta.Flood;
|
||||||
@ -65,7 +66,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
|
|||||||
FilterBlockMask mask) {
|
FilterBlockMask mask) {
|
||||||
final int maxDepth = flood.getMaxDepth();
|
final int maxDepth = flood.getMaxDepth();
|
||||||
final boolean checkDepth = maxDepth < Character.MAX_VALUE;
|
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) {
|
while ((index = flood.poll()) != -1) {
|
||||||
x = index & 15;
|
x = index & 15;
|
||||||
z = index >> 4 & 15;
|
z = index >> 4 & 15;
|
||||||
@ -89,10 +90,11 @@ public class CharFilterBlock extends ChunkFilterBlock {
|
|||||||
this.layer = layer;
|
this.layer = layer;
|
||||||
final CharGetBlocks get = (CharGetBlocks) iget;
|
final CharGetBlocks get = (CharGetBlocks) iget;
|
||||||
if (!get.hasSection(layer)) {
|
if (!get.hasSection(layer)) {
|
||||||
return null;
|
getArr = FaweCache.IMP.EMPTY_CHAR_4096;
|
||||||
|
} else {
|
||||||
|
getArr = get.sections[layer].get(get, layer);
|
||||||
}
|
}
|
||||||
this.set = iset;
|
this.set = iset;
|
||||||
getArr = get.sections[layer].get(get, layer);
|
|
||||||
if (set.hasSection(layer)) {
|
if (set.hasSection(layer)) {
|
||||||
setArr = set.load(layer);
|
setArr = set.load(layer);
|
||||||
delegate = FULL;
|
delegate = FULL;
|
||||||
|
@ -449,11 +449,11 @@ public class LimitExtent extends PassthroughExtent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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_CHECKS(region.getArea());
|
||||||
limit.THROW_MAX_CHANGES(region.getArea());
|
limit.THROW_MAX_CHANGES(region.getArea());
|
||||||
try {
|
try {
|
||||||
return getExtent().apply(region, filter);
|
return getExtent().apply(region, filter, full);
|
||||||
} catch (FaweException e) {
|
} catch (FaweException e) {
|
||||||
if (!limit.MAX_FAILS()) {
|
if (!limit.MAX_FAILS()) {
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -73,7 +73,7 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
// The chunks positions to iterate over
|
||||||
final Set<BlockVector2> chunks = region.getChunks();
|
final Set<BlockVector2> chunks = region.getChunks();
|
||||||
final Iterator<BlockVector2> chunksIter = chunks.iterator();
|
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);
|
final int size = Math.min(chunks.size(), Settings.IMP.QUEUE.PARALLEL_THREADS);
|
||||||
if (size <= 1) {
|
if (size <= 1) {
|
||||||
BlockVector2 pos = chunksIter.next();
|
BlockVector2 pos = chunksIter.next();
|
||||||
getExtent().apply(null, filter, region, pos.getX(), pos.getZ());
|
getExtent().apply(null, filter, region, pos.getX(), pos.getZ(), full);
|
||||||
} else {
|
} else {
|
||||||
final ForkJoinTask[] tasks = IntStream.range(0, size).mapToObj(i -> handler.submit(() -> {
|
final ForkJoinTask[] tasks = IntStream.range(0, size).mapToObj(i -> handler.submit(() -> {
|
||||||
try {
|
try {
|
||||||
@ -103,7 +103,7 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
|
|||||||
X = pos.getX();
|
X = pos.getX();
|
||||||
Z = pos.getZ();
|
Z = pos.getZ();
|
||||||
}
|
}
|
||||||
block = queue.apply(block, newFilter, region, X, Z);
|
block = queue.apply(block, newFilter, region, X, Z, full);
|
||||||
}
|
}
|
||||||
queue.flush();
|
queue.flush();
|
||||||
}
|
}
|
||||||
@ -131,20 +131,20 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
|
|||||||
return
|
return
|
||||||
// Apply a filter over a region
|
// Apply a filter over a region
|
||||||
apply(region, searchMask
|
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
|
.getParent() // Get the counter of this mask
|
||||||
.getTotal(); // Get the total from the counter
|
.getTotal(); // Get the total from the counter
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <B extends BlockStateHolder<B>> int setBlocks(Region region, B block) throws MaxChangedBlocksException {
|
public <B extends BlockStateHolder<B>> int setBlocks(Region region, B block) throws MaxChangedBlocksException {
|
||||||
apply(region, block);
|
apply(region, block, true);
|
||||||
return getChanges();
|
return getChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int setBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException {
|
public int setBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException {
|
||||||
apply(region, pattern);
|
apply(region, pattern, true);
|
||||||
return getChanges();
|
return getChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,18 +163,18 @@ public class ParallelQueueExtent extends PassthroughExtent implements IQueueWrap
|
|||||||
@Override
|
@Override
|
||||||
public int replaceBlocks(Region region, Mask mask, Pattern pattern)
|
public int replaceBlocks(Region region, Mask mask, Pattern pattern)
|
||||||
throws MaxChangedBlocksException {
|
throws MaxChangedBlocksException {
|
||||||
apply(region, mask.toFilter(pattern));
|
apply(region, mask.toFilter(pattern), false);
|
||||||
return getChanges();
|
return getChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Countable<BlockState>> getBlockDistributionWithData(Region region) {
|
public List<Countable<BlockState>> getBlockDistributionWithData(Region region) {
|
||||||
return apply(region, new DistrFilter()).getDistribution();
|
return apply(region, new DistrFilter(), false).getDistribution();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Countable<BlockType>> getBlockDistribution(Region region) {
|
public List<Countable<BlockType>> getBlockDistribution(Region region) {
|
||||||
return apply(region, new DistrFilter()).getTypeDistribution();
|
return apply(region, new DistrFilter(), false).getTypeDistribution();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -562,14 +562,14 @@ public class MCAChunk implements IChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void filterBlocks(Filter filter, ChunkFilterBlock block, @Nullable Region region) {
|
public void filterBlocks(Filter filter, ChunkFilterBlock block, @Nullable Region region, boolean full) {
|
||||||
try {
|
try {
|
||||||
if (region != null) {
|
if (region != null) {
|
||||||
region.filter(this, filter, block, this, this);
|
region.filter(this, filter, block, this, this, full);
|
||||||
} else {
|
} else {
|
||||||
block = block.init(chunkX, chunkZ, this);
|
block = block.init(chunkX, chunkZ, this);
|
||||||
for (int layer = 0; layer < 16; layer++) {
|
for (int layer = 0; layer < 16; layer++) {
|
||||||
if (!this.hasSection(layer) || !filter.appliesLayer(this, layer)) {
|
if ((!full && !this.hasSection(layer)) || !filter.appliesLayer(this, layer)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
block.init(this, this, layer);
|
block.init(this, this, layer);
|
||||||
|
@ -39,6 +39,7 @@ public class PlotSquaredFeature extends FaweMaskManager {
|
|||||||
super("PlotSquared");
|
super("PlotSquared");
|
||||||
Fawe.debug("Optimizing PlotSquared");
|
Fawe.debug("Optimizing PlotSquared");
|
||||||
if (com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_HOOK) {
|
if (com.boydti.fawe.config.Settings.IMP.PLOTSQUARED_HOOK) {
|
||||||
|
Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false;
|
||||||
setupBlockQueue();
|
setupBlockQueue();
|
||||||
setupSchematicHandler();
|
setupSchematicHandler();
|
||||||
setupChunkManager();
|
setupChunkManager();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.sk89q.worldedit.extension.platform.binding;
|
package com.sk89q.worldedit.extension.platform.binding;
|
||||||
|
|
||||||
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.util.StringMan;
|
import com.boydti.fawe.util.StringMan;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.internal.annotation.Selection;
|
import com.sk89q.worldedit.internal.annotation.Selection;
|
||||||
@ -55,7 +56,7 @@ public class Bindings {
|
|||||||
Annotation annotation = annotations[0] == binding ? annotations[1] : annotations[0];
|
Annotation annotation = annotations[0] == binding ? annotations[1] : annotations[0];
|
||||||
key = Key.of(ret, annotation);
|
key = Key.of(ret, annotation);
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Cannot annotate: " + method + " with " + StringMan.getString(annotations));
|
Fawe.debug("Cannot annotate: " + method + " with " + StringMan.getString(annotations));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ public class ProvideBindings extends Bindings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Binding
|
@Binding
|
||||||
public Extent getExtent(Actor actor, InjectedValueAccess access, InjectedValueStore store) {
|
public Extent getExtent(Actor actor, InjectedValueAccess access) {
|
||||||
Optional<EditSession> editSessionOpt = access.injectedValue(Key.of(EditSession.class));
|
Optional<EditSession> editSessionOpt = access.injectedValue(Key.of(EditSession.class));
|
||||||
if (editSessionOpt.isPresent()) {
|
if (editSessionOpt.isPresent()) {
|
||||||
return editSessionOpt.get();
|
return editSessionOpt.get();
|
||||||
@ -102,7 +102,10 @@ public class ProvideBindings extends Bindings {
|
|||||||
}
|
}
|
||||||
Player plr = getPlayer(actor);
|
Player plr = getPlayer(actor);
|
||||||
EditSession editSession = editSession(getLocalSession(plr), plr);
|
EditSession editSession = editSession(getLocalSession(plr), plr);
|
||||||
store.injectValue(Key.of(EditSession.class), ValueProvider.constant(editSession));
|
if (access instanceof InjectedValueStore) {
|
||||||
|
InjectedValueStore store = (InjectedValueStore) access;
|
||||||
|
store.injectValue(Key.of(EditSession.class), ValueProvider.constant(editSession));
|
||||||
|
}
|
||||||
return editSession;
|
return editSession;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -652,7 +652,7 @@ public interface Extent extends InputExtent, OutputExtent {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
default <T extends Filter> T apply(Region region, T filter) {
|
default <T extends Filter> T apply(Region region, T filter, boolean full) {
|
||||||
return apply((Iterable<BlockVector3>) region, filter);
|
return apply((Iterable<BlockVector3>) region, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.sk89q.worldedit.extent;
|
package com.sk89q.worldedit.extent;
|
||||||
|
|
||||||
|
import com.boydti.fawe.beta.Filter;
|
||||||
import com.boydti.fawe.beta.IBatchProcessor;
|
import com.boydti.fawe.beta.IBatchProcessor;
|
||||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
@ -250,4 +251,14 @@ public class PassthroughExtent extends AbstractDelegateExtent {
|
|||||||
public boolean isWorld() {
|
public boolean isWorld() {
|
||||||
return getExtent().isWorld();
|
return getExtent().isWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T extends Filter> T apply(Region region, T filter, boolean full) {
|
||||||
|
return getExtent().apply(region, filter, full);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T extends Filter> T apply(Iterable<BlockVector3> positions, T filter) {
|
||||||
|
return getExtent().apply(positions, filter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default <T extends Filter> T apply(Region region, T filter) {
|
default <T extends Filter> T apply(Region region, T filter, boolean full) {
|
||||||
if (region.equals(getRegion())) {
|
if (region.equals(getRegion())) {
|
||||||
return apply(this, filter);
|
return apply(this, filter);
|
||||||
} else {
|
} else {
|
||||||
|
@ -671,14 +671,14 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void filter(final IChunk chunk, final Filter filter, ChunkFilterBlock block, final IChunkGet get, final IChunkSet set) {
|
public void filter(final IChunk chunk, final Filter filter, ChunkFilterBlock block, final IChunkGet get, final IChunkSet set, boolean full) {
|
||||||
int chunkX = chunk.getX();
|
int chunkX = chunk.getX();
|
||||||
int chunkZ = chunk.getZ();
|
int chunkZ = chunk.getZ();
|
||||||
block = block.init(chunkX, chunkZ, get);
|
block = block.init(chunkX, chunkZ, get);
|
||||||
|
|
||||||
|
|
||||||
if ((minX + 15) >> 4 <= chunkX && (maxX - 15) >> 4 >= chunkX && (minZ + 15) >> 4 <= chunkZ && (maxZ - 15) >> 4 >= chunkZ) {
|
if ((minX + 15) >> 4 <= chunkX && (maxX - 15) >> 4 >= chunkX && (minZ + 15) >> 4 <= chunkZ && (maxZ - 15) >> 4 >= chunkZ) {
|
||||||
filter(chunk, filter, block, get, set, minY, maxY);
|
filter(chunk, filter, block, get, set, minY, maxY, full);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int localMinX = Math.max(minX, chunkX << 4) & 15;
|
int localMinX = Math.max(minX, chunkX << 4) & 15;
|
||||||
@ -692,19 +692,19 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
|
|||||||
int minSection = minY >> 4;
|
int minSection = minY >> 4;
|
||||||
int maxSection = maxY >> 4;
|
int maxSection = maxY >> 4;
|
||||||
if (minSection == maxSection) {
|
if (minSection == maxSection) {
|
||||||
filter(chunk, filter, block, get, set, minSection, localMinX, yStart, localMinZ, localMaxX, yEnd, localMaxZ);
|
filter(chunk, filter, block, get, set, minSection, localMinX, yStart, localMinZ, localMaxX, yEnd, localMaxZ, full);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (yStart != 0) {
|
if (yStart != 0) {
|
||||||
filter(chunk, filter, block, get, set, minSection, localMinX, yStart, localMinZ, localMaxX, 15, localMaxZ);
|
filter(chunk, filter, block, get, set, minSection, localMinX, yStart, localMinZ, localMaxX, 15, localMaxZ, full);
|
||||||
minSection++;
|
minSection++;
|
||||||
}
|
}
|
||||||
if (yEnd != 15) {
|
if (yEnd != 15) {
|
||||||
filter(chunk, filter, block, get, set, minSection, localMinX, 0, localMinZ, localMaxX, 15, localMaxZ);
|
filter(chunk, filter, block, get, set, minSection, localMinX, 0, localMinZ, localMaxX, 15, localMaxZ, full);
|
||||||
maxSection--;
|
maxSection--;
|
||||||
}
|
}
|
||||||
for (int layer = minSection; layer <= maxSection; layer++) {
|
for (int layer = minSection; layer <= maxSection; layer++) {
|
||||||
filter(chunk, filter, block, get, set, layer, localMinX, yStart, localMinZ, localMaxX, yEnd, localMaxZ);
|
filter(chunk, filter, block, get, set, layer, localMinX, yStart, localMinZ, localMaxX, yEnd, localMaxZ, full);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,15 +406,15 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void filter(final IChunk chunk, final Filter filter, final ChunkFilterBlock block,
|
public void filter(final IChunk chunk, final Filter filter, final ChunkFilterBlock block,
|
||||||
final IChunkGet get, final IChunkSet set) {
|
final IChunkGet get, final IChunkSet set, boolean full) {
|
||||||
int bcx = chunk.getX() >> 4;
|
int bcx = chunk.getX() >> 4;
|
||||||
int bcz = chunk.getZ() >> 4;
|
int bcz = chunk.getZ() >> 4;
|
||||||
int tcx = bcx + 15;
|
int tcx = bcx + 15;
|
||||||
int tcz = bcz + 15;
|
int tcz = bcz + 15;
|
||||||
if (contains(bcx, bcz) && contains(tcx, tcz)) {
|
if (contains(bcx, bcz) && contains(tcx, tcz)) {
|
||||||
filter(chunk, filter, block, get, set, minY, maxY);
|
filter(chunk, filter, block, get, set, minY, maxY, full);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
super.filter(chunk, filter, block, get, set);
|
super.filter(chunk, filter, block, get, set, full);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,7 @@ public class EllipsoidRegion extends AbstractRegion {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void filter(IChunk chunk, Filter filter, ChunkFilterBlock block, IChunkGet get, IChunkSet set) {
|
public void filter(IChunk chunk, Filter filter, ChunkFilterBlock block, IChunkGet get, IChunkSet set, boolean full) {
|
||||||
// Check bounds
|
// Check bounds
|
||||||
// This needs to be able to perform 50M blocks/sec otherwise it becomes a bottleneck
|
// This needs to be able to perform 50M blocks/sec otherwise it becomes a bottleneck
|
||||||
int cx = center.getBlockX();
|
int cx = center.getBlockX();
|
||||||
@ -385,7 +385,7 @@ public class EllipsoidRegion extends AbstractRegion {
|
|||||||
int yBotFull = Math.max(0, cy - diffYFull);
|
int yBotFull = Math.max(0, cy - diffYFull);
|
||||||
int yTopFull = Math.min(255, cy + diffYFull);
|
int yTopFull = Math.min(255, cy + diffYFull);
|
||||||
// Set those layers
|
// Set those layers
|
||||||
filter(chunk, filter, block, get, set, yBotFull, yTopFull);
|
filter(chunk, filter, block, get, set, yBotFull, yTopFull, full);
|
||||||
|
|
||||||
// Fill the remaining layers
|
// Fill the remaining layers
|
||||||
if (yBotFull != 0 || yTopFull != 255) {
|
if (yBotFull != 0 || yTopFull != 255) {
|
||||||
@ -405,7 +405,7 @@ public class EllipsoidRegion extends AbstractRegion {
|
|||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
super.filter(chunk, filter, block, get, set); // TODO optimize non spheres
|
super.filter(chunk, filter, block, get, set, full); // TODO optimize non spheres
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,53 +203,53 @@ public interface Region extends Iterable<BlockVector3>, Cloneable, IBatchProcess
|
|||||||
return getMaximumPoint().getY();
|
return getMaximumPoint().getY();
|
||||||
}
|
}
|
||||||
|
|
||||||
default void filter(final IChunk chunk, final Filter filter, ChunkFilterBlock block, final IChunkGet get, final IChunkSet set) {
|
default void filter(final IChunk chunk, final Filter filter, ChunkFilterBlock block, final IChunkGet get, final IChunkSet set, boolean full) {
|
||||||
int minSection = Math.max(0, getMinimumY() >> 4);
|
int minSection = Math.max(0, getMinimumY() >> 4);
|
||||||
int maxSection = Math.min(15, getMaximumY() >> 4);
|
int maxSection = Math.min(15, getMaximumY() >> 4);
|
||||||
for (int layer = minSection; layer <= maxSection; layer++) {
|
for (int layer = minSection; layer <= maxSection; layer++) {
|
||||||
if (!get.hasSection(layer) || !filter.appliesLayer(chunk, layer)) return;
|
if ((!full && !get.hasSection(layer)) || !filter.appliesLayer(chunk, layer)) return;
|
||||||
block = block.init(get, set, layer);
|
block = block.init(get, set, layer);
|
||||||
block.filter(filter, this);
|
block.filter(filter, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
default void filter(final IChunk chunk, final Filter filter, ChunkFilterBlock block, final IChunkGet get, final IChunkSet set, final int minY, final int maxY) {
|
default void filter(final IChunk chunk, final Filter filter, ChunkFilterBlock block, final IChunkGet get, final IChunkSet set, final int minY, final int maxY, boolean full) {
|
||||||
int minSection = minY >> 4;
|
int minSection = minY >> 4;
|
||||||
int maxSection = maxY >> 4;
|
int maxSection = maxY >> 4;
|
||||||
int yStart = (minY & 15);
|
int yStart = (minY & 15);
|
||||||
int yEnd = (maxY & 15);
|
int yEnd = (maxY & 15);
|
||||||
if (minSection == maxSection) {
|
if (minSection == maxSection) {
|
||||||
filter(chunk, filter, block, get, set, minSection, yStart, yEnd);
|
filter(chunk, filter, block, get, set, minSection, yStart, yEnd, full);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (yStart != 0) {
|
if (yStart != 0) {
|
||||||
filter(chunk, filter, block, get, set, minSection, yStart, 15);
|
filter(chunk, filter, block, get, set, minSection, yStart, 15, full);
|
||||||
minSection++;
|
minSection++;
|
||||||
}
|
}
|
||||||
if (yEnd != 15) {
|
if (yEnd != 15) {
|
||||||
filter(chunk, filter, block, get, set, minSection, 0, yEnd);
|
filter(chunk, filter, block, get, set, minSection, 0, yEnd, full);
|
||||||
maxSection--;
|
maxSection--;
|
||||||
}
|
}
|
||||||
for (int layer = minSection; layer <= maxSection; layer++) {
|
for (int layer = minSection; layer <= maxSection; layer++) {
|
||||||
filter(chunk, filter, block, get, set, layer);
|
filter(chunk, filter, block, get, set, layer, full);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
default void filter(final IChunk chunk, final Filter filter, ChunkFilterBlock block, final IChunkGet get, final IChunkSet set, int layer) {
|
default void filter(final IChunk chunk, final Filter filter, ChunkFilterBlock block, final IChunkGet get, final IChunkSet set, int layer, boolean full) {
|
||||||
if (!get.hasSection(layer) || !filter.appliesLayer(chunk, layer)) return;
|
if ((!full && !get.hasSection(layer)) || !filter.appliesLayer(chunk, layer)) return;
|
||||||
block = block.init(get, set, layer);
|
block = block.init(get, set, layer);
|
||||||
block.filter(filter);
|
block.filter(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
default void filter(final IChunk chunk, final Filter filter, ChunkFilterBlock block, final IChunkGet get, final IChunkSet set, int layer, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) {
|
default void filter(final IChunk chunk, final Filter filter, ChunkFilterBlock block, final IChunkGet get, final IChunkSet set, int layer, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, boolean full) {
|
||||||
if (!get.hasSection(layer) || !filter.appliesLayer(chunk, layer)) return;
|
if ((!full && !get.hasSection(layer)) || !filter.appliesLayer(chunk, layer)) return;
|
||||||
block = block.init(get, set, layer);
|
block = block.init(get, set, layer);
|
||||||
block.filter(filter, minX, minY, minZ, maxX, maxY, maxZ);
|
block.filter(filter, minX, minY, minZ, maxX, maxY, maxZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
default void filter(final IChunk chunk, final Filter filter, ChunkFilterBlock block, final IChunkGet get, final IChunkSet set, int layer, int yStart, int yEnd) {
|
default void filter(final IChunk chunk, final Filter filter, ChunkFilterBlock block, final IChunkGet get, final IChunkSet set, int layer, int yStart, int yEnd, boolean full) {
|
||||||
if (!get.hasSection(layer) || !filter.appliesLayer(chunk, layer)) return;
|
if ((!full && !get.hasSection(layer)) || !filter.appliesLayer(chunk, layer)) return;
|
||||||
block = block.init(get, set, layer);
|
block = block.init(get, set, layer);
|
||||||
block.filter(filter, yStart, yEnd);
|
block.filter(filter, yStart, yEnd);
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren