Added new Mask interface and deprecated old one.
This commit is contained in:
@@ -4,8 +4,13 @@ import com.sk89q.worldedit.LocalPlayer;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
|
||||
/**
|
||||
* @deprecated Switch to {@link com.sk89q.worldedit.function.mask.AbstractMask}
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class AbstractMask implements Mask {
|
||||
@Override
|
||||
public void prepare(LocalSession session, LocalPlayer player, Vector target) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.masks;
|
||||
|
||||
/**
|
||||
* An abstract implementaiton of {@link com.sk89q.worldedit.masks.Mask2D}.
|
||||
*/
|
||||
public abstract class AbstractMask2D implements Mask2D {
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.sk89q.worldedit.masks;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Extent;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
|
||||
@@ -9,7 +8,11 @@ import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class BlockMask extends ExtentAwareMask {
|
||||
/**
|
||||
* @deprecated Use {@link com.sk89q.worldedit.function.mask.BlockMask}
|
||||
*/
|
||||
@Deprecated
|
||||
public class BlockMask extends AbstractMask {
|
||||
|
||||
private final Set<BaseBlock> blocks;
|
||||
|
||||
@@ -43,8 +46,7 @@ public class BlockMask extends ExtentAwareMask {
|
||||
|
||||
@Override
|
||||
public boolean matches(EditSession editSession, Vector pos) {
|
||||
Extent extent = getExtent(editSession);
|
||||
BaseBlock block = extent.getBlock(pos);
|
||||
BaseBlock block = editSession.getBlock(pos);
|
||||
return blocks.contains(block)
|
||||
|| blocks.contains(new BaseBlock(block.getType(), -1));
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.masks;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
|
||||
/**
|
||||
* Fails all tests against locations outside a range of Y values.
|
||||
*/
|
||||
public class BoundedYMask extends AbstractMask {
|
||||
|
||||
private final int minY;
|
||||
private final int maxY;
|
||||
|
||||
public BoundedYMask(int minY, int maxY) {
|
||||
if (minY > maxY) {
|
||||
throw new IllegalArgumentException("minY must be less than or equal to maxY");
|
||||
}
|
||||
this.minY = minY;
|
||||
this.maxY = maxY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(EditSession editSession, Vector pos) {
|
||||
int y = pos.getBlockY();
|
||||
return y >= minY && y <= maxY;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,10 +23,15 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalPlayer;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.function.mask.MaskIntersection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @deprecated See {@link MaskIntersection}
|
||||
*/
|
||||
@Deprecated
|
||||
public class CombinedMask extends AbstractMask {
|
||||
private final List<Mask> masks = new ArrayList<Mask>();
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.masks;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
|
||||
/**
|
||||
* A mask that only returns <code>true</code>.
|
||||
*/
|
||||
public class DummyMask extends AbstractMask {
|
||||
|
||||
@Override
|
||||
public boolean matches(EditSession editSession, Vector pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.masks;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
|
||||
/**
|
||||
* A mask that only returns <code>true</code>.
|
||||
*/
|
||||
public class DummyMask2D extends AbstractMask2D {
|
||||
|
||||
@Override
|
||||
public boolean matches(EditSession editSession, Vector2D position) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
||||
public class DynamicRegionMask implements Mask {
|
||||
public class DynamicRegionMask extends AbstractMask {
|
||||
private Region region;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,9 +23,13 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
|
||||
public class ExistingBlockMask extends ExtentAwareMask {
|
||||
/**
|
||||
* @deprecated See {@link com.sk89q.worldedit.function.mask.ExistingBlockMask}
|
||||
*/
|
||||
@Deprecated
|
||||
public class ExistingBlockMask extends AbstractMask {
|
||||
@Override
|
||||
public boolean matches(EditSession editSession, Vector pos) {
|
||||
return getExtent(editSession).getBlockType(pos) != BlockID.AIR;
|
||||
return editSession.getBlockType(pos) != BlockID.AIR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.masks;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Extent;
|
||||
|
||||
/**
|
||||
* Extended by masks to make them potentially use an {@link Extent} rather than
|
||||
* the {@link EditSession}.
|
||||
* </p>
|
||||
* At the moment, masks are coupled to {@link EditSession} when they should
|
||||
* not be. However, because a change to {@link Mask} would cause massive breakage in
|
||||
* the API, that change is deferred until further notice and this class exists as
|
||||
* an opt-in mixin for adding support for {@link Extent}s.
|
||||
*/
|
||||
public abstract class ExtentAwareMask extends AbstractMask {
|
||||
|
||||
private Extent extent;
|
||||
|
||||
/**
|
||||
* Get the extent that will be used for lookups.
|
||||
*
|
||||
* @return the extent, or null if the {@link EditSession} is to be used
|
||||
*/
|
||||
public Extent getExtent() {
|
||||
return extent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the extent that will be used for lookups.
|
||||
*
|
||||
* @param extent the extent, or null if the {@link EditSession} is to be used
|
||||
*/
|
||||
public void setExtent(Extent extent) {
|
||||
this.extent = extent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the extent to use for operations. Subclasses should call this method
|
||||
* rather than access the passed {@link EditSession} directly.
|
||||
*
|
||||
* @param editSession the passed in {@link EditSession}
|
||||
* @return an extent
|
||||
*/
|
||||
protected Extent getExtent(EditSession editSession) {
|
||||
if (extent != null) {
|
||||
return extent;
|
||||
} else {
|
||||
return editSession;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,6 @@
|
||||
package com.sk89q.worldedit.masks;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Extent;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
|
||||
@@ -28,10 +27,10 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Uses {@link BaseBlock#containsFuzzy(java.util.Collection, BaseBlock)} to
|
||||
* match blocks.
|
||||
* @deprecated See {@link com.sk89q.worldedit.function.mask.FuzzyBlockMask}
|
||||
*/
|
||||
public class FuzzyBlockMask extends ExtentAwareMask {
|
||||
@Deprecated
|
||||
public class FuzzyBlockMask extends AbstractMask {
|
||||
|
||||
private final Set<BaseBlock> filter;
|
||||
|
||||
@@ -59,8 +58,7 @@ public class FuzzyBlockMask extends ExtentAwareMask {
|
||||
|
||||
@Override
|
||||
public boolean matches(EditSession editSession, Vector pos) {
|
||||
Extent extent = getExtent(editSession);
|
||||
BaseBlock compare = new BaseBlock(extent.getBlockType(pos), extent.getBlockData(pos));
|
||||
BaseBlock compare = new BaseBlock(editSession.getBlockType(pos), editSession.getBlockData(pos));
|
||||
return BaseBlock.containsFuzzy(filter, compare);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,12 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalPlayer;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.function.mask.Masks;
|
||||
|
||||
/**
|
||||
* @deprecated See {@link Masks#negate(com.sk89q.worldedit.function.mask.Mask)}
|
||||
*/
|
||||
@Deprecated
|
||||
public class InvertedMask extends AbstractMask {
|
||||
private final Mask mask;
|
||||
|
||||
|
||||
@@ -25,13 +25,9 @@ import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
|
||||
/**
|
||||
* Base matcher for the block filtering framework. Implementing classes
|
||||
* can be used to filter blocks to set or replace.
|
||||
* <p>
|
||||
* <u>Do NOT</u> implement this interface. Extend {@link AbstractMask} instead.
|
||||
*
|
||||
* @author sk89q
|
||||
* @deprecated Use {@link com.sk89q.worldedit.function.mask.Mask}
|
||||
*/
|
||||
@Deprecated
|
||||
public interface Mask {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.masks;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
|
||||
/**
|
||||
* A 2-dimensional mask, similar to {@link com.sk89q.worldedit.masks.Mask}.
|
||||
*/
|
||||
public interface Mask2D {
|
||||
|
||||
/**
|
||||
* Return whether the given position is matched by this mask.
|
||||
*
|
||||
* @param editSession an edit session
|
||||
* @param position a mask
|
||||
* @return true if there is a match
|
||||
*/
|
||||
boolean matches(EditSession editSession, Vector2D position);
|
||||
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.masks;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.math.noise.NoiseGenerator;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* A mask that uses a noise generator and returns true whenever the noise
|
||||
* generator returns a value above the given density.
|
||||
*/
|
||||
public class NoiseFilter extends AbstractMask {
|
||||
|
||||
private NoiseGenerator noiseGenerator;
|
||||
private double density;
|
||||
|
||||
/**
|
||||
* Create a new noise filter.
|
||||
*
|
||||
* @param noiseGenerator the noise generator
|
||||
* @param density the density
|
||||
*/
|
||||
public NoiseFilter(NoiseGenerator noiseGenerator, double density) {
|
||||
setNoiseGenerator(noiseGenerator);
|
||||
setDensity(density);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the noise generator.
|
||||
*
|
||||
* @return the noise generator
|
||||
*/
|
||||
public NoiseGenerator getNoiseGenerator() {
|
||||
return noiseGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the noise generator.
|
||||
*
|
||||
* @param noiseGenerator a noise generator
|
||||
*/
|
||||
public void setNoiseGenerator(NoiseGenerator noiseGenerator) {
|
||||
checkNotNull(noiseGenerator);
|
||||
this.noiseGenerator = noiseGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the probability of passing as a number between 0 and 1 (inclusive).
|
||||
*
|
||||
* @return the density
|
||||
*/
|
||||
public double getDensity() {
|
||||
return density;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the probability of passing as a number between 0 and 1 (inclusive).
|
||||
*
|
||||
* @return the density
|
||||
*/
|
||||
public void setDensity(double density) {
|
||||
checkArgument(density >= 0, "density must be >= 0");
|
||||
checkArgument(density <= 1, "density must be >= 1");
|
||||
this.density = density;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(EditSession editSession, Vector pos) {
|
||||
return noiseGenerator.noise(pos) <= density;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.masks;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.math.noise.NoiseGenerator;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* A mask that uses a noise generator and returns true whenever the noise
|
||||
* generator returns a value above the given density.
|
||||
*/
|
||||
public class NoiseFilter2D extends AbstractMask2D {
|
||||
|
||||
private NoiseGenerator noiseGenerator;
|
||||
private double density;
|
||||
|
||||
/**
|
||||
* Create a new noise filter.
|
||||
*
|
||||
* @param noiseGenerator the noise generator
|
||||
* @param density the density
|
||||
*/
|
||||
public NoiseFilter2D(NoiseGenerator noiseGenerator, double density) {
|
||||
setNoiseGenerator(noiseGenerator);
|
||||
setDensity(density);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the noise generator.
|
||||
*
|
||||
* @return the noise generator
|
||||
*/
|
||||
public NoiseGenerator getNoiseGenerator() {
|
||||
return noiseGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the noise generator.
|
||||
*
|
||||
* @param noiseGenerator a noise generator
|
||||
*/
|
||||
public void setNoiseGenerator(NoiseGenerator noiseGenerator) {
|
||||
checkNotNull(noiseGenerator);
|
||||
this.noiseGenerator = noiseGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the probability of passing as a number between 0 and 1 (inclusive).
|
||||
*
|
||||
* @return the density
|
||||
*/
|
||||
public double getDensity() {
|
||||
return density;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the probability of passing as a number between 0 and 1 (inclusive).
|
||||
*
|
||||
* @return the density
|
||||
*/
|
||||
public void setDensity(double density) {
|
||||
checkArgument(density >= 0, "density must be >= 0");
|
||||
checkArgument(density <= 1, "density must be >= 1");
|
||||
this.density = density;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(EditSession editSession, Vector2D pos) {
|
||||
return noiseGenerator.noise(pos) <= density;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,12 @@ package com.sk89q.worldedit.masks;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.function.mask.NoiseFilter;
|
||||
|
||||
/**
|
||||
* @deprecated See {@link NoiseFilter}
|
||||
*/
|
||||
@Deprecated
|
||||
public class RandomMask extends AbstractMask {
|
||||
private final double ratio;
|
||||
|
||||
|
||||
@@ -23,6 +23,10 @@ import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
||||
/**
|
||||
* @deprecated See {@link com.sk89q.worldedit.function.mask.RegionMask}
|
||||
*/
|
||||
@Deprecated
|
||||
public class RegionMask extends AbstractMask {
|
||||
private final Region region;
|
||||
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
package com.sk89q.worldedit.masks;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Extent;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BlockType;
|
||||
|
||||
/**
|
||||
* Works like {@link ExistingBlockMask}, except also dealing with non-solid non-air blocks the same way as with air.
|
||||
* @deprecated See {@link com.sk89q.worldedit.function.mask.SolidBlockMask}
|
||||
*/
|
||||
public class SolidBlockMask extends ExtentAwareMask {
|
||||
@Deprecated
|
||||
public class SolidBlockMask extends AbstractMask {
|
||||
@Override
|
||||
public boolean matches(EditSession editSession, Vector pos) {
|
||||
Extent extent = getExtent(editSession);
|
||||
return !BlockType.canPassThrough(extent.getBlockType(pos), extent.getBlockData(pos));
|
||||
return !BlockType.canPassThrough(editSession.getBlockType(pos), editSession.getBlockData(pos));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user