From f0d97c5231e68cc1c3a7c9bb3d31862ab3c3bf0a Mon Sep 17 00:00:00 2001 From: sk89q Date: Sun, 30 Mar 2014 12:59:39 -0700 Subject: [PATCH] Added new Pattern interface. --- .../java/com/sk89q/worldedit/EditSession.java | 11 +-- .../sk89q/worldedit/extent/ExtentBuffer.java | 9 +- .../function/block/BlockReplace.java | 4 +- .../function/generator/FloraGenerator.java | 33 ++++--- .../generator/GardenPatchGenerator.java | 25 +++--- .../function/pattern/AbstractPattern.java | 26 ++++++ .../function/pattern/BlockPattern.java | 67 ++++++++++++++ .../worldedit/function/pattern/Pattern.java | 38 ++++++++ .../worldedit/function/pattern/Patterns.java | 51 +++++++++++ .../function/pattern/RandomPattern.java | 88 +++++++++++++++++++ .../sk89q/worldedit/patterns/BlockChance.java | 5 +- .../com/sk89q/worldedit/patterns/Pattern.java | 6 +- .../worldedit/patterns/RandomFillPattern.java | 15 ++-- .../patterns/SingleBlockPattern.java | 6 +- 14 files changed, 321 insertions(+), 63 deletions(-) create mode 100644 src/main/java/com/sk89q/worldedit/function/pattern/AbstractPattern.java create mode 100644 src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java create mode 100644 src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java create mode 100644 src/main/java/com/sk89q/worldedit/function/pattern/Patterns.java create mode 100644 src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java diff --git a/src/main/java/com/sk89q/worldedit/EditSession.java b/src/main/java/com/sk89q/worldedit/EditSession.java index 4c7d09e74..ef1021570 100644 --- a/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/src/main/java/com/sk89q/worldedit/EditSession.java @@ -39,6 +39,7 @@ import com.sk89q.worldedit.function.mask.*; import com.sk89q.worldedit.function.operation.ForwardExtentCopy; import com.sk89q.worldedit.function.operation.OperationHelper; import com.sk89q.worldedit.function.operation.OperationQueue; +import com.sk89q.worldedit.function.pattern.Patterns; import com.sk89q.worldedit.function.util.RegionOffset; import com.sk89q.worldedit.function.visitor.DownwardVisitor; import com.sk89q.worldedit.function.visitor.LayerVisitor; @@ -831,7 +832,7 @@ public class EditSession implements Extent { Masks.negate(new ExistingBlockMask(this))); // Want to replace blocks - BlockReplace replace = new BlockReplace(this, pattern); + BlockReplace replace = new BlockReplace(this, Patterns.wrap(pattern)); // Pick how we're going to visit blocks RecursiveVisitor visitor; @@ -941,7 +942,7 @@ public class EditSession implements Extent { checkNotNull(region); checkNotNull(pattern); - BlockReplace replace = new BlockReplace(this, pattern); + BlockReplace replace = new BlockReplace(this, Patterns.wrap(pattern)); RegionVisitor visitor = new RegionVisitor(region, replace); OperationHelper.completeLegacy(visitor); return visitor.getAffected(); @@ -991,7 +992,7 @@ public class EditSession implements Extent { checkNotNull(mask); checkNotNull(pattern); - BlockReplace replace = new BlockReplace(this, pattern); + BlockReplace replace = new BlockReplace(this, Patterns.wrap(pattern)); RegionMaskingFilter filter = new RegionMaskingFilter(Masks.wrap(this, mask), replace); RegionVisitor visitor = new RegionVisitor(region, filter); OperationHelper.completeLegacy(visitor); @@ -1164,7 +1165,7 @@ public class EditSession implements Extent { checkNotNull(region); checkNotNull(pattern); - BlockReplace replace = new BlockReplace(this, pattern); + BlockReplace replace = new BlockReplace(this, Patterns.wrap(pattern)); RegionOffset offset = new RegionOffset(new Vector(0, 1, 0), replace); GroundFunction ground = new GroundFunction(this, offset); LayerVisitor visitor = new LayerVisitor( @@ -1241,7 +1242,7 @@ public class EditSession implements Extent { Pattern pattern = replacement != null ? new SingleBlockPattern(replacement) : new SingleBlockPattern(new BaseBlock(BlockID.AIR)); - BlockReplace remove = new BlockReplace(this, pattern); + BlockReplace remove = new BlockReplace(this, Patterns.wrap(pattern)); // Copy to a buffer so we don't destroy our original before we can copy all the blocks from it ExtentBuffer buffer = new ExtentBuffer(this, new RegionMask(region)); diff --git a/src/main/java/com/sk89q/worldedit/extent/ExtentBuffer.java b/src/main/java/com/sk89q/worldedit/extent/ExtentBuffer.java index 06074cb16..e13594169 100644 --- a/src/main/java/com/sk89q/worldedit/extent/ExtentBuffer.java +++ b/src/main/java/com/sk89q/worldedit/extent/ExtentBuffer.java @@ -26,7 +26,7 @@ import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.mask.Masks; -import com.sk89q.worldedit.patterns.Pattern; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.regions.AbstractRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionOperationException; @@ -115,7 +115,7 @@ public class ExtentBuffer implements Extent, Pattern { } @Override - public BaseBlock next(Vector pos) { + public BaseBlock apply(Vector pos) { BaseBlock block = buffer.get(pos.toBlockVector()); if (block != null) { return block; @@ -124,11 +124,6 @@ public class ExtentBuffer implements Extent, Pattern { } } - @Override - public BaseBlock next(int x, int y, int z) { - return next(new Vector(x, y, z)); - } - /** * Return a region representation of this buffer. * diff --git a/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java b/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java index b4162929a..c8a5dbedc 100644 --- a/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java +++ b/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java @@ -23,7 +23,7 @@ import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.function.RegionFunction; -import com.sk89q.worldedit.patterns.Pattern; +import com.sk89q.worldedit.function.pattern.Pattern; import static com.google.common.base.Preconditions.checkNotNull; @@ -50,7 +50,7 @@ public class BlockReplace implements RegionFunction { @Override public boolean apply(Vector position) throws WorldEditException { - return extent.setBlock(position, pattern.next(position), true); + return extent.setBlock(position, pattern.apply(position), true); } } \ No newline at end of file diff --git a/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java b/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java index 56085eee6..9eff8bc63 100644 --- a/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java +++ b/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java @@ -25,12 +25,9 @@ import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.function.RegionFunction; -import com.sk89q.worldedit.patterns.BlockChance; -import com.sk89q.worldedit.patterns.Pattern; -import com.sk89q.worldedit.patterns.RandomFillPattern; - -import java.util.ArrayList; -import java.util.List; +import com.sk89q.worldedit.function.pattern.BlockPattern; +import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.function.pattern.RandomPattern; /** * Generates flora (which may include tall grass, flowers, etc.). @@ -85,11 +82,11 @@ public class FloraGenerator implements RegionFunction { * @return a pattern that places flora */ public static Pattern getDesertPattern() { - List chance = new ArrayList(); - chance.add(new BlockChance(new BaseBlock(BlockID.DEAD_BUSH), 30)); - chance.add(new BlockChance(new BaseBlock(BlockID.CACTUS), 20)); - chance.add(new BlockChance(new BaseBlock(BlockID.AIR), 300)); - return new RandomFillPattern(chance); + RandomPattern pattern = new RandomPattern(); + pattern.add(new BlockPattern(new BaseBlock(BlockID.DEAD_BUSH)), 30); + pattern.add(new BlockPattern(new BaseBlock(BlockID.CACTUS)), 20); + pattern.add(new BlockPattern(new BaseBlock(BlockID.AIR)), 300); + return pattern; } /** @@ -98,11 +95,11 @@ public class FloraGenerator implements RegionFunction { * @return a pattern that places flora */ public static Pattern getTemperatePattern() { - List chance = new ArrayList(); - chance.add(new BlockChance(new BaseBlock(BlockID.LONG_GRASS, 1), 300)); - chance.add(new BlockChance(new BaseBlock(BlockID.RED_FLOWER), 5)); - chance.add(new BlockChance(new BaseBlock(BlockID.YELLOW_FLOWER), 5)); - return new RandomFillPattern(chance); + RandomPattern pattern = new RandomPattern(); + pattern.add(new BlockPattern(new BaseBlock(BlockID.LONG_GRASS, 1)), 300); + pattern.add(new BlockPattern(new BaseBlock(BlockID.RED_FLOWER)), 5); + pattern.add(new BlockPattern(new BaseBlock(BlockID.YELLOW_FLOWER)), 5); + return pattern; } @Override @@ -110,10 +107,10 @@ public class FloraGenerator implements RegionFunction { BaseBlock block = editSession.getBlock(position); if (block.getType() == BlockID.GRASS) { - editSession.setBlock(position.add(0, 1, 0), temperatePattern.next(position)); + editSession.setBlock(position.add(0, 1, 0), temperatePattern.apply(position)); return true; } else if (block.getType() == BlockID.SAND) { - editSession.setBlock(position.add(0, 1, 0), desertPattern.next(position)); + editSession.setBlock(position.add(0, 1, 0), desertPattern.apply(position)); return true; } diff --git a/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java b/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java index 2a145410b..eb11ed1ae 100644 --- a/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java +++ b/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java @@ -26,13 +26,10 @@ import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.function.RegionFunction; -import com.sk89q.worldedit.patterns.BlockChance; -import com.sk89q.worldedit.patterns.Pattern; -import com.sk89q.worldedit.patterns.RandomFillPattern; -import com.sk89q.worldedit.patterns.SingleBlockPattern; +import com.sk89q.worldedit.function.pattern.BlockPattern; +import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.function.pattern.RandomPattern; -import java.util.ArrayList; -import java.util.List; import java.util.Random; public class GardenPatchGenerator implements RegionFunction { @@ -115,7 +112,7 @@ public class GardenPatchGenerator implements RegionFunction { editSession.setBlockIfAir(pos.add(1, h, -1), log); affected++; } - editSession.setBlockIfAir(p = pos.add(0, 0, -1), plant.next(p)); + editSession.setBlockIfAir(p = pos.add(0, 0, -1), plant.apply(p)); affected++; break; @@ -127,7 +124,7 @@ public class GardenPatchGenerator implements RegionFunction { editSession.setBlockIfAir(pos.add(1, h, 0), log); affected++; } - editSession.setBlockIfAir(p = pos.add(1, 0, 1), plant.next(p)); + editSession.setBlockIfAir(p = pos.add(1, 0, 1), plant.apply(p)); affected++; break; @@ -139,7 +136,7 @@ public class GardenPatchGenerator implements RegionFunction { editSession.setBlockIfAir(pos.add(-1, h, 0), log); affected++; } - editSession.setBlockIfAir(p = pos.add(-1, 0, 1), plant.next(p)); + editSession.setBlockIfAir(p = pos.add(-1, 0, 1), plant.apply(p)); affected++; break; @@ -151,7 +148,7 @@ public class GardenPatchGenerator implements RegionFunction { editSession.setBlockIfAir(pos.add(-1, h, -1), log); affected++; } - editSession.setBlockIfAir(p = pos.add(-1, 0, -1), plant.next(p)); + editSession.setBlockIfAir(p = pos.add(-1, 0, -1), plant.apply(p)); affected++; break; } @@ -185,11 +182,11 @@ public class GardenPatchGenerator implements RegionFunction { * @return a pumpkin pattern */ public static Pattern getPumpkinPattern() { - List chance = new ArrayList(); + RandomPattern pattern = new RandomPattern(); for (int i = 0; i < 4; i++) { - chance.add(new BlockChance(new BaseBlock(BlockID.PUMPKIN, i), 100)); + pattern.add(new BlockPattern(new BaseBlock(BlockID.PUMPKIN, i)), 100); } - return new RandomFillPattern(chance); + return pattern; } /** @@ -198,6 +195,6 @@ public class GardenPatchGenerator implements RegionFunction { * @return a melon pattern */ public static Pattern getMelonPattern() { - return new SingleBlockPattern(new BaseBlock(BlockID.MELON_BLOCK)); + return new BlockPattern(new BaseBlock(BlockID.MELON_BLOCK)); } } diff --git a/src/main/java/com/sk89q/worldedit/function/pattern/AbstractPattern.java b/src/main/java/com/sk89q/worldedit/function/pattern/AbstractPattern.java new file mode 100644 index 000000000..bfe05592f --- /dev/null +++ b/src/main/java/com/sk89q/worldedit/function/pattern/AbstractPattern.java @@ -0,0 +1,26 @@ +/* + * 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.pattern; + +/** + * An abstract implementation for {@link Pattern}s. + */ +public abstract class AbstractPattern implements Pattern { +} diff --git a/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java b/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java new file mode 100644 index 000000000..ac363d341 --- /dev/null +++ b/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java @@ -0,0 +1,67 @@ +/* + * 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.pattern; + +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.blocks.BaseBlock; + +import static com.google.common.base.Preconditions.checkNotNull; + +/** + * A pattern that returns the same {@link BaseBlock} each time. + */ +public class BlockPattern extends AbstractPattern { + + private BaseBlock block; + + /** + * Create a new pattern with the given block. + * + * @param block the block + */ + public BlockPattern(BaseBlock block) { + setBlock(block); + } + + /** + * Get the block. + * + * @return the block that is always returned + */ + public BaseBlock getBlock() { + return block; + } + + /** + * Set the block that is returned. + * + * @param block the block + */ + public void setBlock(BaseBlock block) { + checkNotNull(block); + this.block = block; + } + + @Override + public BaseBlock apply(Vector position) { + return block; + } + +} diff --git a/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java b/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java new file mode 100644 index 000000000..ac51ce464 --- /dev/null +++ b/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java @@ -0,0 +1,38 @@ +/* + * 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.pattern; + +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.blocks.BaseBlock; + +/** + * Returns a {@link BaseBlock} for a given position. + */ +public interface Pattern { + + /** + * Return a {@link BaseBlock} for the given position. + * + * @param position the position + * @return a block + */ + BaseBlock apply(Vector position); + +} diff --git a/src/main/java/com/sk89q/worldedit/function/pattern/Patterns.java b/src/main/java/com/sk89q/worldedit/function/pattern/Patterns.java new file mode 100644 index 000000000..9e42dbe7e --- /dev/null +++ b/src/main/java/com/sk89q/worldedit/function/pattern/Patterns.java @@ -0,0 +1,51 @@ +/* + * 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.pattern; + +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.blocks.BaseBlock; + +import static com.google.common.base.Preconditions.checkNotNull; + +/** + * Utility methods related to {@link Pattern}s. + */ +public final class Patterns { + + private Patterns() { + } + + /** + * Wrap an old-style pattern and return a new pattern. + * + * @param pattern the pattern + * @return a new-style pattern + */ + public static Pattern wrap(final com.sk89q.worldedit.patterns.Pattern pattern) { + checkNotNull(pattern); + return new Pattern() { + @Override + public BaseBlock apply(Vector position) { + return pattern.next(position); + } + }; + } + +} diff --git a/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java b/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java new file mode 100644 index 000000000..c90dbc534 --- /dev/null +++ b/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java @@ -0,0 +1,88 @@ +/* + * 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.pattern; + +import com.sk89q.worldedit.Vector; +import com.sk89q.worldedit.blocks.BaseBlock; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +import static com.google.common.base.Preconditions.checkNotNull; + +/** + * Uses a random pattern of a weighted list of patterns. + */ +public class RandomPattern extends AbstractPattern { + + private final Random random = new Random(); + private List patterns = new ArrayList(); + private double max = 0; + + /** + * Add a pattern to the weight list of patterns. + *

