From 66d70f00e744c3c62ef235ebcf08090d46b7319d Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 19 Jun 2018 17:03:09 +1000 Subject: [PATCH] Removed more deprecated code --- .../wepif/FlatFilePermissionsResolver.java | 5 - .../sk89q/worldedit/bukkit/BukkitWorld.java | 7 +- .../com/sk89q/worldedit/blocks/LazyBlock.java | 1 - .../com/sk89q/worldedit/blocks/NoteBlock.java | 122 ------------------ .../java/com/sk89q/worldedit/EditSession.java | 112 ++++++++-------- .../com/sk89q/worldedit/blocks/BlockID.java | 2 +- .../com/sk89q/worldedit/blocks/BlockType.java | 2 +- .../com/sk89q/worldedit/blocks/ItemID.java | 2 +- .../worldedit/command/GenerationCommands.java | 2 +- .../worldedit/command/RegionCommands.java | 2 +- .../sk89q/worldedit/command/ToolCommands.java | 2 +- .../command/argument/TreeGeneratorParser.java | 2 +- .../command/tool/FloatingTreeRemover.java | 74 ++++------- .../worldedit/command/tool/QueryTool.java | 5 - .../worldedit/command/tool/TreePlanter.java | 8 +- .../function/generator/ForestGenerator.java | 13 +- .../worldedit/regions/CylinderRegion.java | 10 -- .../worldedit/regions/Polygonal2DRegion.java | 5 - .../sk89q/worldedit/util/TreeGenerator.java | 27 +--- 19 files changed, 107 insertions(+), 296 deletions(-) delete mode 100644 worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/NoteBlock.java diff --git a/worldedit-bukkit/src/main/java/com/sk89q/wepif/FlatFilePermissionsResolver.java b/worldedit-bukkit/src/main/java/com/sk89q/wepif/FlatFilePermissionsResolver.java index 6caa45207..704694c9f 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/wepif/FlatFilePermissionsResolver.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/wepif/FlatFilePermissionsResolver.java @@ -66,11 +66,6 @@ public class FlatFilePermissionsResolver implements PermissionsResolver { this.userFile = userFile; } - @Deprecated - public static boolean filesExists() { - return (new File("perms_groups.txt")).exists() && (new File("perms_users.txt")).exists(); - } - public Map> loadGroupPermissions() { Map> userGroupPermissions = new HashMap>(); diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index eac643e49..2c1a5e606 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -35,12 +35,12 @@ import com.sk89q.worldedit.blocks.type.BlockType; import com.sk89q.worldedit.blocks.type.BlockTypes; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.entity.BaseEntity; +import com.sk89q.worldedit.history.change.BlockChange; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.world.AbstractWorld; import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.registry.BundledBlockData; -import com.sk89q.worldedit.world.registry.Registries; import org.bukkit.Effect; import org.bukkit.TreeType; import org.bukkit.World; @@ -159,7 +159,7 @@ public class BukkitWorld extends AbstractWorld { @Override public boolean regenerate(Region region, EditSession editSession) { - BaseBlock[] history = new BaseBlock[16 * 16 * (getMaxY() + 1)]; + BlockStateHolder[] history = new BlockStateHolder[16 * 16 * (getMaxY() + 1)]; for (Vector2D chunk : region.getChunks()) { Vector min = new Vector(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16); @@ -192,8 +192,7 @@ public class BukkitWorld extends AbstractWorld { if (!region.contains(pt)) { editSession.smartSetBlock(pt, history[index]); } else { // Otherwise fool with history - editSession.rememberChange(pt, history[index], - editSession.getFullBlock(pt)); + editSession.getChangeSet().add(new BlockChange(pt.toBlockVector(), history[index], editSession.getFullBlock(pt))); } } } diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/LazyBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/LazyBlock.java index 4d68ddec0..5baf31e4d 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/LazyBlock.java +++ b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/LazyBlock.java @@ -66,7 +66,6 @@ public class LazyBlock extends BaseBlock { * @param extent the extent to later load the full block data from * @param position the position to later load the full block data from */ - @Deprecated public LazyBlock(BlockState state, Extent extent, Vector position) { super(state); checkNotNull(extent); diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/NoteBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/NoteBlock.java deleted file mode 100644 index f061723c1..000000000 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/NoteBlock.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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 Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.blocks; - -import com.sk89q.jnbt.ByteTag; -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.StringTag; -import com.sk89q.jnbt.Tag; - -import java.util.HashMap; -import java.util.Map; - -/** - * A note block. - */ -public class NoteBlock extends BaseBlock implements TileEntityBlock { - - private byte note; - - /** - * Construct the note block with a data value of 0. - */ - public NoteBlock() { - super(BlockID.NOTE_BLOCK); - this.note = 0; - } - - /** - * Construct the note block with a given data value. - * - * @param data data value - */ - public NoteBlock(int data) { - super(BlockID.NOTE_BLOCK, data); - this.note = 0; - } - - /** - * Construct the note block with a given data value and note. - * - * @param data data value - * @param note note - */ - public NoteBlock(int data, byte note) { - super(BlockID.NOTE_BLOCK, data); - this.note = note; - } - - /** - * Get the note. - * - * @return the note - */ - public byte getNote() { - return note; - } - - /** - * Set the note. - * - * @param note the note to set - */ - public void setNote(byte note) { - this.note = note; - } - - @Override - public boolean hasNbtData() { - return true; - } - - @Override - public String getNbtId() { - return "Music"; - } - - @Override - public CompoundTag getNbtData() { - Map values = new HashMap(); - values.put("note", new ByteTag(note)); - return new CompoundTag(values); - } - - @Override - public void setNbtData(CompoundTag rootTag) { - if (rootTag == null) { - return; - } - - Map values = rootTag.getValue(); - - Tag t; - - t = values.get("id"); - if (!(t instanceof StringTag) || !((StringTag) t).getValue().equals("Music")) { - throw new RuntimeException("'Music' tile entity expected"); - } - - t = values.get("note"); - if (t instanceof ByteTag) { - note = ((ByteTag) t).getValue(); - } - } - -} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index 8903a7dd6..e18c95efd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -19,8 +19,13 @@ package com.sk89q.worldedit; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.sk89q.worldedit.regions.Regions.asFlatRegion; +import static com.sk89q.worldedit.regions.Regions.maximumBlockY; +import static com.sk89q.worldedit.regions.Regions.minimumBlockY; + import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.blocks.BlockID; import com.sk89q.worldedit.blocks.BlockType; import com.sk89q.worldedit.blocks.LazyBlock; import com.sk89q.worldedit.blocks.type.BlockCategories; @@ -51,14 +56,30 @@ import com.sk89q.worldedit.function.block.BlockReplace; import com.sk89q.worldedit.function.block.Counter; import com.sk89q.worldedit.function.block.Naturalizer; import com.sk89q.worldedit.function.generator.GardenPatchGenerator; -import com.sk89q.worldedit.function.mask.*; -import com.sk89q.worldedit.function.operation.*; +import com.sk89q.worldedit.function.mask.BlockMask; +import com.sk89q.worldedit.function.mask.BoundedHeightMask; +import com.sk89q.worldedit.function.mask.ExistingBlockMask; +import com.sk89q.worldedit.function.mask.FuzzyBlockMask; +import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.mask.MaskIntersection; +import com.sk89q.worldedit.function.mask.MaskUnion; +import com.sk89q.worldedit.function.mask.Masks; +import com.sk89q.worldedit.function.mask.NoiseFilter2D; +import com.sk89q.worldedit.function.mask.RegionMask; +import com.sk89q.worldedit.function.operation.ChangeSetExecutor; +import com.sk89q.worldedit.function.operation.ForwardExtentCopy; +import com.sk89q.worldedit.function.operation.Operation; +import com.sk89q.worldedit.function.operation.OperationQueue; +import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.function.util.RegionOffset; -import com.sk89q.worldedit.function.visitor.*; +import com.sk89q.worldedit.function.visitor.DownwardVisitor; +import com.sk89q.worldedit.function.visitor.LayerVisitor; +import com.sk89q.worldedit.function.visitor.NonRisingVisitor; +import com.sk89q.worldedit.function.visitor.RecursiveVisitor; +import com.sk89q.worldedit.function.visitor.RegionVisitor; import com.sk89q.worldedit.history.UndoContext; -import com.sk89q.worldedit.history.change.BlockChange; import com.sk89q.worldedit.history.changeset.BlockOptimizedHistory; import com.sk89q.worldedit.history.changeset.ChangeSet; import com.sk89q.worldedit.internal.expression.Expression; @@ -70,26 +91,36 @@ import com.sk89q.worldedit.math.interpolation.KochanekBartelsInterpolation; import com.sk89q.worldedit.math.interpolation.Node; import com.sk89q.worldedit.math.noise.RandomNoise; import com.sk89q.worldedit.math.transform.AffineTransform; -import com.sk89q.worldedit.regions.*; +import com.sk89q.worldedit.regions.CuboidRegion; +import com.sk89q.worldedit.regions.EllipsoidRegion; +import com.sk89q.worldedit.regions.FlatRegion; +import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.regions.Regions; import com.sk89q.worldedit.regions.shape.ArbitraryBiomeShape; import com.sk89q.worldedit.regions.shape.ArbitraryShape; import com.sk89q.worldedit.regions.shape.RegionShape; import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; -import com.sk89q.worldedit.util.*; +import com.sk89q.worldedit.util.Countable; +import com.sk89q.worldedit.util.Direction; +import com.sk89q.worldedit.util.TreeGenerator; import com.sk89q.worldedit.util.collection.DoubleArrayList; import com.sk89q.worldedit.util.eventbus.EventBus; import com.sk89q.worldedit.world.NullWorld; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.biome.BaseBiome; -import javax.annotation.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.sk89q.worldedit.regions.Regions.*; +import javax.annotation.Nullable; /** * An {@link Extent} that handles history, {@link BlockBag}s, change limits, @@ -518,19 +549,6 @@ public class EditSession implements Extent { return bypassNone.createEntity(location, entity); } - /** - * Insert a contrived block change into the history. - * - * @param position the position - * @param existing the previous block at that position - * @param block the new block - * @deprecated Get the change set with {@link #getChangeSet()} and add the change with that - */ - @Deprecated - public void rememberChange(Vector position, BaseBlock existing, BaseBlock block) { - changeSet.add(new BlockChange(position.toBlockVector(), existing, block)); - } - /** * Restores all blocks to their initial state. * @@ -1115,7 +1133,7 @@ public class EditSession implements Extent { new RegionMask(new EllipsoidRegion(null, origin, new Vector(radius, radius, radius))), getWorld().createLiquidMask()); - BlockReplace replace = new BlockReplace(this, new BlockPattern(new BaseBlock(BlockID.AIR))); + BlockReplace replace = new BlockReplace(this, new BlockPattern(BlockTypes.AIR.getDefaultState())); RecursiveVisitor visitor = new RecursiveVisitor(mask, replace); // Around the origin in a 3x3 block @@ -1553,7 +1571,7 @@ public class EditSession implements Extent { final int oy = position.getBlockY(); final int oz = position.getBlockZ(); - final BaseBlock grass = new BaseBlock(BlockID.GRASS); + final BlockState grass = BlockTypes.GRASS_BLOCK.getDefaultState(); final int ceilRadius = (int) Math.ceil(radius); for (int x = ox - ceilRadius; x <= ox + ceilRadius; ++x) { @@ -1562,35 +1580,21 @@ public class EditSession implements Extent { continue; } - loop: for (int y = world.getMaxY(); y >= 1; --y) { + for (int y = world.getMaxY(); y >= 1; --y) { final Vector pt = new Vector(x, y, z); - final BaseBlock block = getLazyBlock(pt); - final int id = block.getId(); - final int data = block.getData(); - - switch (id) { - case BlockID.DIRT: - if (onlyNormalDirt && data != 0) { - break loop; - } + final BlockState block = getBlock(pt); + final com.sk89q.worldedit.blocks.type.BlockType id = block.getBlockType(); + if (block.getBlockType() == BlockTypes.DIRT || + (!onlyNormalDirt && block.getBlockType() == BlockTypes.COARSE_DIRT)) { if (setBlock(pt, grass)) { ++affected; } - break loop; - - case BlockID.WATER: - case BlockID.STATIONARY_WATER: - case BlockID.LAVA: - case BlockID.STATIONARY_LAVA: - // break on liquids... - break loop; - - default: - // ...and all non-passable blocks - if (!BlockType.canPassThrough(id, data)) { - break loop; - } + break; + } else if (block.getBlockType() == BlockTypes.WATER || block.getBlockType() == BlockTypes.LAVA) { + break; + } else if (!BlockType.canPassThrough(id.getLegacyId())) { + break; } } } @@ -1632,11 +1636,11 @@ public class EditSession implements Extent { * @param basePosition a position * @param size a size * @param density between 0 and 1, inclusive - * @param treeGenerator the tree genreator + * @param treeType the tree type * @return number of trees created * @throws MaxChangedBlocksException thrown if too many blocks are changed */ - public int makeForest(Vector basePosition, int size, double density, TreeGenerator treeGenerator) throws MaxChangedBlocksException { + public int makeForest(Vector basePosition, int size, double density, TreeGenerator.TreeType treeType) throws MaxChangedBlocksException { int affected = 0; for (int x = basePosition.getBlockX() - size; x <= basePosition.getBlockX() @@ -1656,7 +1660,7 @@ public class EditSession implements Extent { // Check if we hit the ground com.sk89q.worldedit.blocks.type.BlockType t = getBlock(new Vector(x, y, z)).getBlockType(); if (t == BlockTypes.GRASS_BLOCK || t == BlockTypes.DIRT) { - treeGenerator.generate(this, new Vector(x, y + 1, z)); + treeType.generate(this, new Vector(x, y + 1, z)); ++affected; break; } else if (t == BlockTypes.SNOW) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockID.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockID.java index 5e54d6272..b7164d28c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockID.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockID.java @@ -22,7 +22,7 @@ package com.sk89q.worldedit.blocks; /** * List of block IDs. * - * {@Deprecated Please use {@link com.sk89q.worldedit.blocks.type.BlockTypes}} + * {@deprecated Please use {@link com.sk89q.worldedit.blocks.type.BlockTypes}} */ @Deprecated public final class BlockID { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockType.java index 871855343..32208eb00 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockType.java @@ -37,7 +37,7 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * Block types. * - * {@Deprecated Please use {@link com.sk89q.worldedit.blocks.type.BlockType}} + * {@deprecated Please use {@link com.sk89q.worldedit.blocks.type.BlockType}} */ @Deprecated public enum BlockType { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ItemID.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ItemID.java index f412753dc..7944ab876 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ItemID.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/ItemID.java @@ -22,7 +22,7 @@ package com.sk89q.worldedit.blocks; /** * List of item IDs. * - * {@Deprecated Please use {@link com.sk89q.worldedit.blocks.type.ItemTypes}} + * {@deprecated Please use {@link com.sk89q.worldedit.blocks.type.ItemTypes}} */ @Deprecated public final class ItemID { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java index e9121ae39..aa6640ba2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java @@ -197,7 +197,7 @@ public class GenerationCommands { @Logging(POSITION) public void forestGen(Player player, LocalSession session, EditSession editSession, @Optional("10") int size, @Optional("tree") TreeType type, @Optional("5") double density) throws WorldEditException { density = density / 100; - int affected = editSession.makeForest(session.getPlacementPosition(player), size, density, new TreeGenerator(type)); + int affected = editSession.makeForest(session.getPlacementPosition(player), size, density, type); player.print(affected + " trees created."); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java index 8751c3453..cd78705be 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java @@ -437,7 +437,7 @@ public class RegionCommands { public void forest(Player player, EditSession editSession, @Selection Region region, @Optional("tree") TreeType type, @Optional("5") @Range(min = 0, max = 100) double density) throws WorldEditException { density = density / 100; - ForestGenerator generator = new ForestGenerator(editSession, new TreeGenerator(type)); + ForestGenerator generator = new ForestGenerator(editSession, type); GroundFunction ground = new GroundFunction(new ExistingBlockMask(editSession), generator); LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground); visitor.setMask(new NoiseFilter2D(new RandomNoise(), density)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java index 7e5956d4b..84dcd1861 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolCommands.java @@ -89,7 +89,7 @@ public class ToolCommands { } BaseItemStack itemStack = player.getItemInHand(HandSide.MAIN_HAND); - session.setTool(itemStack.getType(), new TreePlanter(new TreeGenerator(type))); + session.setTool(itemStack.getType(), new TreePlanter(type)); player.print("Tree tool bound to " + itemStack.getType().getName() + "."); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/TreeGeneratorParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/TreeGeneratorParser.java index 34b782af7..3d3f73d6b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/TreeGeneratorParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/TreeGeneratorParser.java @@ -94,7 +94,7 @@ public class TreeGeneratorParser implements CommandExecutor stop walking this route + BlockState state = world.getBlock(next); + if (state.getBlockType() == BlockTypes.AIR || state.getBlockType() == BlockTypes.SNOW) { continue; - - case BlockID.LOG: - case BlockID.LOG2: - case BlockID.LEAVES: - case BlockID.LEAVES2: - case BlockID.BROWN_MUSHROOM_CAP: - case BlockID.RED_MUSHROOM_CAP: - case BlockID.VINE: - // queue next point + } + if (isTreeBlock(state.getBlockType())) { queue.addLast(next); - break; - - default: + } else { // we hit something solid - evaluate where we came from - final int curId = world.getLazyBlock(current).getId(); - if (curId == BlockID.LEAVES || curId == BlockID.LEAVES2 - || curId == BlockID.VINE) { - // leaves touching a wall/the ground => stop walking this route - continue; - } else { + final BlockType currentType = world.getBlock(current).getBlockType(); + if (!BlockCategories.LEAVES.contains(currentType) && currentType != BlockTypes.VINE) { // log/shroom touching a wall/the ground => this is not a floating tree, bail out return null; } - } // switch - } // if - } // for - } // while + } + } + } + } return visited; - } // bfs + } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java index f4c897a51..5813b6b4d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java @@ -22,9 +22,7 @@ package com.sk89q.worldedit.command.tool; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.MobSpawnerBlock; -import com.sk89q.worldedit.blocks.NoteBlock; import com.sk89q.worldedit.blocks.type.BlockStateHolder; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; @@ -57,9 +55,6 @@ public class QueryTool implements BlockTool { if (block instanceof MobSpawnerBlock) { player.printRaw("\u00A7e" + "Mob Type: " + ((MobSpawnerBlock) block).getMobType()); - } else if (block instanceof NoteBlock) { - player.printRaw("\u00A7e" + "Note block: " - + ((NoteBlock) block).getNote()); } return true; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java index 2f8a67463..998c87fd5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java @@ -30,10 +30,10 @@ import com.sk89q.worldedit.util.*; */ public class TreePlanter implements BlockTool { - private TreeGenerator gen; + private TreeGenerator.TreeType treeType; - public TreePlanter(TreeGenerator gen) { - this.gen = gen; + public TreePlanter(TreeGenerator.TreeType treeType) { + this.treeType = treeType; } @Override @@ -50,7 +50,7 @@ public class TreePlanter implements BlockTool { boolean successful = false; for (int i = 0; i < 10; i++) { - if (gen.generate(editSession, clicked.toVector().add(0, 1, 0))) { + if (treeType.generate(editSession, clicked.toVector().add(0, 1, 0))) { successful = true; break; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java index 644a183db..bb350b7ff 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java @@ -22,7 +22,6 @@ package com.sk89q.worldedit.function.generator; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.type.BlockStateHolder; import com.sk89q.worldedit.blocks.type.BlockType; import com.sk89q.worldedit.blocks.type.BlockTypes; @@ -35,18 +34,18 @@ import com.sk89q.worldedit.util.TreeGenerator; */ public class ForestGenerator implements RegionFunction { - private final TreeGenerator treeGenerator; + private final TreeGenerator.TreeType treeType; private final EditSession editSession; /** * Create a new instance. * * @param editSession the edit session - * @param treeGenerator a tree generator + * @param treeType a tree generator */ - public ForestGenerator(EditSession editSession, TreeGenerator treeGenerator) { + public ForestGenerator(EditSession editSession, TreeGenerator.TreeType treeType) { this.editSession = editSession; - this.treeGenerator = treeGenerator; + this.treeType = treeType; } @Override @@ -55,11 +54,11 @@ public class ForestGenerator implements RegionFunction { BlockType t = block.getBlockType(); if (t == BlockTypes.GRASS || t == BlockTypes.DIRT) { - treeGenerator.generate(editSession, position.add(0, 1, 0)); + treeType.generate(editSession, position.add(0, 1, 0)); return true; } else if (t == BlockTypes.TALL_GRASS || t == BlockTypes.DEAD_BUSH || t == BlockTypes.POPPY || t == BlockTypes.DANDELION) { // TODO: This list needs to be moved editSession.setBlock(position, BlockTypes.AIR.getDefaultState()); - treeGenerator.generate(editSession, position); + treeType.generate(editSession, position); return true; } else if (t == BlockTypes.SNOW) { editSession.setBlock(position, BlockTypes.AIR.getDefaultState()); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CylinderRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CylinderRegion.java index fd09c57b4..ed0e70822 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CylinderRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CylinderRegion.java @@ -107,16 +107,6 @@ public class CylinderRegion extends AbstractRegion implements FlatRegion { return center.toVector((maxY + minY) / 2); } - /** - * Sets the main center point of the region - * - * @deprecated replaced by {@link #setCenter(Vector2D)} - */ - @Deprecated - public void setCenter(Vector center) { - setCenter(center.toVector2D()); - } - /** * Sets the main center point of the region * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java index 62361548e..b7d607d9d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java @@ -171,11 +171,6 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { return minY; } - @Deprecated - public int getMininumY() { - return minY; - } - /** * Set the minimum Y. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java index 55546b95a..f905042e6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java @@ -164,32 +164,11 @@ public class TreeGenerator { } } + private TreeGenerator() { + } + private static final Random RANDOM = new Random(); - private TreeType type; - - /** - * Construct the tree generator with a tree type. - * - * @param type the tree type - */ - @Deprecated - public TreeGenerator(TreeType type) { - this.type = type; - } - - /** - * Generate a tree. - * - * @param editSession the edit session - * @param position the position to generate the tree at - * @return true if generation was successful - * @throws MaxChangedBlocksException - */ - public boolean generate(EditSession editSession, Vector position) throws MaxChangedBlocksException { - return type.generate(editSession, position); - } - /** * Makes a terrible looking pine tree. *