3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 10:30:04 +01:00

SurfaceMask should be copied properly.

#1331
Dieser Commit ist enthalten in:
dordsor21 2021-09-30 13:17:15 +01:00
Ursprung 7a6a0f68fe
Commit f886320c44
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
2 geänderte Dateien mit 16 neuen und 5 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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