+ * The probability for the pattern added is chance / max where max is the sum + * of the probabilities of all added patterns. + * + * @param pattern the pattern + * @param chance the chance, which can be any positive number + */ + public void add(Pattern pattern, double chance) { + checkNotNull(pattern); + patterns.add(new Chance(pattern, chance)); + max += chance; + } + + @Override + public BaseBlock apply(Vector position) { + double r = random.nextDouble(); + double offset = 0; + + for (Chance chance : patterns) { + if (r <= (offset + chance.getChance()) / max) { + return chance.getPattern().apply(position); + } + offset += chance.getChance(); + } + + throw new RuntimeException("ProportionalFillPattern"); + } + + private static class Chance { + private Pattern pattern; + private double chance; + + private Chance(Pattern pattern, double chance) { + this.pattern = pattern; + this.chance = chance; + } + + public Pattern getPattern() { + return pattern; + } + + public double getChance() { + return chance; + } + } + +} diff --git a/src/main/java/com/sk89q/worldedit/patterns/BlockChance.java b/src/main/java/com/sk89q/worldedit/patterns/BlockChance.java index b8427ae32..a51cacf29 100644 --- a/src/main/java/com/sk89q/worldedit/patterns/BlockChance.java +++ b/src/main/java/com/sk89q/worldedit/patterns/BlockChance.java @@ -22,10 +22,9 @@ package com.sk89q.worldedit.patterns; import com.sk89q.worldedit.blocks.BaseBlock; /** - * Gives a block a chance. - * - * @author sk89q + * @deprecated Will be removed in the future -- there is no replacement */ +@Deprecated public class BlockChance { /** * Block. diff --git a/src/main/java/com/sk89q/worldedit/patterns/Pattern.java b/src/main/java/com/sk89q/worldedit/patterns/Pattern.java index d1ec4a25e..eb2b9f2dc 100644 --- a/src/main/java/com/sk89q/worldedit/patterns/Pattern.java +++ b/src/main/java/com/sk89q/worldedit/patterns/Pattern.java @@ -23,11 +23,9 @@ import com.sk89q.worldedit.*; import com.sk89q.worldedit.blocks.BaseBlock; /** - * Used to get the block to set. This can be used to implement a pattern - * for when setting a region with blocks. - * - * @author sk89q + * @deprecated See {@link com.sk89q.worldedit.function.pattern.Pattern} */ +@Deprecated public interface Pattern { /** * Get a block for a position. This return value of this method does diff --git a/src/main/java/com/sk89q/worldedit/patterns/RandomFillPattern.java b/src/main/java/com/sk89q/worldedit/patterns/RandomFillPattern.java index 5217e4a9e..e322798ba 100644 --- a/src/main/java/com/sk89q/worldedit/patterns/RandomFillPattern.java +++ b/src/main/java/com/sk89q/worldedit/patterns/RandomFillPattern.java @@ -19,17 +19,18 @@ package com.sk89q.worldedit.patterns; -import java.util.Random; -import java.util.List; -import java.util.ArrayList; -import com.sk89q.worldedit.*; +import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.function.pattern.RandomPattern; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; /** - * Pattern proportionally fills. - * - * @author sk89q + * @deprecated See {@link RandomPattern} */ +@Deprecated public class RandomFillPattern implements Pattern { /** * Random number generator. diff --git a/src/main/java/com/sk89q/worldedit/patterns/SingleBlockPattern.java b/src/main/java/com/sk89q/worldedit/patterns/SingleBlockPattern.java index f518f8de1..94457610d 100644 --- a/src/main/java/com/sk89q/worldedit/patterns/SingleBlockPattern.java +++ b/src/main/java/com/sk89q/worldedit/patterns/SingleBlockPattern.java @@ -21,12 +21,12 @@ package com.sk89q.worldedit.patterns; import com.sk89q.worldedit.*; import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.function.pattern.BlockPattern; /** - * Always returns the same block type. - * - * @author sk89q + * @deprecated See {@link BlockPattern} */ +@Deprecated public class SingleBlockPattern implements Pattern { /** * Block type.