From 8680a9e6bdc27b350cd38d35757d6805b9425a8c Mon Sep 17 00:00:00 2001 From: sk89q Date: Fri, 18 Feb 2011 23:33:43 -0800 Subject: [PATCH] Added /size and /mat commands for the brush. --- plugin.yml | 143 +++++++++--------- .../worldedit/commands/ToolUtilCommands.java | 40 +++++ .../sk89q/worldedit/masks/BlockTypeMask.java | 2 +- 3 files changed, 116 insertions(+), 69 deletions(-) diff --git a/plugin.yml b/plugin.yml index 2fef2ec87..080e0790b 100644 --- a/plugin.yml +++ b/plugin.yml @@ -23,6 +23,9 @@ commands: delchunks: description: Delete chunks that your selection includes usage: / + clearclipboard: + description: Clear your clipboard + usage: / /load: description: Load a schematic into your clipboard usage: / @@ -44,12 +47,6 @@ commands: /paste: description: Paste the clipboard's contents usage: / [-ao] - clearclipboard: - description: Clear your clipboard - usage: / - /limit: - description: Modify block change limit - usage: / toggleplace: description: usage: / @@ -57,6 +54,9 @@ commands: description: Search for an item usage: / [-bi] aliases: ['/l'] + /limit: + description: Modify block change limit + usage: / /sphere: description: Generate a filled sphere usage: / [raised?] @@ -75,17 +75,17 @@ commands: pumpkins: description: Generate pumpkin patches usage: / [size] - /undo: - description: Undoes the last action - usage: / [times] - aliases: ['undo'] + clearhistory: + description: Clear your history + usage: / /redo: description: Redoes the last action (from history) usage: / [times] aliases: ['redo'] - clearhistory: - description: Clear your history - usage: / + /undo: + description: Undoes the last action + usage: / [times] + aliases: ['undo'] unstuck: description: Escape from being stuck inside a block usage: / @@ -95,27 +95,18 @@ commands: descend: description: Go down a floor usage: / - ceil: - description: Go to the celing - usage: / [clearance] thru: description: Passthrough walls usage: / jumpto: description: Teleport to a location usage: / + ceil: + description: Go to the celing + usage: / [clearance] up: description: Go upwards some distance usage: / - /replace: - description: Replace all blocks in the selection with another - usage: / [from-block] - /stack: - description: Repeat the contents of the selection - usage: / [-a] [count] [direction] - /set: - description: Set all the blocks inside the selection to a block - usage: / /overlay: description: Set a block on top of blocks in the region usage: / @@ -129,24 +120,24 @@ commands: /smooth: description: Smooth the elevation in the selection usage: / [iterations] + /replace: + description: Replace all blocks in the selection with another + usage: / [from-block] + /stack: + description: Repeat the contents of the selection + usage: / [-a] [count] [direction] + /set: + description: Set all the blocks inside the selection to a block + usage: / /move: description: Move the contents of the selection usage: / [count] [direction] [leave-id] - cs: - description: Execute a CraftScript - usage: / [args...] .s: description: Execute last CraftScript usage: / [args...] - //count: - description: Counts the number of a certain type of block - usage: / - /size: - description: Get information about the selection - usage: / - /shift: - description: Shift the selection area - usage: / [direction] + cs: + description: Execute a CraftScript + usage: / [args...] /chunk: description: Set the selection to your current chunk usage: / @@ -168,27 +159,36 @@ commands: toggleeditwand: description: Toggle functionality of the edit wand usage: / - /expand: - description: Expand the selection area - usage: / [reverse-amount] /contract: description: Contract the selection area usage: / [reverse-amount] [direction] /outset: description: Outset the selection area usage: / [-hv] - /inset: - description: Inset the selection area - usage: / [-hv] /distr: description: Get the distribution of blocks in the selection usage: / [-c] - list: - description: List snapshots - usage: / [num] + //count: + description: Counts the number of a certain type of block + usage: / + /size: + description: Get information about the selection + usage: / + /shift: + description: Shift the selection area + usage: / [direction] + /expand: + description: Expand the selection area + usage: / [reverse-amount] + /inset: + description: Inset the selection area + usage: / [-hv] use: description: Choose a snapshot to use usage: / + list: + description: List snapshots + usage: / [num] snapshot: description: Snapshot commands usage: / @@ -197,6 +197,9 @@ commands: description: Restore the selection from a snapshot usage: / [snapshot] aliases: ['/restore'] + area: + description: Enable the area super pickaxe pickaxe mode + usage: / recur: description: Enable the recursive super pickaxe pickaxe mode usage: / @@ -204,18 +207,9 @@ commands: single: description: Enable the single block super pickaxe mode usage: / - area: - description: Enable the area super pickaxe pickaxe mode - usage: / - info: - description: Block information tool - usage: / none: description: Turn off all superpickaxe alternate modes usage: / - tree: - description: Tree generator tool - usage: / [type] repl: description: Block replacer tool usage: / @@ -226,9 +220,12 @@ commands: description: Brush tool usage: / aliases: ['b'] - mask: - description: Set the brush mask - usage: / [mask] + info: + description: Block information tool + usage: / + tree: + description: Tree generator tool + usage: / [type] tool: description: Select a tool to bind usage: / @@ -241,19 +238,19 @@ commands: description: Select super pickaxe mode usage: / aliases: ['pickaxe', 'sp'] - remove: - description: Remove all entities of a type - usage: / - aliases: ['rem', 'rement'] - /fill: - description: Fill a hole - usage: / [depth] + mat: + description: Set the brush material + usage: / [pattern] + aliases: ['material', 'fill'] + size: + description: Set the brush size + usage: / [pattern] + mask: + description: Set the brush mask + usage: / [mask] /fillr: description: Fill a hole recursively usage: / [depth] - /drain: - description: Drain a pool - usage: / fixlava: description: Fix lava to be stationary usage: / @@ -285,3 +282,13 @@ commands: butcher: description: Kill all or nearby mobs usage: / [radius] + remove: + description: Remove all entities of a type + usage: / + aliases: ['rem', 'rement'] + /fill: + description: Fill a hole + usage: / [depth] + /drain: + description: Drain a pool + usage: / diff --git a/src/com/sk89q/worldedit/commands/ToolUtilCommands.java b/src/com/sk89q/worldedit/commands/ToolUtilCommands.java index fd8a6ed03..cea223007 100644 --- a/src/com/sk89q/worldedit/commands/ToolUtilCommands.java +++ b/src/com/sk89q/worldedit/commands/ToolUtilCommands.java @@ -25,6 +25,7 @@ import com.sk89q.minecraft.util.commands.CommandPermissions; import com.sk89q.minecraft.util.commands.NestedCommand; import com.sk89q.worldedit.*; import com.sk89q.worldedit.masks.Mask; +import com.sk89q.worldedit.patterns.Pattern; /** * Tool commands. @@ -90,4 +91,43 @@ public class ToolUtilCommands { player.print("Brush mask set."); } } + + @Command( + aliases = {"mat", "material", "fill"}, + usage = "[pattern]", + desc = "Set the brush material", + min = 1, + max = 1 + ) + public static void material(CommandContext args, WorldEdit we, + LocalSession session, LocalPlayer player, EditSession editSession) + throws WorldEditException { + Pattern pattern = we.getBlockPattern(player, args.getString(0)); + session.getBrushTool(player.getItemInHand()).setFill(pattern); + player.print("Brush material set."); + } + + @Command( + aliases = {"size"}, + usage = "[pattern]", + desc = "Set the brush size", + min = 1, + max = 1 + ) + public static void size(CommandContext args, WorldEdit we, + LocalSession session, LocalPlayer player, EditSession editSession) + throws WorldEditException { + + LocalConfiguration config = we.getConfiguration(); + + int radius = args.getInteger(0); + if (radius > config.maxBrushRadius) { + player.printError("Maximum allowed brush radius: " + + config.maxBrushRadius); + return; + } + + session.getBrushTool(player.getItemInHand()).setSize(radius); + player.print("Brush size set."); + } } diff --git a/src/com/sk89q/worldedit/masks/BlockTypeMask.java b/src/com/sk89q/worldedit/masks/BlockTypeMask.java index 52c52d0b1..9ecc2ce34 100644 --- a/src/com/sk89q/worldedit/masks/BlockTypeMask.java +++ b/src/com/sk89q/worldedit/masks/BlockTypeMask.java @@ -30,7 +30,7 @@ import com.sk89q.worldedit.Vector; * @author sk89q */ public class BlockTypeMask implements Mask { - private Set types; + protected Set types; public BlockTypeMask() { types = new HashSet();