diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index a5c0bed8da..70e7df7ece 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -48,6 +48,19 @@ public class CraftBlock implements Block { return new Location(getWorld(), x, y, z); } + public Location getLocation(Location loc) { + if (loc != null) { + loc.setWorld(getWorld()); + loc.setX(x); + loc.setY(y); + loc.setZ(z); + loc.setYaw(0); + loc.setPitch(0); + } + + return loc; + } + public BlockVector getVector() { return new BlockVector(x, y, z); } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java index e83eb3017e..0529689887 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java @@ -148,6 +148,19 @@ public class CraftBlockState implements BlockState { return new Location(world, x, y, z); } + public Location getLocation(Location loc) { + if (loc != null) { + loc.setWorld(world); + loc.setX(x); + loc.setY(y); + loc.setZ(z); + loc.setYaw(0); + loc.setPitch(0); + } + + return loc; + } + public void setRawData(byte data) { this.data.setData(data); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index e68edf10c8..503c8a9adc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -156,6 +156,19 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return new Location(getWorld(), entity.locX, entity.locY, entity.locZ, entity.yaw, entity.pitch); } + public Location getLocation(Location loc) { + if (loc != null) { + loc.setWorld(getWorld()); + loc.setX(entity.locX); + loc.setY(entity.locY); + loc.setZ(entity.locZ); + loc.setYaw(entity.yaw); + loc.setPitch(entity.pitch); + } + + return loc; + } + public Vector getVelocity() { return new Vector(entity.motX, entity.motY, entity.motZ); }