Fixed HMPlayer.getSolidBlockTrace() and HMPlayer.getBlockTrace() returning null for the world. Changed LocalPlayer.findFreePosition() to take a WorldVector instead.

Dieser Commit ist enthalten in:
sk89q 2011-01-09 09:25:24 -08:00
Ursprung 03cf12fcfd
Commit d997dbac2b
4 geänderte Dateien mit 8 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -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());
}
/**

Datei anzeigen

@ -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());
}
/**

Datei anzeigen

@ -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();
}
/**

Datei anzeigen

@ -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!");