mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-12 08:18:35 +00:00
Fix #647
This commit is contained in:
@ -3,6 +3,7 @@ package com.boydti.fawe.beta.implementation.filter;
|
||||
import com.boydti.fawe.beta.Filter;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.DelegateFilter;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
|
||||
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
@ -33,7 +34,12 @@ public class MaskFilter<T extends Filter> extends DelegateFilter<T> {
|
||||
|
||||
@Override
|
||||
public void applyBlock(FilterBlock block) {
|
||||
if (mask.test(block)) {
|
||||
if (mask instanceof AbstractExtentMask) {
|
||||
if (((AbstractExtentMask) mask).test(block, block)) {
|
||||
getParent().applyBlock(block);
|
||||
this.changes++;
|
||||
}
|
||||
} else if (mask.test(block)) {
|
||||
getParent().applyBlock(block);
|
||||
this.changes++;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized final IQueueChunk getOrCreateChunk(int x, int z) {
|
||||
public final IQueueChunk getOrCreateChunk(int x, int z) {
|
||||
final long pair = (long) x << 32 | z & 0xffffffffL;
|
||||
if (pair == lastPair) {
|
||||
return lastChunk;
|
||||
|
@ -87,6 +87,12 @@ public class ImageBrush implements Brush {
|
||||
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(new AbstractExtentMask(editSession) {
|
||||
private final MutableVector3 mutable = new MutableVector3();
|
||||
|
||||
@Override
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
return test(vector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
if (solid.test(vector)) {
|
||||
|
@ -6,6 +6,7 @@ import com.boydti.fawe.object.mask.RadiusMask;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.command.tool.brush.Brush;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
|
||||
import com.sk89q.worldedit.function.mask.BlockMask;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
@ -47,6 +48,11 @@ public class LayerBrush implements Brush {
|
||||
Operations.completeBlindly(visitor);
|
||||
BlockVectorSet visited = visitor.getVisited();
|
||||
visitor = new RecursiveVisitor(new AbstractExtentMask(editSession) {
|
||||
@Override
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
return test(vector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 pos) {
|
||||
int depth = visitor.getDepth() + 1;
|
||||
|
@ -4,6 +4,7 @@ import com.boydti.fawe.object.collection.LocalBlockVectorSet;
|
||||
import com.boydti.fawe.object.mask.SurfaceMask;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
@ -36,6 +37,11 @@ public class SplatterBrush extends ScatterBrush {
|
||||
SurfaceMask surface = new SurfaceMask(editSession);
|
||||
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(new AbstractExtentMask(editSession) {
|
||||
@Override
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
return test(vector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
double dist = vector.distanceSq(position);
|
||||
|
@ -4,6 +4,7 @@ import com.boydti.fawe.object.brush.heightmap.HeightMap;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
|
||||
import com.sk89q.worldedit.function.mask.SolidBlockMask;
|
||||
@ -55,6 +56,11 @@ public class StencilBrush extends HeightBrush {
|
||||
|
||||
double scale = (yscale / sizeDouble) * (maxY + 1);
|
||||
RecursiveVisitor visitor = new RecursiveVisitor(new AbstractExtentMask(editSession) {
|
||||
@Override
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
return test(vector);
|
||||
}
|
||||
|
||||
private final MutableVector3 mutable = new MutableVector3();
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
|
@ -22,6 +22,16 @@ public class DataMask extends AbstractExtentMask implements ResettableMask {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
if (data != -1) {
|
||||
return extent.getBlock(vector).getInternalPropertiesId() == data;
|
||||
} else {
|
||||
data = extent.getBlock(vector).getInternalPropertiesId();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
this.data = -1;
|
||||
|
@ -12,7 +12,7 @@ public class IdDataMask extends AbstractExtentMask implements ResettableMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
if (combined != -1) {
|
||||
return getExtent().getBlock(vector).getInternalId() == combined;
|
||||
} else {
|
||||
@ -21,6 +21,11 @@ public class IdDataMask extends AbstractExtentMask implements ResettableMask {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return test(getExtent(), vector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
this.combined = -1;
|
||||
|
@ -13,15 +13,20 @@ public class IdMask extends AbstractExtentMask implements ResettableMask {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
public boolean test(Extent extent, BlockVector3 vector) {
|
||||
if (id != -1) {
|
||||
return getExtent().getBlock(vector).getInternalBlockTypeId() == id;
|
||||
return extent.getBlock(vector).getInternalBlockTypeId() == id;
|
||||
} else {
|
||||
id = getExtent().getBlock(vector).getInternalBlockTypeId();
|
||||
id = extent.getBlock(vector).getInternalBlockTypeId();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(BlockVector3 vector) {
|
||||
return test(getExtent(), vector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
this.id = -1;
|
||||
|
Reference in New Issue
Block a user