remove early access check
since accessing registry itself early throws error now
This commit is contained in:
parent
3f36fb2843
commit
aba3f63311
@ -104,9 +104,6 @@ public final class OverdriveThatMatters {
|
||||
}
|
||||
|
||||
private void setup(final FMLCommonSetupEvent event) {
|
||||
AndroidResearchType.Companion.markRegistryLoaded();
|
||||
AndroidFeatureType.Companion.markRegistryLoaded();
|
||||
|
||||
MatteryNetworking.register();
|
||||
AndroidNetworkChannel.INSTANCE.register();
|
||||
|
||||
|
@ -26,7 +26,6 @@ open class AndroidFeatureType<T : AndroidFeature> {
|
||||
open fun isApplicable(android: AndroidCapability) = true
|
||||
|
||||
val registryName by lazy {
|
||||
check(AndroidResearchType.IS_REGISTRY_INITIALIZED) { "Trying to access registryName too early!" }
|
||||
MRegistry.ANDROID_FEATURES.getKeyNullable(this)
|
||||
}
|
||||
|
||||
@ -41,21 +40,4 @@ open class AndroidFeatureType<T : AndroidFeature> {
|
||||
open val displayId: String by lazy {
|
||||
registryName?.let { "android_feature.${it.namespace}.${it.path}" } ?: "android_feature.null.null"
|
||||
}
|
||||
|
||||
companion object {
|
||||
var IS_REGISTRY_INITIALIZED = false
|
||||
private set
|
||||
|
||||
fun markRegistryLoaded() {
|
||||
IS_REGISTRY_INITIALIZED = true
|
||||
}
|
||||
|
||||
fun assert() {
|
||||
check(IS_REGISTRY_INITIALIZED) { "Registry is not yet initialized" }
|
||||
}
|
||||
|
||||
inline fun assert(lazy: () -> Any) {
|
||||
check(IS_REGISTRY_INITIALIZED, lazy)
|
||||
}
|
||||
}
|
||||
}
|
@ -164,8 +164,6 @@ class AndroidResearchBuilder(
|
||||
val iconText = iconText?.copy()
|
||||
|
||||
val features: List<ResolvedFeature> by lazy {
|
||||
check(AndroidFeatureType.IS_REGISTRY_INITIALIZED) { "Trying to build list too early!" }
|
||||
|
||||
val builder = ImmutableList.builder<ResolvedFeature>()
|
||||
|
||||
for (df in defFeatures) {
|
||||
@ -370,8 +368,6 @@ class AndroidResearchBuilder(
|
||||
get() = description ?: super.displayDescription
|
||||
|
||||
override val prerequisites: List<AndroidResearchType<*>> by lazy {
|
||||
check(IS_REGISTRY_INITIALIZED) { "Trying to build list too early!" }
|
||||
|
||||
val builder = ImmutableList.builder<AndroidResearchType<*>>()
|
||||
|
||||
for ((value, rigid) in prerequisites) {
|
||||
@ -388,8 +384,6 @@ class AndroidResearchBuilder(
|
||||
}
|
||||
|
||||
override val blockedBy: List<AndroidResearchType<*>> by lazy {
|
||||
check(IS_REGISTRY_INITIALIZED) { "Trying to build list too early!" }
|
||||
|
||||
val builder = ImmutableList.builder<AndroidResearchType<*>>()
|
||||
|
||||
for ((value, rigid) in blockers) {
|
||||
|
@ -21,8 +21,6 @@ open class AndroidResearchType<R : AndroidResearch>(
|
||||
open val blockedBy: List<AndroidResearchType<*>> get() = emptyList()
|
||||
|
||||
val blocking: List<AndroidResearchType<*>> by lazy {
|
||||
check(IS_REGISTRY_INITIALIZED) { "Trying to build list too early!" }
|
||||
|
||||
val list = ImmutableList.builder<AndroidResearchType<*>>()
|
||||
|
||||
for (research in MRegistry.ANDROID_RESEARCH) {
|
||||
@ -35,8 +33,6 @@ open class AndroidResearchType<R : AndroidResearch>(
|
||||
}
|
||||
|
||||
val unlocks: List<AndroidResearchType<*>> by lazy {
|
||||
check(IS_REGISTRY_INITIALIZED) { "Trying to build list too early!" }
|
||||
|
||||
val list = ImmutableList.builder<AndroidResearchType<*>>()
|
||||
|
||||
for (research in MRegistry.ANDROID_RESEARCH) {
|
||||
@ -51,7 +47,6 @@ open class AndroidResearchType<R : AndroidResearch>(
|
||||
fun factory(capability: AndroidCapabilityPlayer) = factory.factory(this, capability)
|
||||
|
||||
val registryName by lazy {
|
||||
check(IS_REGISTRY_INITIALIZED) { "Trying to access registryName too early!" }
|
||||
MRegistry.ANDROID_RESEARCH.getKeyNullable(this)
|
||||
}
|
||||
|
||||
@ -75,21 +70,4 @@ open class AndroidResearchType<R : AndroidResearch>(
|
||||
open val displayDescription: List<Component> by lazy {
|
||||
listOf(TranslatableComponent(descriptionId))
|
||||
}
|
||||
|
||||
companion object {
|
||||
var IS_REGISTRY_INITIALIZED = false
|
||||
private set
|
||||
|
||||
fun markRegistryLoaded() {
|
||||
IS_REGISTRY_INITIALIZED = true
|
||||
}
|
||||
|
||||
fun assert() {
|
||||
check(IS_REGISTRY_INITIALIZED) { "Registry is not yet initialized" }
|
||||
}
|
||||
|
||||
inline fun assert(lazy: () -> Any) {
|
||||
check(IS_REGISTRY_INITIALIZED, lazy)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user