Pos2d

@Serializable
@SerialName(value = "pos2d")
data class Pos2d(val x: Double, val z: Double) : Pos2DimensionalConvertible<Double, Pos3d, Pos2d> (source)

A simple class representing a pair of x and z (being 2-dimensional double coordinates). As y would be the height in Minecraft, this two-dimensional class does not contain a y value.

Constructors

Link copied to clipboard
constructor(x: Double, z: Double)

Properties

Link copied to clipboard
open override val x: Double

Horizontal x-coordinate, equivalent of x in a Minecraft world.

Link copied to clipboard
open override val z: Double

Horizontal z-coordinate, equivalent of z in a Minecraft world. In general maths this would be the y coordinate on a regular 2d plane.

Functions

Link copied to clipboard
open override fun atY(y: Double): Pos3d

Keeps the x and z coordinate, but puts this position into 3-dimensional space (Pos3Dimensional) at the given height y.

Link copied to clipboard
open fun toBlockPos(y: Double): BlockPos
Link copied to clipboard
open fun toMcVec2(): Vec2
Link copied to clipboard
open fun toPair(): Pair<Double, Double>

Converts this position to a basic Kotlin Pair of x and z.