/** * Create a new InventoryDimension property with the specified dimensions. * * @param width width of the inventory to match * @param height height of the inventory to match */ public InventoryDimension(int width, int height) { super(new Vector2i(width, height)); }
/** * Create a new SlotPos property for matching the specified value with the * specified operator. * * @param x slot x position * @param y slot y position * @param operator the operator to use when comparing with other properties */ public SlotPos(int x, int y, Operator operator) { super(new Vector2i(x, y), operator); }
/** * Create a new InventoryDimension property with the specified dimensions. * * @param width width of the inventory to match * @param height height of the inventory to match * @param operator logical operator to use when comparing this property with * other properties */ public InventoryDimension(int width, int height, Operator operator) { super(new Vector2i(width, height), operator); }
/** * Create a new SlotPos property for matching the specified value. * * @param x slot x position * @param y slot y position */ public SlotPos(int x, int y) { super(new Vector2i(x, y)); }
/** * Create an SlotPos property which matches SlotPos properties with equal * value. * * @param x the x position of the slot to match * @param y the y position of the slot to match * @return new property */ public static SlotPos of(int x, int y) { return new SlotPos(new Vector2i(x, y), Operator.EQUAL); }
/** * Create an InventoryDimension property which matches InventoryDimension * properties with equal value. * * @param width x coordinate to match * @param height y coordinate to match * @return new property */ public static InventoryDimension of(int width, int height) { return new InventoryDimension(new Vector2i(width, height), Operator.EQUAL); }
/** * Transform a vector represented as a pair of coordinates using this * transform. * * @param x The x coordinate of the original vector * @param y The y coordinate of the original vector * @return The transformed vector */ public Vector2i transform(int x, int y) { return new Vector2i(transformX(x, y), transformY(x, y)); }
return (Vector2i)obj; } else if (obj instanceof Vector3i) { return new Vector2i((Vector3i)obj); } else if (obj instanceof Vector4i) { return new Vector2i((Vector4i)obj); } else if (obj instanceof VectorNi) { return new Vector2i((VectorNi)obj); return new Vector2i(Integer.parseInt(vecMatch.group(1)), Integer.parseInt(vecMatch.group(2))); return new Vector2i(Coerce.toInteger(list.get(0)), Coerce.toInteger(list.get(1)));
switch (axis) { case X: { final Matrix3d rotation2 = DiscreteTransform2.rotationAroundCenter(quarterTurns, new Vector2i(size.getZ(), size.getY())).getMatrix(); rotation3 = new Matrix4d( 1, 0, 0, 0, final Matrix3d rotation2 = DiscreteTransform2.rotationAroundCenter(quarterTurns, new Vector2i(size.getX(), size.getZ())).getMatrix(); rotation3 = new Matrix4d( rotation2.get(0, 0), 0, rotation2.get(0, 1), rotation2.get(0, 2), final Matrix3d rotation2 = DiscreteTransform2.rotationAroundCenter(quarterTurns, new Vector2i(size.getX(), size.getY())).getMatrix(); rotation3 = new Matrix4d( rotation2.get(0, 0), rotation2.get(0, 1), 0, rotation2.get(0, 2),
/** * Returns the position. * * @return The position */ public Vector2i getPosition() { return new Vector2i(x, y); }
/** * Create a new InventoryDimension property with the specified dimensions. * * @param width width of the inventory to match * @param height height of the inventory to match */ public InventoryDimension(int width, int height) { super(new Vector2i(width, height)); }
/** * Create a new SlotPos property for matching the specified value with the * specified operator. * * @param x slot x position * @param y slot y position * @param operator the operator to use when comparing with other properties */ public SlotPos(int x, int y, Operator operator) { super(new Vector2i(x, y), operator); }
/** * Returns the dimensions. * * @return The size */ public Vector2i getSize() { return new Vector2i(width, height); }
@Override public Vector2i toInt() { return new Vector2i(x, y); }
/** * Create an InventoryDimension property which matches InventoryDimension properties * with equal value. * * @param width x coordinate to match * @param height y coordinate to match * @return new property */ public static InventoryDimension of(int width, int height) { return new InventoryDimension(new Vector2i(width, height), Operator.EQUAL); }
@Override public Vector2i pow(int power) { return new Vector2i(Math.pow(x, power), Math.pow(y, power)); }
public static Vector2i deserialize2i(JsonElement element) { return new Vector2i( element.getAsJsonObject().get("x").getAsInt(), element.getAsJsonObject().get("y").getAsInt() ); }
public static Vector2i deserialize2i(JsonElement element) { return new Vector2i( element.getAsJsonObject().get("x").getAsInt(), element.getAsJsonObject().get("y").getAsInt() ); }
/** * Sets the window size. * * @param windowSize The window size */ public abstract void setWindowSize(Vector2i windowSize);
public Vector2i project(int x, int y) { final int lengthSquared = x * x + y * y; if (lengthSquared == 0) { throw new ArithmeticException("Cannot project onto the zero vector"); } final float a = (float) dot(x, y) / lengthSquared; return new Vector2i(a * x, a * y); }