/** * Breaks a raw string up into pages using the default width and height. * * @param unpaginatedString The raw string to break. * @param pageNumber The page number to fetch. * @return A single chat page. */ public static ChatPage paginate(String unpaginatedString, int pageNumber) { return paginate(unpaginatedString, pageNumber, GUARANTEED_NO_WRAP_CHAT_PAGE_WIDTH, CLOSED_CHAT_PAGE_HEIGHT); }
/** * Constructs a new {@link Vector} based on this Location * * @return New Vector containing the coordinates represented by this * Location */ public Vector toVector() { return new Vector(x, y, z); }
/** * Get a new block vector. * * @return vector */ @Override public BlockVector clone() { return (BlockVector) super.clone(); }
/** * Converts this vector to a unit vector (a vector with length of 1). * * @return the same vector */ public Vector normalize() { double length = length(); x /= length; y /= length; z /= length; return this; }
/** * Safely converts a double (location coordinate) to an int (block * coordinate) * * @param loc Precise coordinate * @return Block coordinate */ public static int locToBlock(double loc) { return NumberConversions.floor(loc); } }
/** * Get the block vector of this vector. * * @return A block vector. */ public BlockVector toBlockVector() { return new BlockVector(x, y, z); }
/** * Returns true if the iteration has more elements */ public boolean hasNext() { scan(); return currentBlock != -1; }
/** * Gets a new midpoint vector between this vector and another. * * @param other The other vector * @return a new midpoint vector */ public Vector getMidpoint(Vector other) { double x = (this.x + other.x) / 2; double y = (this.y + other.y) / 2; double z = (this.z + other.z) / 2; return new Vector(x, y, z); }
/** * Sets the velocity that the entity will have after exiting the portal. */ public void setAfter(Vector after) { this.after = after.clone(); }
/** * Gets the floored value of the Y component, indicating the block that * this vector is contained with. * * @return block y */ public int getBlockY() { return NumberConversions.floor(y); }
/** * Gets the velocity. * <p> * Note: Modifying the returned Vector will not change the velocity, you * must use {@link #setVelocity(org.bukkit.util.Vector)} instead. * * @return A Vector for the dispensed item's velocity */ public Vector getVelocity() { return velocity.clone(); }
/** * Gets the floored value of the X component, indicating the block that * this vector is contained with. * * @return block X */ public int getBlockX() { return NumberConversions.floor(x); }
/** * Returns whether this vector is within a sphere. * * @param origin Sphere origin. * @param radius Sphere radius * @return whether this vector is in the sphere */ public boolean isInSphere(Vector origin, double radius) { return (NumberConversions.square(origin.x - x) + NumberConversions.square(origin.y - y) + NumberConversions.square(origin.z - z)) <= NumberConversions.square(radius); }
/** * Gets a copy of the velocity that the entity has before entering the * portal. * * @return velocity of entity before entering portal */ public Vector getBefore() { return this.before.clone(); }
/** * Gets the floored value of the Z component, indicating the block that * this vector is contained with. * * @return block z */ public int getBlockZ() { return NumberConversions.floor(z); }
/** * Gets a copy of the velocity that the entity will have after exiting the * portal. * * @return velocity of entity after exiting portal */ public Vector getAfter() { return this.after.clone(); }