Reimplement Masks + Fixes

Masks Reimplemented:
    - Adjacent (~): Adjacent to a specific number of other blocks.
        - Example: ~[oak_log][1][4]
    - Extrema (#extrema): Restrict to near specific terrain extrema. The "-o" flag will only overlay existing terrain.
        - Example: #extrema[0d][45d][-o]
    - ROC Angle (#roc): Restrict to near specific terrain slope rate of change. The "-o" flag will only overlay existing terrain.
        - Example: #roc[0d][45d][-o]
    - Surface (#surface): Restrict to surfaces (any solid block touching air).
        - Example: #surface
    - Wall (#wall): Restrict to walls (any block n,e,s,w of air).
        - Example: #wall

Other Changes:
    - Minor logic change to angle mask's overlay.
    - Fixed negating air mask.
    - Added overlay flag to angle (/) mask.
This commit is contained in:
IronApollo
2020-09-06 18:42:43 -04:00
parent ee49627e51
commit 6807ccd960
12 changed files with 307 additions and 207 deletions

View File

@ -1,8 +1,8 @@
package com.boydti.fawe.object.mask;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.AbstractExtentMask;
import com.sk89q.worldedit.function.mask.AbstractMask;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector3;
@ -14,7 +14,7 @@ public class AdjacentAnyMask extends AbstractMask implements ResettableMask {
private final CachedMask mask;
private final MutableBlockVector3 mutable;
public AdjacentAnyMask(AbstractExtentMask mask) {
public AdjacentAnyMask(Mask mask) {
this.mask = CachedMask.cache(mask);
mutable = new MutableBlockVector3();
}

View File

@ -166,11 +166,9 @@ public class AngleMask extends SolidBlockMask implements ResettableMask {
return false;
}
if (overlay) {
if (y < 255 && !mask.test(extent, x, y + 1, z)) {
if (y < 255 && !adjacentAir(extent, vector)) {
return lastValue = false;
}
} else if (!adjacentAir(extent, vector)) {
return false;
}
return testSlope(extent, x, y, z);
}