Added /size and /mat commands for the brush.

This commit is contained in:
sk89q 2011-02-18 23:33:43 -08:00
parent 0f46fb957f
commit 8680a9e6bd
3 changed files with 116 additions and 69 deletions

View File

@ -23,6 +23,9 @@ commands:
delchunks: delchunks:
description: Delete chunks that your selection includes description: Delete chunks that your selection includes
usage: /<command> usage: /<command>
clearclipboard:
description: Clear your clipboard
usage: /<command>
/load: /load:
description: Load a schematic into your clipboard description: Load a schematic into your clipboard
usage: /<command> <filename> usage: /<command> <filename>
@ -44,12 +47,6 @@ commands:
/paste: /paste:
description: Paste the clipboard's contents description: Paste the clipboard's contents
usage: /<command> [-ao] usage: /<command> [-ao]
clearclipboard:
description: Clear your clipboard
usage: /<command>
/limit:
description: Modify block change limit
usage: /<command> <limit>
toggleplace: toggleplace:
description: description:
usage: /<command> usage: /<command>
@ -57,6 +54,9 @@ commands:
description: Search for an item description: Search for an item
usage: /<command> [-bi] <query> usage: /<command> [-bi] <query>
aliases: ['/l'] aliases: ['/l']
/limit:
description: Modify block change limit
usage: /<command> <limit>
/sphere: /sphere:
description: Generate a filled sphere description: Generate a filled sphere
usage: /<command> <block> <radius> [raised?] usage: /<command> <block> <radius> [raised?]
@ -75,17 +75,17 @@ commands:
pumpkins: pumpkins:
description: Generate pumpkin patches description: Generate pumpkin patches
usage: /<command> [size] usage: /<command> [size]
/undo: clearhistory:
description: Undoes the last action description: Clear your history
usage: /<command> [times] usage: /<command>
aliases: ['undo']
/redo: /redo:
description: Redoes the last action (from history) description: Redoes the last action (from history)
usage: /<command> [times] usage: /<command> [times]
aliases: ['redo'] aliases: ['redo']
clearhistory: /undo:
description: Clear your history description: Undoes the last action
usage: /<command> usage: /<command> [times]
aliases: ['undo']
unstuck: unstuck:
description: Escape from being stuck inside a block description: Escape from being stuck inside a block
usage: /<command> usage: /<command>
@ -95,27 +95,18 @@ commands:
descend: descend:
description: Go down a floor description: Go down a floor
usage: /<command> usage: /<command>
ceil:
description: Go to the celing
usage: /<command> [clearance]
thru: thru:
description: Passthrough walls description: Passthrough walls
usage: /<command> usage: /<command>
jumpto: jumpto:
description: Teleport to a location description: Teleport to a location
usage: /<command> usage: /<command>
ceil:
description: Go to the celing
usage: /<command> [clearance]
up: up:
description: Go upwards some distance description: Go upwards some distance
usage: /<command> <block> usage: /<command> <block>
/replace:
description: Replace all blocks in the selection with another
usage: /<command> [from-block] <to-block>
/stack:
description: Repeat the contents of the selection
usage: /<command> [-a] [count] [direction]
/set:
description: Set all the blocks inside the selection to a block
usage: /<command> <block>
/overlay: /overlay:
description: Set a block on top of blocks in the region description: Set a block on top of blocks in the region
usage: /<command> <block> usage: /<command> <block>
@ -129,24 +120,24 @@ commands:
/smooth: /smooth:
description: Smooth the elevation in the selection description: Smooth the elevation in the selection
usage: /<command> [iterations] usage: /<command> [iterations]
/replace:
description: Replace all blocks in the selection with another
usage: /<command> [from-block] <to-block>
/stack:
description: Repeat the contents of the selection
usage: /<command> [-a] [count] [direction]
/set:
description: Set all the blocks inside the selection to a block
usage: /<command> <block>
/move: /move:
description: Move the contents of the selection description: Move the contents of the selection
usage: /<command> [count] [direction] [leave-id] usage: /<command> [count] [direction] [leave-id]
cs:
description: Execute a CraftScript
usage: /<command> <filename> [args...]
.s: .s:
description: Execute last CraftScript description: Execute last CraftScript
usage: /<command> [args...] usage: /<command> [args...]
//count: cs:
description: Counts the number of a certain type of block description: Execute a CraftScript
usage: /<command> <block> usage: /<command> <filename> [args...]
/size:
description: Get information about the selection
usage: /<command>
/shift:
description: Shift the selection area
usage: /<command> <amount> [direction]
/chunk: /chunk:
description: Set the selection to your current chunk description: Set the selection to your current chunk
usage: /<command> usage: /<command>
@ -168,27 +159,36 @@ commands:
toggleeditwand: toggleeditwand:
description: Toggle functionality of the edit wand description: Toggle functionality of the edit wand
usage: /<command> usage: /<command>
/expand:
description: Expand the selection area
usage: /<command> <amount> [reverse-amount] <direction>
/contract: /contract:
description: Contract the selection area description: Contract the selection area
usage: /<command> <amount> [reverse-amount] [direction] usage: /<command> <amount> [reverse-amount] [direction]
/outset: /outset:
description: Outset the selection area description: Outset the selection area
usage: /<command> [-hv] <amount> usage: /<command> [-hv] <amount>
/inset:
description: Inset the selection area
usage: /<command> [-hv] <amount>
/distr: /distr:
description: Get the distribution of blocks in the selection description: Get the distribution of blocks in the selection
usage: /<command> [-c] usage: /<command> [-c]
list: //count:
description: List snapshots description: Counts the number of a certain type of block
usage: /<command> [num] usage: /<command> <block>
/size:
description: Get information about the selection
usage: /<command>
/shift:
description: Shift the selection area
usage: /<command> <amount> [direction]
/expand:
description: Expand the selection area
usage: /<command> <amount> [reverse-amount] <direction>
/inset:
description: Inset the selection area
usage: /<command> [-hv] <amount>
use: use:
description: Choose a snapshot to use description: Choose a snapshot to use
usage: /<command> <snapshot> usage: /<command> <snapshot>
list:
description: List snapshots
usage: /<command> [num]
snapshot: snapshot:
description: Snapshot commands description: Snapshot commands
usage: /<command> usage: /<command>
@ -197,6 +197,9 @@ commands:
description: Restore the selection from a snapshot description: Restore the selection from a snapshot
usage: /<command> [snapshot] usage: /<command> [snapshot]
aliases: ['/restore'] aliases: ['/restore']
area:
description: Enable the area super pickaxe pickaxe mode
usage: /<command> <radius>
recur: recur:
description: Enable the recursive super pickaxe pickaxe mode description: Enable the recursive super pickaxe pickaxe mode
usage: /<command> <radius> usage: /<command> <radius>
@ -204,18 +207,9 @@ commands:
single: single:
description: Enable the single block super pickaxe mode description: Enable the single block super pickaxe mode
usage: /<command> usage: /<command>
area:
description: Enable the area super pickaxe pickaxe mode
usage: /<command> <radius>
info:
description: Block information tool
usage: /<command>
none: none:
description: Turn off all superpickaxe alternate modes description: Turn off all superpickaxe alternate modes
usage: /<command> usage: /<command>
tree:
description: Tree generator tool
usage: /<command> [type]
repl: repl:
description: Block replacer tool description: Block replacer tool
usage: /<command> <block> usage: /<command> <block>
@ -226,9 +220,12 @@ commands:
description: Brush tool description: Brush tool
usage: /<command> usage: /<command>
aliases: ['b'] aliases: ['b']
mask: info:
description: Set the brush mask description: Block information tool
usage: /<command> [mask] usage: /<command>
tree:
description: Tree generator tool
usage: /<command> [type]
tool: tool:
description: Select a tool to bind description: Select a tool to bind
usage: /<command> usage: /<command>
@ -241,19 +238,19 @@ commands:
description: Select super pickaxe mode description: Select super pickaxe mode
usage: /<command> usage: /<command>
aliases: ['pickaxe', 'sp'] aliases: ['pickaxe', 'sp']
remove: mat:
description: Remove all entities of a type description: Set the brush material
usage: /<command> <type> <radius> usage: /<command> [pattern]
aliases: ['rem', 'rement'] aliases: ['material', 'fill']
/fill: size:
description: Fill a hole description: Set the brush size
usage: /<command> <block> <radius> [depth] usage: /<command> [pattern]
mask:
description: Set the brush mask
usage: /<command> [mask]
/fillr: /fillr:
description: Fill a hole recursively description: Fill a hole recursively
usage: /<command> <block> <radius> [depth] usage: /<command> <block> <radius> [depth]
/drain:
description: Drain a pool
usage: /<command> <radius>
fixlava: fixlava:
description: Fix lava to be stationary description: Fix lava to be stationary
usage: /<command> <radius> usage: /<command> <radius>
@ -285,3 +282,13 @@ commands:
butcher: butcher:
description: Kill all or nearby mobs description: Kill all or nearby mobs
usage: /<command> [radius] usage: /<command> [radius]
remove:
description: Remove all entities of a type
usage: /<command> <type> <radius>
aliases: ['rem', 'rement']
/fill:
description: Fill a hole
usage: /<command> <block> <radius> [depth]
/drain:
description: Drain a pool
usage: /<command> <radius>

View File

@ -25,6 +25,7 @@ import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.minecraft.util.commands.NestedCommand; import com.sk89q.minecraft.util.commands.NestedCommand;
import com.sk89q.worldedit.*; import com.sk89q.worldedit.*;
import com.sk89q.worldedit.masks.Mask; import com.sk89q.worldedit.masks.Mask;
import com.sk89q.worldedit.patterns.Pattern;
/** /**
* Tool commands. * Tool commands.
@ -90,4 +91,43 @@ public class ToolUtilCommands {
player.print("Brush mask set."); 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.");
}
} }

View File

@ -30,7 +30,7 @@ import com.sk89q.worldedit.Vector;
* @author sk89q * @author sk89q
*/ */
public class BlockTypeMask implements Mask { public class BlockTypeMask implements Mask {
private Set<Integer> types; protected Set<Integer> types;
public BlockTypeMask() { public BlockTypeMask() {
types = new HashSet<Integer>(); types = new HashSet<Integer>();