Added a tool that allows a player to place and remove blocks at a distance.

This commit is contained in:
Wizjany
2011-09-18 21:49:45 -04:00
parent 1a6bc6f42c
commit 67a7969cd1
7 changed files with 353 additions and 8 deletions

View File

@ -27,6 +27,8 @@ import com.sk89q.worldedit.BlockWorldVector;
import com.sk89q.worldedit.LocalPlayer;
import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldVectorFace;
import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.blocks.BlockType;
/**
@ -110,7 +112,7 @@ public class TargetBlock {
boolean searchForLastBlock = true;
BlockWorldVector lastBlock = null;
while (getNextBlock() != null) {
if (world.getBlockType(getCurrentBlock()) == 0) {
if (world.getBlockType(getCurrentBlock()) == BlockID.AIR) {
if(searchForLastBlock) {
lastBlock = getCurrentBlock();
if (lastBlock.getBlockY() <= 0 || lastBlock.getBlockY() >= 127) {
@ -196,4 +198,14 @@ public class TargetBlock {
public BlockWorldVector getPreviousBlock() {
return new BlockWorldVector(world, prevPos);
}
public WorldVectorFace getAnyTargetBlockFace() {
getAnyTargetBlock();
return WorldVectorFace.getWorldVectorFace(world, getCurrentBlock(), getPreviousBlock());
}
public WorldVectorFace getTargetBlockFace() {
getAnyTargetBlock();
return WorldVectorFace.getWorldVectorFace(world, getCurrentBlock(), getPreviousBlock());
}
}