Refine search
/** * Gets whether there has been a position change between the two Locations. * * @param first The initial location. * @param second The final location. * @return A boolean. */ public static boolean hasMoved(Location first, Location second) { return first.getX() != second.getX() || first.getY() != second.getY() || first.getZ() != second.getZ(); }
/** * Write a Location to the "Pos" and "Rotation" children of a tag. * * <p>Does not save world information, use writeWorld instead. * * @param loc The location to write. * @param tag The tag to write to. */ public static void locationToListTags(Location loc, CompoundTag tag) { tag.putDoubleList("Pos", Arrays.asList(loc.getX(), loc.getY(), loc.getZ())); tag.putFloatList("Rotation", Arrays.asList(loc.getYaw(), loc.getPitch())); }
/** * Create a WorldEdit BlockVector from a Bukkit location. * * @param location The Bukkit location * @return a WorldEdit vector */ public static BlockVector3 asBlockVector(org.bukkit.Location location) { checkNotNull(location); return BlockVector3.at(location.getX(), location.getY(), location.getZ()); }
/** * Creates the spawn messages given the shooter ID on the receiving end (which is different for * the shooter than for everyone else). * * @param shooterId the shooter's ID, according to the receiving client * @return the spawn messages */ private List<Message> createSpawnMessage(int shooterId) { List<Message> spawnMessage = super.createSpawnMessage(); double x = location.getX(); double y = location.getY(); double z = location.getZ(); int intPitch = Position.getIntPitch(location); int intHeadYaw = Position.getIntHeadYaw(location.getYaw()); spawnMessage.set(0, new SpawnObjectMessage(getEntityId(), getUniqueId(), SpawnObjectMessage.FISHING_HOOK, x, y, z, intPitch, intHeadYaw, shooterId, velocity)); return spawnMessage; }
/** * Copy the contents of one Location to another. * * @param source The Location to read from. * @param dest The Location to modify. May be null. * @return The dest parameter, modified if not null. */ public static Location copyLocation(Location source, Location dest) { if (dest == null) { return null; } dest.setWorld(source.getWorld()); dest.setX(source.getX()); dest.setY(source.getY()); dest.setZ(source.getZ()); dest.setPitch(source.getPitch()); dest.setYaw(source.getYaw()); return dest; }