Interface Rectangle
- All Known Implementing Classes:
Rectangle.Dynamic,Rectangle.Immutable,Rectangle.Mutable
public interface Rectangle
Created by brandon3055 on 14/08/2023
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordstatic final recordShould not be created directlystatic class -
Method Summary
Modifier and TypeMethodDescriptiondefault RectangleReturns a new rectangle, the bounds of which enclose all the input rectangles.default booleancontains(double x, double y) static Rectanglecreate(double x, double y, double width, double height) static RectangleReturns a new rectangle bound to the specified parent's geometry.static Rectanglestatic Rectangledefault doubleReturn the distance the given position is from this rectangle on the specified axis.doubleheight()default RectangleReturns a new rectangle that represents the intersection area between the two inputsdefault booleanintersects(double x, double y, double w, double h) default booleanintersects(Rectangle other) default doubledefault doubledefault Rectangle.Mutablemutable()default RectangleoffsetPos(double xAmount, double yAmount) Returns a new rectangle with this operation applieddefault RectangleoffsetSize(double xAmount, double yAmount) Returns a new rectangle with this operation appliedpos()default RectanglesetPos(double newX, double newY) Returns a new rectangle with this operation applieddefault RectanglesetSize(double width, double height) Returns a new rectangle with this operation applieddefault doubledefault net.minecraft.client.renderer.Rect2itoRect2i()doublewidth()default doublex()default doublexMax()default doubley()default doubleyMax()
-
Method Details
-
pos
Position pos() -
x
default double x() -
y
default double y() -
width
double width() -
height
double height() -
xMax
default double xMax() -
yMax
default double yMax() -
offsetPos
Returns a new rectangle with this operation applied -
setPos
Returns a new rectangle with this operation applied -
setSize
Returns a new rectangle with this operation applied -
offsetSize
Returns a new rectangle with this operation applied -
toRect2i
default net.minecraft.client.renderer.Rect2i toRect2i() -
intersects
default boolean intersects(double x, double y, double w, double h) -
intersects
-
intersect
Returns a new rectangle that represents the intersection area between the two inputs -
combine
Returns a new rectangle, the bounds of which enclose all the input rectangles.- Parameters:
combineWith- Rectangles to combine with the start rectangle
-
contains
default boolean contains(double x, double y) -
size
- Returns:
- the size of this rectangle on the given axis.
-
min
- Returns:
- the min value the specified axis (meaning x() or y())
-
max
- Returns:
- the max value the specified axis (meaning x() + width() or y() + height())
-
distance
Return the distance the given position is from this rectangle on the specified axis. Will return 0 if position is inside this rectangle on the given axis. -
create
-
create
-
create
Returns a new rectangle bound to the specified parent's geometry. -
create
-
mutable
-