Add convenience methods: isPassable, getVector

This commit is contained in:
asofold 2012-10-09 17:18:36 +02:00
parent 8311070902
commit ded72a5152

View File

@ -16,6 +16,7 @@ import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
/*
* MM"""""""`YM dP
@ -68,6 +69,9 @@ public class PlayerLocation {
/** Is the player on ladder? */
private Boolean onLadder;
/** Simple test if the exact position is passable. */
private Boolean passable;
/** The bounding box of the player. */
private AxisAlignedBB boundingBox;
@ -329,6 +333,15 @@ public class PlayerLocation {
return typeId == Material.LADDER.getId() || typeId == Material.VINE.getId();
}
/**
* Simple at the spot passability test, no bounding boxes.
* @return
*/
public boolean isPassable(){
if (passable == null) passable = BlockProperties.isPassable(getBlockAccess(), x, y, z, getTypeId());
return passable;
}
/**
* Sets the player location object.
*
@ -501,4 +514,8 @@ public class PlayerLocation {
return worldServer;
}
public Vector getVector() {
return new Vector(x, y, z);
}
}