feat: block coordinates
This commit is contained in:
parent
3835c9b9e2
commit
66e1f74b5c
|
|
@ -84,3 +84,12 @@ class EntityArgument : KommandArgument<List<Entity>> {
|
|||
class CoordinatesArgument : KommandArgument<io.papermc.paper.math.Position> {
|
||||
override fun build(): ArgumentType<*> = ArgumentTypes.finePosition()
|
||||
}
|
||||
|
||||
/**
|
||||
* Block position argument for integer coordinates.
|
||||
* Supports relative coordinates like ~ ~1 ~-2.
|
||||
* Returns a Position (io.papermc.paper.math.Position) after resolving (aligned to block).
|
||||
*/
|
||||
class BlockPositionArgument : KommandArgument<io.papermc.paper.math.Position> {
|
||||
override fun build(): ArgumentType<*> = ArgumentTypes.blockPosition()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,6 +173,12 @@ abstract class BranchScope internal constructor(
|
|||
allowRelative: Boolean = true,
|
||||
block: ValueBuilder<io.papermc.paper.math.Position>.() -> Unit = {}
|
||||
) = argument(name, CoordinatesArgument(), block)
|
||||
|
||||
fun blockCoordinates(
|
||||
name: String,
|
||||
allowRelative: Boolean = true,
|
||||
block: ValueBuilder<io.papermc.paper.math.Position>.() -> Unit = {}
|
||||
) = argument(name, BlockPositionArgument(), block)
|
||||
}
|
||||
|
||||
@KommandDsl
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user