aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/features/texturepack/TintOverrides.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-11-03 01:24:24 +0100
committerLinnea Gräf <nea@nea.moe>2024-11-09 01:01:18 +0100
commit22f0cc59a2d3bc7900764e3916c670075ff9d35e (patch)
treeb503ff607cf818a539cbbaa403f6851ef979e03d /src/main/kotlin/features/texturepack/TintOverrides.kt
parent646843ba3b960ac48f9866b3640438d3cc1dafc4 (diff)
downloadFirmament-22f0cc59a2d3bc7900764e3916c670075ff9d35e.tar.gz
Firmament-22f0cc59a2d3bc7900764e3916c670075ff9d35e.tar.bz2
Firmament-22f0cc59a2d3bc7900764e3916c670075ff9d35e.zip
1.21.3 WIP
Diffstat (limited to 'src/main/kotlin/features/texturepack/TintOverrides.kt')
-rw-r--r--src/main/kotlin/features/texturepack/TintOverrides.kt18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/main/kotlin/features/texturepack/TintOverrides.kt b/src/main/kotlin/features/texturepack/TintOverrides.kt
index 8006db8..85fcae4 100644
--- a/src/main/kotlin/features/texturepack/TintOverrides.kt
+++ b/src/main/kotlin/features/texturepack/TintOverrides.kt
@@ -3,7 +3,6 @@ package moe.nea.firmament.features.texturepack
import com.google.gson.JsonObject
import com.google.gson.JsonPrimitive
import moe.nea.firmament.util.ErrorUtil
-import moe.nea.firmament.util.assertNotNullOr
data class TintOverrides(
val layerMap: Map<Int, TintOverride> = mapOf()
@@ -14,21 +13,22 @@ data class TintOverrides(
val EMPTY = TintOverrides()
private val threadLocal = object : ThreadLocal<TintOverrides>() {}
fun enter(overrides: TintOverrides?) {
- ErrorUtil.softCheck("Double entered tintOverrides") {
- threadLocal.get() == null
- }
+ ErrorUtil.softCheck("Double entered tintOverrides",
+ threadLocal.get() == null)
threadLocal.set(overrides ?: EMPTY)
}
fun exit(overrides: TintOverrides?) {
- ErrorUtil.softCheck("Exited with non matching enter tintOverrides") {
- threadLocal.get() == (overrides ?: EMPTY)
- }
+ ErrorUtil.softCheck("Exited with non matching enter tintOverrides",
+ threadLocal.get() == (overrides ?: EMPTY))
threadLocal.remove()
}
- fun getCurrentOverrides() =
- assertNotNullOr(threadLocal.get(), "Got current tintOverrides without entering") { EMPTY }
+ fun getCurrentOverrides(): TintOverrides {
+ return ErrorUtil.notNullOr(threadLocal.get(), "Got current tintOverrides without entering") {
+ EMPTY
+ }
+ }
fun parse(jsonObject: JsonObject): TintOverrides {
val map = mutableMapOf<Int, TintOverride>()