diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java index a63b194659..b5f91ff2aa 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/MaskFactory.java @@ -29,6 +29,7 @@ import com.sk89q.worldedit.extension.factory.parser.mask.ExistingMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.ExposedMaskParser; import com.sk89q.worldedit.extension.factory.parser.mask.ExpressionMaskParser; +import com.sk89q.worldedit.extension.factory.parser.mask.FullCubeMaskParser; 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.NoiseMaskParser; @@ -71,6 +72,7 @@ public MaskFactory(WorldEdit worldEdit) { register(new AirMaskParser(worldEdit)); register(new ExposedMaskParser(worldEdit)); register(new SolidMaskParser(worldEdit)); + register(new FullCubeMaskParser(worldEdit)); register(new LazyRegionMaskParser(worldEdit)); register(new RegionMaskParser(worldEdit)); register(new OffsetMaskParser(worldEdit)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/FullCubeMaskParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/FullCubeMaskParser.java new file mode 100644 index 0000000000..90effacbe3 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/mask/FullCubeMaskParser.java @@ -0,0 +1,49 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.function.mask.FullCubeMask; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.internal.registry.SimpleInputParser; + +import java.util.List; + +public class FullCubeMaskParser extends SimpleInputParser { + + private final List aliases = ImmutableList.of("#fullcube"); + + public FullCubeMaskParser(WorldEdit worldEdit) { + super(worldEdit); + } + + @Override + public List getMatchedAliases() { + return aliases; + } + + @Override + public Mask parseFromSimpleInput(String input, ParserContext context) throws InputParseException { + return new FullCubeMask(context.requireExtent()); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/FullCubeMask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/FullCubeMask.java new file mode 100644 index 0000000000..6eafa8b712 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/FullCubeMask.java @@ -0,0 +1,39 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + +public class FullCubeMask extends AbstractExtentMask { + + public FullCubeMask(Extent extent) { + super(extent); + } + + @Override + public boolean test(BlockVector3 vector) { + Extent extent = getExtent(); + BlockState block = extent.getBlock(vector); + return block.getBlockType().getMaterial().isFullCube(); + } + +}