From 9e1ae327ea4613a42e8cd092a6312ee6e23d5f6a Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Thu, 3 Apr 2025 15:36:19 +0700 Subject: [PATCH] Add RelativeSide#defaultOf --- .../mc/otm/util/math/BlockRotation.kt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/util/math/BlockRotation.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/util/math/BlockRotation.kt index 216c46405..ba2eecd3d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/util/math/BlockRotation.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/util/math/BlockRotation.kt @@ -20,7 +20,21 @@ operator fun BlockPos.plus(other: BlockRotation): BlockPos { } enum class RelativeSide(val default: Direction) { - FRONT(Direction.NORTH), BACK(Direction.SOUTH), LEFT(Direction.WEST), RIGHT(Direction.EAST), TOP(Direction.UP), BOTTOM(Direction.DOWN) + FRONT(Direction.NORTH), BACK(Direction.SOUTH), LEFT(Direction.WEST), RIGHT(Direction.EAST), TOP(Direction.UP), BOTTOM(Direction.DOWN); + + companion object { + @JvmStatic + fun defaultOf(direction: Direction): RelativeSide { + return when (direction) { + Direction.DOWN -> BOTTOM + Direction.UP -> TOP + Direction.NORTH -> FRONT + Direction.SOUTH -> BACK + Direction.WEST -> LEFT + Direction.EAST -> RIGHT + } + } + } } /**