diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/RegistryDelegate.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/RegistryDelegate.kt index 1ff883edc..1451ff26e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/RegistryDelegate.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/RegistryDelegate.kt @@ -12,13 +12,13 @@ import java.util.function.Supplier import kotlin.properties.ReadOnlyProperty import kotlin.reflect.KProperty -class RegistryDelegate(key: String) : ReadOnlyProperty> { +class RegistryDelegate(key: String) : ReadOnlyProperty>, Supplier> { private var value: Supplier?>? = null val location = ResourceLocation(OverdriveThatMatters.MOD_ID, key) val key: ResourceKey> = ResourceKey.createRegistryKey(location) - fun get(): ForgeRegistry { + override fun get(): ForgeRegistry { val supp = value ?: throw IllegalStateException("Tried to access uninitialized registry $location") return supp.get() as ForgeRegistry? ?: throw IllegalStateException("Accessing registry $location too early") }