Record Class ScreenArea
java.lang.Object
java.lang.Record
com.pixelmonmod.api.client.screen.util.ScreenArea
- Record Components:
x- the left edge of the areay- the top edge of the areawidth- the width of the areaheight- the height of the area
Immutable rectangular area in GUI screen coordinates.
-
Constructor Summary
ConstructorsConstructorDescriptionScreenArea(int x, int y, int width, int height) Creates an instance of aScreenArearecord class. -
Method Summary
Modifier and TypeMethodDescriptionintbottom()Gets the bottom edge of this area.booleancontains(double x, double y) Checks whether the given screen coordinate is inside this area.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intheight()Returns the value of theheightrecord component.intright()Gets the right edge of this area.final StringtoString()Returns a string representation of this record class.intwidth()Returns the value of thewidthrecord component.intx()Returns the value of thexrecord component.intx(float relative) Gets an x coordinate relative to this area's width.inty()Returns the value of theyrecord component.inty(float relative) Gets a y coordinate relative to this area's height.
-
Constructor Details
-
ScreenArea
public ScreenArea(int x, int y, int width, int height) Creates an instance of aScreenArearecord class.
-
-
Method Details
-
x
public int x(float relative) Gets an x coordinate relative to this area's width.- Parameters:
relative- the horizontal position from0.0Fat the left edge to1.0Fat the right edge- Returns:
- the absolute screen x coordinate
-
y
public int y(float relative) Gets a y coordinate relative to this area's height.- Parameters:
relative- the vertical position from0.0Fat the top edge to1.0Fat the bottom edge- Returns:
- the absolute screen y coordinate
-
right
public int right()Gets the right edge of this area.- Returns:
- the absolute x coordinate immediately after this area's width
-
bottom
public int bottom()Gets the bottom edge of this area.- Returns:
- the absolute y coordinate immediately after this area's height
-
contains
public boolean contains(double x, double y) Checks whether the given screen coordinate is inside this area.- Parameters:
x- the absolute screen x coordinatey- the absolute screen y coordinate- Returns:
trueif the coordinate is inside or on this area's edges
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
x
public int x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
public int y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-
width
public int width()Returns the value of thewidthrecord component.- Returns:
- the value of the
widthrecord component
-
height
public int height()Returns the value of theheightrecord component.- Returns:
- the value of the
heightrecord component
-