3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-05 02:50:05 +01:00
Dieser Commit ist enthalten in:
dordsor21 2020-09-21 17:09:17 +01:00
Ursprung 3b2fe2ffde
Commit 3b660756f6
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
17 geänderte Dateien mit 84 neuen und 17 gelöschten Zeilen

Datei anzeigen

@ -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++;
}

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -15,6 +15,10 @@ public abstract class ABlockMask extends AbstractExtentMask {
super(extent);
}
@Override public boolean test(Extent extent, BlockVector3 vector) {
return test(extent.getBlock(vector));
}
@Override public boolean test(BlockVector3 vector) {
return test(getExtent().getBlock(vector));
}

Datei anzeigen

@ -20,6 +20,7 @@
package com.sk89q.worldedit.function.mask;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import static com.google.common.base.Preconditions.checkNotNull;
@ -59,4 +60,6 @@ public abstract class AbstractExtentMask extends AbstractMask {
this.extent = extent;
}
abstract public boolean test(Extent extent, BlockVector3 position);
}

Datei anzeigen

@ -46,6 +46,11 @@ public class BlockCategoryMask extends AbstractExtentMask {
return category.contains(getExtent().getBlock(vector));
}
@Override
public boolean test(Extent extent, BlockVector3 vector) {
return category.contains(extent.getBlock(vector));
}
@Nullable
@Override
public Mask2D toMask2D() {

Datei anzeigen

@ -57,6 +57,11 @@ public class BlockStateMask extends AbstractExtentMask {
return test(getExtent().getBlock(vector));
}
@Override
public boolean test(Extent extent, BlockVector3 vector) {
return test(extent.getBlock(vector));
}
public boolean test(BlockState block) {
final Map<Property<Object>, Object> checkProps = cache
.computeIfAbsent(block.getBlockType(), (b -> Blocks.resolveProperties(states, b)));

Datei anzeigen

@ -114,6 +114,11 @@ public class BlockTypeMask extends AbstractExtentMask {
return test(getExtent().getBlock(vector).getBlockType());
}
@Override
public boolean test(Extent extent, BlockVector3 vector) {
return test(extent.getBlock(vector).getBlockType());
}
@Override
public boolean replacesAir() {
return hasAir;

Datei anzeigen

@ -1,11 +0,0 @@
package com.sk89q.worldedit.function.mask;
import com.boydti.fawe.object.function.mask.AbstractDelegateMask;
public class DelegateExtentMask extends AbstractDelegateMask {
public DelegateExtentMask(Mask parent) {
super(parent);
}
}

Datei anzeigen

@ -44,6 +44,11 @@ public class ExistingBlockMask extends AbstractExtentMask {
return !getExtent().getBlock(vector).getBlockType().getMaterial().isAir();
}
@Override
public boolean test(Extent extent, BlockVector3 vector) {
return !extent.getBlock(vector).getBlockType().getMaterial().isAir();
}
@Nullable
@Override
public Mask2D toMask2D() {

Datei anzeigen

@ -1,6 +1,7 @@
package com.sk89q.worldedit.function.mask;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;