/** * Gets the number of rows in this inventory. * * @return row count */ public int getRows() { return this.getValue().getY(); }
/** * Gets the Y position of this slot within the queried parent. * * @return slot y coordinate */ public int getY() { return this.getValue().getY(); }
/** * Returns a new transform representing a scaling on each axis. The scale * factors must be non-zero. * * @param vector The scale vector * @return The new scale transform */ public static DiscreteTransform2 fromScale(Vector2i vector) { return fromScale(vector.getX(), vector.getY()); }
/** * Returns the y level that precipitation ends falling in the given column. * * <p>A value is still returned for columns in biomes which do not * receive precipitation.</p> * * @param column The column value * @return The y level that precipitation ends */ default int getPrecipitationLevelAt(Vector2i column) { return this.getPrecipitationLevelAt(column.getX(), column.getY()); }
/** * Transforms the x coordinate of a vector using this transform. Only * creates a new object on the first call. * * @param vector The original vector * @return The transformed x coordinate */ public int transformX(Vector2i vector) { return transformX(vector.getX(), vector.getY()); }
/** * Transforms the y coordinate of a vector using this transform. Only * creates a new object on the first call. * * @param vector The original vector * @return The transformed y coordinate */ public int transformY(Vector2i vector) { return transformY(vector.getX(), vector.getY()); }
/** * Transforms a vector using this transforms. * * @param vector The original vector * @return The transformed vector */ public Vector2i transform(Vector2i vector) { return transform(vector.getX(), vector.getY()); }
/** * Adds a scale factor for each axis to this transform and returns it as a * new transform. The factors must be non-zero. * * @param vector The scale vector * @return The scaled transform as a copy */ public DiscreteTransform2 withScale(Vector2i vector) { return withScale(vector.getX(), vector.getY()); }
/** * Adds a translation to this transform and returns it as a new transform. * * @param vector The translation vector * @return The translated transform as a copy */ public DiscreteTransform2 withTranslation(Vector2i vector) { return withTranslation(vector.getX(), vector.getY()); }
/** * Returns a new transform representing a translation. * * @param vector The translation vector * @return The new translation transform */ public static DiscreteTransform2 fromTranslation(Vector2i vector) { return fromTranslation(vector.getX(), vector.getY()); }
/** * Get the y value of the highest block that sunlight can reach in the given * column. * * <p>This method ignores all transparent blocks, providing the highest * opaque block.</p> * * @param column The column value * @return The y value of the highest opaque block */ default int getHighestYAt(Vector2i column) { return this.getHighestYAt(column.getX(), column.getY()); }
/** * Returns a new transform representing a centered rotation of an area of * tiles. The rotation is given is quarter turns. The actual rotation is * {@code quarterTurns * 90}. Areas with differing parities on the axes can * only be rotated by multiples of 180 degrees. * * @param quarterTurns The amount of quarter turns in this rotation * @param size The size of the area to rotate * @return The new rotation transform */ public static DiscreteTransform2 rotationAroundCenter(int quarterTurns, Vector2i size) { Preconditions.checkArgument(size.getX() > 0, "The size on x must be positive"); Preconditions.checkArgument(size.getY() > 0, "The size on y must be positive"); final boolean mul180 = (quarterTurns & 1) == 0; final boolean xEven = (size.getX() & 1) == 0; final boolean yEven = (size.getY() & 1) == 0; Preconditions.checkArgument(mul180 || xEven == yEven, "The size must have the same parity on all axes for rotations that are " + "not a multiple of 180 degrees"); final Vector2i center = size.sub(1, 1).div(2); if (mul180) { return fromRotation(quarterTurns, center, xEven, yEven); } return fromRotation(quarterTurns, center, xEven); }
/** * Get the Y position of this slot within the queried parent. * * @return slot y coordinate */ public int getY() { return this.getValue().getY(); }
/** * Constructs a new rectangle at (0, 0) of the desired width and height. * * @param size The (width, height) vector */ public Rectangle(Vector2i size) { this(size.getX(), size.getY()); }
/** * Get the number of rows in this inventory. * * @return row count */ public int getRows() { return this.getValue().getY(); }
public static ChunkPosition of(Vector2i vector, String world) { Objects.requireNonNull(vector, "vector"); Objects.requireNonNull(world, "world"); return of(vector.getX(), vector.getY(), world); }
/** * Transforms the x coordinate of a vector using this transform. Only * creates a new object on the first call. * * @param vector The original vector * @return The transformed x coordinate */ public int transformX(Vector2i vector) { return transformX(vector.getX(), vector.getY()); }
/** * Returns a new transform representing a scaling on each axis. The scale * factors must be non-zero. * * @param vector The scale vector * @return The new scale transform */ public static DiscreteTransform2 fromScale(Vector2i vector) { return fromScale(vector.getX(), vector.getY()); }
/** * Adds a translation to this transform and returns it as a new transform. * * @param vector The translation vector * @return The translated transform as a copy */ public DiscreteTransform2 withTranslation(Vector2i vector) { return withTranslation(vector.getX(), vector.getY()); }