Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-26 02:50:06 +01:00
Ursprung
7a6a0f68fe
Commit
f886320c44
@ -12,8 +12,8 @@ public class AdjacentAnyMask extends AbstractMask implements ResettableMask {
|
||||
|
||||
private final CachedMask mask;
|
||||
private final MutableBlockVector3 mutable;
|
||||
private final int minY;
|
||||
private final int maxY;
|
||||
final int minY;
|
||||
final int maxY;
|
||||
|
||||
public AdjacentAnyMask(Mask mask, int minY, int maxY) {
|
||||
this.mask = CachedMask.cache(mask);
|
||||
@ -22,6 +22,13 @@ public class AdjacentAnyMask extends AbstractMask implements ResettableMask {
|
||||
this.maxY = maxY;
|
||||
}
|
||||
|
||||
AdjacentAnyMask(CachedMask mask, int minY, int maxY) {
|
||||
this.mask = CachedMask.cache(mask);
|
||||
mutable = new MutableBlockVector3();
|
||||
this.minY = minY;
|
||||
this.maxY = maxY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
mutable.setComponents(0, 0, 0);
|
||||
@ -59,7 +66,7 @@ public class AdjacentAnyMask extends AbstractMask implements ResettableMask {
|
||||
|
||||
@Override
|
||||
public Mask copy() {
|
||||
return new AdjacentAnyMask(mask.copy(), minY, maxY);
|
||||
return new AdjacentAnyMask((CachedMask) mask.copy(), minY, maxY);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,10 @@ public class SurfaceMask extends AdjacentAnyMask {
|
||||
super(getMask(extent), extent.getMinY(), extent.getMaxY());
|
||||
}
|
||||
|
||||
private SurfaceMask(CachedMask mask, int minY, int maxY) {
|
||||
super(mask, minY, maxY);
|
||||
}
|
||||
|
||||
public static AbstractExtentMask getMask(Extent extent) {
|
||||
return new BlockMaskBuilder()
|
||||
.addTypes(BlockTypes.AIR, BlockTypes.CAVE_AIR, BlockTypes.VOID_AIR)
|
||||
@ -26,8 +30,8 @@ public class SurfaceMask extends AdjacentAnyMask {
|
||||
|
||||
@Override
|
||||
public Mask copy() {
|
||||
// The mask is not mutable. There is no need to clone it.
|
||||
return this;
|
||||
// CachedMask (super getParentMask) should not be used from multiple threads.
|
||||
return new SurfaceMask(getParentMask(), minY, maxY);
|
||||
}
|
||||
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren