fix: registry bootstrap
This commit is contained in:
parent
7cd6fb11a7
commit
5e3df22a10
@ -36,6 +36,7 @@ object Quaedam {
|
||||
|
||||
fun init() {
|
||||
Projector
|
||||
ProjectionEffectType
|
||||
SkylightProjection
|
||||
SwarmProjection
|
||||
|
||||
|
@ -9,7 +9,6 @@ import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.server.level.ServerLevel
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.block.state.BlockState
|
||||
import quaedam.projection.swarm.SwarmProjection
|
||||
|
||||
abstract class ProjectionEffect {
|
||||
|
||||
@ -39,14 +38,22 @@ data class ProjectionEffectType<T : ProjectionEffect>(val constructor: () -> T)
|
||||
|
||||
val registryKey: ResourceKey<Registry<ProjectionEffectType<*>>> =
|
||||
ResourceKey.createRegistryKey(ResourceLocation("quaedam", "projection_effect"))
|
||||
val registry: Registry<ProjectionEffectType<*>> = BuiltInRegistries.registerSimple(registryKey) {
|
||||
SwarmProjection.effect.get()
|
||||
}
|
||||
val registry: Registry<ProjectionEffectType<*>> = BuiltInRegistries.registerSimple(registryKey) { null }
|
||||
|
||||
val nopEffect: ProjectionEffectType<NopEffect> =
|
||||
Registry.register(registry, ResourceLocation("quaedam", "nop"), ProjectionEffectType { NopEffect })
|
||||
|
||||
}
|
||||
|
||||
val id: ResourceLocation by lazy { registry.getResourceKey(this).get().location() }
|
||||
|
||||
// To hide the "unable to bootstrap quaedam:projection_effect" error log
|
||||
object NopEffect : ProjectionEffect() {
|
||||
override val type get() = nopEffect
|
||||
override fun toNbt(tag: CompoundTag) {}
|
||||
override fun fromNbt(tag: CompoundTag) {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface ProjectionProvider<P : ProjectionEffect> {
|
||||
|
Loading…
Reference in New Issue
Block a user