Fixed /jumpto and the help for //expand and //contract.

This commit is contained in:
sk89q 2010-11-10 01:54:07 -08:00
parent 586ae69467
commit b0330aa83c
2 changed files with 24 additions and 3 deletions

View File

@ -157,8 +157,8 @@ public class WorldEditListener extends PluginListener {
commands.put("//limit", "[Num] - See documentation"); commands.put("//limit", "[Num] - See documentation");
commands.put("//mode", "[Mode] <Size> - Set super pickaxe mode (single/recursive/area)"); commands.put("//mode", "[Mode] <Size> - Set super pickaxe mode (single/recursive/area)");
commands.put("//tool", "[Tool] - Set pickaxe tool (none/tree)"); commands.put("//tool", "[Tool] - Set pickaxe tool (none/tree)");
commands.put("//expand", "<Dir> [Num] - Expands the selection"); commands.put("//expand", "[Num] <Dir> - Expands the selection");
commands.put("//contract", "<Dir> [Num] - Contracts the selection"); commands.put("//contract", "[Num] <Dir> - Contracts the selection");
commands.put("//rotate", "[Angle] - Rotate the clipboard"); commands.put("//rotate", "[Angle] - Rotate the clipboard");
commands.put("//hcyl", "[ID] [Radius] <Height> - Create a vertical hollow cylinder"); commands.put("//hcyl", "[ID] [Radius] <Height> - Create a vertical hollow cylinder");
commands.put("//cyl", "[ID] [Radius] <Height> - Create a vertical cylinder"); commands.put("//cyl", "[ID] [Radius] <Height> - Create a vertical cylinder");
@ -429,7 +429,7 @@ public class WorldEditListener extends PluginListener {
// Jump to the block in sight // Jump to the block in sight
} else if (split[0].equalsIgnoreCase("/jumpto")) { } else if (split[0].equalsIgnoreCase("/jumpto")) {
checkArgs(split, 0, 0, split[0]); checkArgs(split, 0, 0, split[0]);
Vector pos = player.getBlockTrace(300); Vector pos = player.getSolidBlockTrace(300);
if (pos != null) { if (pos != null) {
player.findFreePosition(pos); player.findFreePosition(pos);
player.print("Poof!"); player.print("Poof!");

View File

@ -315,6 +315,27 @@ public class WorldEditPlayer {
return new Vector(block.getX(), block.getY(), block.getZ()); return new Vector(block.getX(), block.getY(), block.getZ());
} }
/**
* Get the point of the block being looked at. May return null.
*
* @param range
* @return point
*/
public Vector getSolidBlockTrace(int range) {
HitBlox hitBlox = new HitBlox(player, range, 0.2);
Block block = null;
while (hitBlox.getNextBlock() != null
&& BlockType.canPassThrough(hitBlox.getCurBlock().getType()));
block = hitBlox.getCurBlock();
if (block == null) {
return null;
}
return new Vector(block.getX(), block.getY(), block.getZ());
}
/** /**
* Get the player's cardinal direction (N, W, NW, etc.). * Get the player's cardinal direction (N, W, NW, etc.).
* *