Re-added #false and #true masks

This commit is contained in:
MattBDev 2020-02-05 17:44:33 -05:00
parent 27e2b95218
commit 1ee362a878
4 changed files with 65 additions and 92 deletions

View File

@ -89,22 +89,6 @@
// } // }
// //
// @Command( // @Command(
// name = "#false",
// desc = "Always false"
// )
// public Mask falseMask(Extent extent) {
// return Masks.alwaysFalse();
// }
//
// @Command(
// name = "#true",
// desc = "Always true"
// )
// public Mask trueMask(Extent extent) {
// return Masks.alwaysTrue();
// }
//
// @Command(
// name = "#skylight", // name = "#skylight",
// desc = "Restrict to specific sky light levels" // desc = "Restrict to specific sky light levels"
// ) // )
@ -162,22 +146,6 @@
// } // }
// //
// @Command( // @Command(
// name = "#existing",
// desc = "If there is a non air block"
// )
// public Mask existing(Extent extent) {
// return new ExistingBlockMask(extent);
// }
//
// @Command(
// name = "#solid",
// desc = "If there is a solid block"
// )
// public Mask solid(Extent extent) {
// return new SolidBlockMask(extent);
// }
//
// @Command(
// name = "#liquid", // name = "#liquid",
// desc = "If there is a solid block" // desc = "If there is a solid block"
// ) // )
@ -386,64 +354,4 @@
// return new AdjacentMask(mask, (int) min, (int) max); // return new AdjacentMask(mask, (int) min, (int) max);
// } // }
// //
// @Command(
// name = "<",
// aliases = {"#<", "#below"},
// desc = "below a specific block"
//)
// public Mask below(@Arg(desc = "Mask") Mask mask) throws ExpressionException {
// OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, 1, 0));
// return new MaskIntersection(offsetMask, Masks.negate(mask));
// }
//
// @Command(
// name = ">",
// aliases = {"#>", "#above"},
// desc = "above a specific block"
//)
// public Mask above(@Arg(desc = "Mask") Mask mask) throws ExpressionException {
// OffsetMask offsetMask = new OffsetMask(mask, BlockVector3.at(0, -1, 0));
// return new MaskIntersection(offsetMask, Masks.negate(mask));
// }
//
// @Command(
// name = "$",
// aliases = {"#biome", "#$"},
// desc = "in a specific biome",
// descFooter = "in a specific biome. For a list of biomes use //biomelist"
//)
// public Mask biome(Extent extent, @Arg(desc = "BiomeType") BiomeType biome) throws ExpressionException {
// return new BiomeMask(extent, biome);
// }
//
// @Command(
// name = "%",
// aliases = {"#%", "#percent"},
// desc = "percentage chance"
//)
// public Mask random(@Arg(desc = "double chance") double chance) throws ExpressionException {
// chance = chance / 100;
// return new RandomMask(chance);
// }
//
// @Command(
// name = "=",
// aliases = {"#=", "#expression"},
// desc = "expression mask"
//)
// public Mask expression(Extent extent, @Arg(desc = "String expression") String input) throws ExpressionException {
// Expression exp = Expression.compile(input, "x", "y", "z");
// ExpressionEnvironment env = new WorldEditExpressionEnvironment(extent, Vector3.ONE, Vector3.ZERO);
// exp.setEnvironment(env);
// return new ExpressionMask(exp);
// }
//
// @Command(
// name = "!",
// aliases = {"#not", "#negate", "#!"},
// desc = "Negate another mask"
//)
// public Mask negate(@Arg(desc = "Mask") Mask mask) throws ExpressionException {
// return Masks.negate(mask);
// }
//} //}

View File

@ -26,12 +26,14 @@ import com.sk89q.worldedit.extension.factory.parser.mask.BlockStateMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.BlocksMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.BlocksMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.ExistingMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.ExistingMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.ExpressionMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.ExpressionMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.FalseMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.LazyRegionMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.LazyRegionMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.NegateMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.NegateMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.NoiseMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.NoiseMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.OffsetMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.OffsetMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.RegionMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.RegionMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.SolidMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.SolidMaskParser;
import com.sk89q.worldedit.extension.factory.parser.mask.TrueMaskParser;
import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.NoMatchException; import com.sk89q.worldedit.extension.input.NoMatchException;
import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extension.input.ParserContext;
@ -72,6 +74,9 @@ public final class MaskFactory extends AbstractFactory<Mask> {
register(new ExpressionMaskParser(worldEdit)); register(new ExpressionMaskParser(worldEdit));
register(new BlockCategoryMaskParser(worldEdit)); register(new BlockCategoryMaskParser(worldEdit));
register(new BiomeMaskParser(worldEdit)); register(new BiomeMaskParser(worldEdit));
// Mask Parsers from FAWE
register(new FalseMaskParser(worldEdit));
register(new TrueMaskParser(worldEdit));
} }

View File

@ -0,0 +1,30 @@
package com.sk89q.worldedit.extension.factory.parser.mask;
import com.google.common.collect.ImmutableList;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.Masks;
import com.sk89q.worldedit.internal.registry.SimpleInputParser;
import java.util.List;
public class FalseMaskParser extends SimpleInputParser<Mask> {
private final List<String> aliases = ImmutableList.of("#false");
public FalseMaskParser(WorldEdit worldEdit) {
super(worldEdit);
}
@Override
public List<String> getMatchedAliases() {
return aliases;
}
@Override
public Mask parseFromSimpleInput(String input, ParserContext context) {
return Masks.alwaysFalse();
}
}

View File

@ -0,0 +1,30 @@
package com.sk89q.worldedit.extension.factory.parser.mask;
import com.google.common.collect.ImmutableList;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.Masks;
import com.sk89q.worldedit.internal.registry.SimpleInputParser;
import java.util.List;
public class TrueMaskParser extends SimpleInputParser<Mask> {
private final List<String> aliases = ImmutableList.of("#true");
public TrueMaskParser(WorldEdit worldEdit) {
super(worldEdit);
}
@Override
public List<String> getMatchedAliases() {
return aliases;
}
@Override
public Mask parseFromSimpleInput(String input, ParserContext context) {
return Masks.alwaysTrue();
}
}