Datensatzklasse CuboidBounds
java.lang.Object
java.lang.Record
de.delinkedde.areashopreborn.domain.CuboidBounds
- Datensatzkomponenten:
minX- minimum X coordinateminY- minimum Y coordinateminZ- minimum Z coordinatemaxX- maximum X coordinatemaxY- maximum Y coordinatemaxZ- maximum Z coordinate
public record CuboidBounds(int minX, int minY, int minZ, int maxX, int maxY, int maxZ)
extends Record
Immutable inclusive block coordinates of an axis-aligned cuboid.
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungCuboidBounds(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) Validates that the supplied bounds are normalized. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungbooleancontains(int x, int y, int z) Checks whether an exact block position lies inside this inclusive cuboid.booleancontains(CuboidBounds other) Tests whether another cuboid is fully contained in this cuboid.final booleanGibt an, ob ein anderes Objekt diesem gleich ("equal to") ist.final inthashCode()Gibt einen Hashcodewert für diese Objekt zurück.intheight()Calculates the Y-axis size.intlength()Calculates the Z-axis size.intmaxX()Gibt den Wert für die DatensatzkomponentemaxXzurück.intmaxY()Gibt den Wert für die DatensatzkomponentemaxYzurück.intmaxZ()Gibt den Wert für die DatensatzkomponentemaxZzurück.intminX()Gibt den Wert für die DatensatzkomponenteminXzurück.intminY()Gibt den Wert für die DatensatzkomponenteminYzurück.intminZ()Gibt den Wert für die DatensatzkomponenteminZzurück.static CuboidBoundsnormalized(int x1, int y1, int z1, int x2, int y2, int z2) Creates normalized bounds from two arbitrary corners.booleanoverlaps(CuboidBounds other) Tests whether this cuboid shares at least one block with another cuboid.final StringtoString()Gibt eine Zeichenfolgendarstellung dieser Datensatzklasse zurück.longvolume()Calculates the cuboid volume.intwidth()Calculates the X-axis size.
-
Konstruktordetails
-
CuboidBounds
public CuboidBounds(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) Validates that the supplied bounds are normalized.- Löst aus:
IllegalArgumentException- when any minimum exceeds its maximum
-
-
Methodendetails
-
normalized
Creates normalized bounds from two arbitrary corners.- Parameter:
x1- first X coordinatey1- first Y coordinatez1- first Z coordinatex2- second X coordinatey2- second Y coordinatez2- second Z coordinate- Gibt zurück:
- bounds whose minimum coordinates never exceed their maximum coordinates
-
volume
public long volume()Calculates the cuboid volume.- Gibt zurück:
- inclusive cuboid volume in blocks
-
width
public int width()Calculates the X-axis size.- Gibt zurück:
- inclusive width on the X axis
-
height
public int height()Calculates the Y-axis size.- Gibt zurück:
- inclusive height on the Y axis
-
length
public int length()Calculates the Z-axis size.- Gibt zurück:
- inclusive length on the Z axis
-
contains
Tests whether another cuboid is fully contained in this cuboid.- Parameter:
other- candidate child cuboid- Gibt zurück:
truewhen all coordinates are contained
-
contains
public boolean contains(int x, int y, int z) Checks whether an exact block position lies inside this inclusive cuboid.- Parameter:
x- block X coordinatey- block Y coordinatez- block Z coordinate- Gibt zurück:
truewhen all coordinates are within the inclusive bounds
-
overlaps
Tests whether this cuboid shares at least one block with another cuboid.- Parameter:
other- cuboid to test- Gibt zurück:
truewhen the cuboids overlap
-
toString
Gibt eine Zeichenfolgendarstellung dieser Datensatzklasse zurück. Die Darstellung enthält den Namen der Klasse, gefolgt vom Namen und Wert jeder der Datensatzkomponenten. -
hashCode
public final int hashCode()Gibt einen Hashcodewert für diese Objekt zurück. Der Wert wird vom Hashcode jeder der Datensatzkomponenten abgeleitet. -
equals
Gibt an, ob ein anderes Objekt diesem gleich ("equal to") ist. Die Objekte sind gleich, wenn das andere Objekt der gleichen Klasse angehört und alle Datensatzkomponenten gleich sind. Alle Komponenten in dieser Datensatzklasse werden verglichen mit "==". -
minX
public int minX()Gibt den Wert für die DatensatzkomponenteminXzurück.- Gibt zurück:
- Wert der Datensatzkomponente
minX
-
minY
public int minY()Gibt den Wert für die DatensatzkomponenteminYzurück.- Gibt zurück:
- Wert der Datensatzkomponente
minY
-
minZ
public int minZ()Gibt den Wert für die DatensatzkomponenteminZzurück.- Gibt zurück:
- Wert der Datensatzkomponente
minZ
-
maxX
public int maxX()Gibt den Wert für die DatensatzkomponentemaxXzurück.- Gibt zurück:
- Wert der Datensatzkomponente
maxX
-
maxY
public int maxY()Gibt den Wert für die DatensatzkomponentemaxYzurück.- Gibt zurück:
- Wert der Datensatzkomponente
maxY
-
maxZ
public int maxZ()Gibt den Wert für die DatensatzkomponentemaxZzurück.- Gibt zurück:
- Wert der Datensatzkomponente
maxZ
-