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

View File

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