Record Class PointRange2D
java.lang.Object
java.lang.Record
dev.wyck.misc.PointRange2D
@NullMarked
@AsOf("0.0.1")
public record PointRange2D(int minX, int maxX, int minZ, int maxZ)
extends Record
Represents a 2D range of points in a Minecraft world.
The range is defined by minimum and maximum X and Z coordinates.
- Since:
- 0.0.1
-
Constructor Summary
ConstructorsConstructorDescriptionPointRange2D(int minX, int maxX, int minZ, int maxZ) Creates an instance of aPointRange2Drecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.getMaxLocation(World world) Returns the maximum location within the range.getMinLocation(World world) Returns the minimum location within the range.final inthashCode()Returns a hash code value for this object.intmaxX()Returns the value of themaxXrecord component.intmaxZ()Returns the value of themaxZrecord component.intminX()Returns the value of theminXrecord component.intminZ()Returns the value of theminZrecord component.static PointRange2DCreates a new PointRange2D from two given locations.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PointRange2D
public PointRange2D(int minX, int maxX, int minZ, int maxZ) Creates an instance of aPointRange2Drecord class.- Parameters:
minX- the value for theminXrecord componentmaxX- the value for themaxXrecord componentminZ- the value for theminZrecord componentmaxZ- the value for themaxZrecord component
-
-
Method Details
-
of
Creates a new PointRange2D from two given locations. The minimum and maximum X and Z coordinates are calculated from the given locations.- Parameters:
from- The first location.to- The second location.- Returns:
- A new PointRange2D that spans from the minimum to the maximum coordinates of the given locations.
- Since:
- 0.0.1
-
getMinLocation
Returns the minimum location within the range. The minimum location is defined by the minimum X and Z coordinates. The Y coordinate is always 0.- Parameters:
world- The world in which the location is.- Returns:
- The minimum location within the range.
- Since:
- 0.0.2
-
getMaxLocation
Returns the maximum location within the range. The maximum location is defined by the maximum X and Z coordinates. The Y coordinate is always 0.- Parameters:
world- The world in which the location is.- Returns:
- The maximum location within the range.
- Since:
- 0.0.2
-
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
minX
public int minX()Returns the value of theminXrecord component.- Returns:
- the value of the
minXrecord component
-
maxX
public int maxX()Returns the value of themaxXrecord component.- Returns:
- the value of the
maxXrecord component
-
minZ
public int minZ()Returns the value of theminZrecord component.- Returns:
- the value of the
minZrecord component
-
maxZ
public int maxZ()Returns the value of themaxZrecord component.- Returns:
- the value of the
maxZrecord component
-