Record Class BlockPos
java.lang.Object
java.lang.Record
fr.fidorial.world.BlockPos
- Record Components:
x- the block X coordinatey- the block Y coordinatez- the block Z coordinate
The integer coordinates of a block, independent of any world.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionBlockPos(int x, int y, int z) Creates an instance of aBlockPosrecord class. -
Method Summary
Modifier and TypeMethodDescriptionchunk()Returns the position of the chunk holding this block.intchunkX()Returns the X coordinate of the chunk holding this block.intchunkZ()Returns the Z coordinate of the chunk holding this block.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intlocalX()Returns the X coordinate of this block inside its chunk,0to15.intlocalZ()Returns the Z coordinate of this block inside its chunk,0to15.offset(int dx, int dy, int dz) Returns this position moved by the given amounts.Returns the position of the neighbouring block on the given side.final StringtoString()Returns a string representation of this record class.intx()Returns the value of thexrecord component.inty()Returns the value of theyrecord component.intz()Returns the value of thezrecord component.
-
Constructor Details
-
BlockPos
-
-
Method Details
-
relative
-
offset
Returns this position moved by the given amounts.- Parameters:
dx- the offset on the X axisdy- the offset on the Y axisdz- the offset on the Z axis- Returns:
- this position moved by the given amounts
- Since:
- 0.1.0
-
chunkX
public int chunkX()Returns the X coordinate of the chunk holding this block.- Returns:
- the X coordinate of the chunk holding this block
- Since:
- 0.1.0
-
chunkZ
public int chunkZ()Returns the Z coordinate of the chunk holding this block.- Returns:
- the Z coordinate of the chunk holding this block
- Since:
- 0.1.0
-
localX
public int localX()Returns the X coordinate of this block inside its chunk,0to15.- Returns:
- the X coordinate of this block inside its chunk,
0to15 - Since:
- 0.1.0
-
localZ
public int localZ()Returns the Z coordinate of this block inside its chunk,0to15.- Returns:
- the Z coordinate of this block inside its chunk,
0to15 - Since:
- 0.1.0
-
chunk
Returns the position of the chunk holding this block.- Returns:
- the position of the chunk holding this block
- Since:
- 0.1.0
-
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. -
x
-
y
-
z
-