From 1784b29f020362d0954920ee157abb48b43586c5 Mon Sep 17 00:00:00 2001 From: hash Date: Wed, 15 Jun 2011 20:01:03 -0500 Subject: [PATCH] Added a new utility method to BukkitUtil to do the common task of shifting coordinates for an entity to the center of a block. --- .../java/com/sk89q/worldedit/bukkit/BukkitUtil.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/com/sk89q/worldedit/bukkit/BukkitUtil.java b/src/main/java/com/sk89q/worldedit/bukkit/BukkitUtil.java index c200e3a97..3e2647422 100644 --- a/src/main/java/com/sk89q/worldedit/bukkit/BukkitUtil.java +++ b/src/main/java/com/sk89q/worldedit/bukkit/BukkitUtil.java @@ -71,6 +71,17 @@ public class BukkitUtil { return new Location(world, pt.getX(), pt.getY(), pt.getZ()); } + public static Location center(Location loc) { + return new Location( + loc.getWorld(), + loc.getBlockX()+0.5, + loc.getBlockY()+0.5, + loc.getBlockZ()+0.5, + loc.getPitch(), + loc.getYaw() + ); + } + public static Player matchSinglePlayer(Server server, String name) { List players = server.matchPlayer(name); if (players.size() == 0) {