From d997dbac2b7fcb343b9cc541b0f67d8252ae665a Mon Sep 17 00:00:00 2001 From: sk89q Date: Sun, 9 Jan 2011 09:25:24 -0800 Subject: [PATCH] Fixed HMPlayer.getSolidBlockTrace() and HMPlayer.getBlockTrace() returning null for the world. Changed LocalPlayer.findFreePosition() to take a WorldVector instead. --- src/HMPlayer.java | 4 ++-- src/com/sk89q/worldedit/LocalPlayer.java | 5 +++-- src/com/sk89q/worldedit/Vector.java | 4 ++-- src/com/sk89q/worldedit/WorldEditController.java | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/HMPlayer.java b/src/HMPlayer.java index a7dcbfd03..ee9615530 100644 --- a/src/HMPlayer.java +++ b/src/HMPlayer.java @@ -71,7 +71,7 @@ public class HMPlayer extends LocalPlayer { if (block == null) { return null; } - return new WorldVector(null, block.getX(), block.getY(), block.getZ()); + return new WorldVector(world, block.getX(), block.getY(), block.getZ()); } /** @@ -92,7 +92,7 @@ public class HMPlayer extends LocalPlayer { if (block == null) { return null; } - return new WorldVector(null, block.getX(), block.getY(), block.getZ()); + return new WorldVector(world, block.getX(), block.getY(), block.getZ()); } /** diff --git a/src/com/sk89q/worldedit/LocalPlayer.java b/src/com/sk89q/worldedit/LocalPlayer.java index e1fb89cea..3916be495 100644 --- a/src/com/sk89q/worldedit/LocalPlayer.java +++ b/src/com/sk89q/worldedit/LocalPlayer.java @@ -74,7 +74,8 @@ public abstract class LocalPlayer { * * @param searchPos search position */ - public void findFreePosition(LocalWorld world, Vector searchPos) { + public void findFreePosition(WorldVector searchPos) { + LocalWorld world = searchPos.getWorld(); int x = searchPos.getBlockX(); int y = Math.max(0, searchPos.getBlockY()); int origY = y; @@ -108,7 +109,7 @@ public abstract class LocalPlayer { * that free position. */ public void findFreePosition() { - findFreePosition(getPosition().getWorld(), getBlockIn()); + findFreePosition(getBlockIn()); } /** diff --git a/src/com/sk89q/worldedit/Vector.java b/src/com/sk89q/worldedit/Vector.java index 055d02509..582c180da 100644 --- a/src/com/sk89q/worldedit/Vector.java +++ b/src/com/sk89q/worldedit/Vector.java @@ -467,8 +467,8 @@ public class Vector { */ public boolean containedWithin(Vector min, Vector max) { return x >= min.getX() && x <= max.getX() - && y >= min.getY() && z <= max.getY() - && z >= min.getZ() && z <= max.getY(); + && y >= min.getY() && y <= max.getY() + && z >= min.getZ() && z <= max.getZ(); } /** diff --git a/src/com/sk89q/worldedit/WorldEditController.java b/src/com/sk89q/worldedit/WorldEditController.java index 418a3fc71..3b9715ca5 100644 --- a/src/com/sk89q/worldedit/WorldEditController.java +++ b/src/com/sk89q/worldedit/WorldEditController.java @@ -467,7 +467,7 @@ public class WorldEditController { checkArgs(split, 0, 0, split[0]); WorldVector pos = player.getSolidBlockTrace(300); if (pos != null) { - player.findFreePosition(pos.getWorld(), pos); + player.findFreePosition(pos); player.print("Poof!"); } else { player.printError("No block in sight!");