From 37cd1600ab03eec6ca48635eaa3926522d330c40 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sat, 5 Oct 2024 10:36:15 +0700 Subject: [PATCH] Stateful dont have to inherit nullable tag types --- .../ru/dbotthepony/mc/otm/core/util/Savetables.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/core/util/Savetables.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/core/util/Savetables.kt index caa118d04..c8e474cf8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/core/util/Savetables.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/core/util/Savetables.kt @@ -41,38 +41,38 @@ class Savetables : INBTSerializable { fun validate() } - inline fun , reified T : Tag> stateful(getter: Supplier, name: String): Stateful { + inline fun , reified T : Tag> stateful(getter: Supplier, name: String): Stateful { return stateful(getter, name, T::class.java) } - inline fun , reified T : Tag> stateful(getter: V, name: String): Stateful { + inline fun , reified T : Tag> stateful(getter: V, name: String): Stateful { return stateful(getter, name, T::class.java) } - inline fun , reified T : Tag> stateful(getter: KProperty0, name: String = getter.name): Stateful { + inline fun , reified T : Tag> stateful(getter: KProperty0, name: String = getter.name): Stateful { return stateful(getter, name, T::class.java) } - inline fun , reified T : Tag> stateful(values: Collection, name: String): ImmutableList> { + inline fun , reified T : Tag> stateful(values: Collection, name: String): ImmutableList> { val iterator = values.iterator() return immutableList(values.size) { stateful(iterator.next(), "${name}_$it", T::class.java) } } - fun , T : Tag> stateful(getter: Supplier, name: String, type: Class): Stateful { + fun , T : Tag> stateful(getter: Supplier, name: String, type: Class): Stateful { return Stateful(getter, name, type) .withSerializer { it, l -> it.serializeNBT(l) } .withDeserializer { v, t, l -> v.deserializeNBT(l, t) } } - fun , T : Tag> stateful(getter: V, name: String, type: Class): Stateful { + fun , T : Tag> stateful(getter: V, name: String, type: Class): Stateful { return Stateful({ getter }, name, type) .withSerializer { it, l -> it.serializeNBT(l) } .withDeserializer { v, t, l -> v.deserializeNBT(l, t) } } - fun , T : Tag> stateful(getter: KProperty0, name: String = getter.name, type: Class): Stateful { + fun , T : Tag> stateful(getter: KProperty0, name: String = getter.name, type: Class): Stateful { return Stateful(getter, name, type) .withSerializer { it, l -> it.serializeNBT(l) } .withDeserializer { v, t, l -> v.deserializeNBT(l, t) }