From 88d47ef4d55d4cb25131dc4cacdde226819b0a90 Mon Sep 17 00:00:00 2001 From: DBotThePony <dbotthepony@yandex.ru> Date: Sun, 30 Mar 2025 16:39:08 +0700 Subject: [PATCH] Remove enum.next/prev --- .../{EntityDistance.kt => EntityUtils.kt} | 0 .../ru/dbotthepony/mc/otm/util/Utils.kt | 32 ------------------- 2 files changed, 32 deletions(-) rename src/main/kotlin/ru/dbotthepony/mc/otm/util/{EntityDistance.kt => EntityUtils.kt} (100%) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/util/EntityDistance.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/util/EntityUtils.kt similarity index 100% rename from src/main/kotlin/ru/dbotthepony/mc/otm/util/EntityDistance.kt rename to src/main/kotlin/ru/dbotthepony/mc/otm/util/EntityUtils.kt diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/util/Utils.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/util/Utils.kt index f22b25271..30d7cb1f0 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/util/Utils.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/util/Utils.kt @@ -155,38 +155,6 @@ inline var Entity.position: Vec3 get() = position() set(value) { setPos(value) } -inline val <reified T : Enum<T>> T.next: T get() { - val values = enumValues<T>() - val next = (ordinal + 1) % values.size - return values[next] -} - -inline val <reified T : Enum<T>> T.prev: T get() { - val values = enumValues<T>() - var next = ordinal - 1 - - if (next < 0) { - next = values.size - 1 - } - - return values[next] -} - -fun <T : Enum<T>> T.next(values: Array<out T>): T { - val next = (ordinal + 1) % values.size - return values[next] -} - -fun <T : Enum<T>> T.prev(values: Array<out T>): T { - var next = ordinal - 1 - - if (next < 0) { - next = values.size - 1 - } - - return values[next] -} - inline fun <T : Any> immutableList(size: Int, initializer: (index: Int) -> T): ImmutableList<T> { require(size >= 0) { "Invalid list size $size" }