DeferredRegistry with custom registry broken
Lucraft opened this issue ยท 3 comments
After the update for registries working with the new Forge version, it seems like they broke when using DeferredRegistries:
Class with registry: https://github.com/ThreeTAG/Palladium/blob/registry-test/common/src/main/java/net/threetag/palladium/power/ability/Ability.java
Class with DeferredRegistry: https://github.com/ThreeTAG/Palladium/blob/registry-test/common/src/main/java/net/threetag/palladium/power/ability/Abilities.java
Crash:
[19:35:02] [modloading-worker-0/ERROR] (FMLModContainer) Failed to create mod instance. ModID: palladium, class net.threetag.palladium.forge.PalladiumForge
java.lang.reflect.InvocationTargetException: null
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?]
at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
at java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[?:?]
at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:67) ~[javafmllanguage-1.18.2-40.1.16.jar%2367!/:?]
at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:106) ~[fmlcore-1.18.2-40.1.16.jar%2369!/:?]
at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) [?:?]
at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) [?:?]
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) [?:?]
at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) [?:?]
at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) [?:?]
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) [?:?]
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) [?:?]
Caused by: java.lang.IllegalArgumentException: Registry ResourceKey[minecraft:root / palladium:abilities] does not exist!
at dev.architectury.registry.registries.forge.RegistriesImpl$RegistryProviderImpl.get(RegistriesImpl.java:174) ~[B4d7179d8802a-B4d7179d8802a.jar%2372!/:?]
at dev.architectury.registry.registries.Registries.get(Registries.java:51) ~[B4d7179d8802a-B4d7179d8802a.jar%2372!/:?]
at dev.architectury.registry.registries.DeferredRegister.getRegistrar(DeferredRegister.java:90) ~[B4d7179d8802a-B4d7179d8802a.jar%2372!/:?]
at dev.architectury.registry.registries.DeferredRegister.register(DeferredRegister.java:74) ~[B4d7179d8802a-B4d7179d8802a.jar%2372!/:?]
at net.threetag.palladium.Palladium.init(Palladium.java:54) ~[4626257422214083838.jar%2379!/:?]
at net.threetag.palladium.forge.PalladiumForge.(PalladiumForge.java:37) ~[%2370!/:?]
... 14 more
Still broken :/
java.lang.reflect.InvocationTargetException: null
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?]
at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
at java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[?:?]
at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:67) ~[javafmllanguage-1.18.2-40.1.16.jar%2367!/:?]
at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:106) ~[fmlcore-1.18.2-40.1.16.jar%2369!/:?]
at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) [?:?]
at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) [?:?]
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) [?:?]
at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) [?:?]
at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) [?:?]
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) [?:?]
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) [?:?]
Caused by: java.lang.ClassCastException: class dev.architectury.registry.registries.forge.RegistriesImpl$DelegatedRegistrar cannot be cast to class net.minecraft.core.Registry (dev.architectury.registry.registries.forge.RegistriesImpl$DelegatedRegistrar is in module [email protected] of loader 'TRANSFORMER' @3057a923; net.minecraft.core.Registry is in module [email protected] of loader 'TRANSFORMER' @3057a923)
at dev.architectury.registry.registries.forge.RegistriesImpl$RegistryProviderImpl.get(RegistriesImpl.java:174) ~[B4bc001a088c1-B4bc001a088c1.jar%2372!/:?]
at dev.architectury.registry.registries.Registries.get(Registries.java:51) ~[B4bc001a088c1-B4bc001a088c1.jar%2372!/:?]
at dev.architectury.registry.registries.DeferredRegister.getRegistrar(DeferredRegister.java:90) ~[B4bc001a088c1-B4bc001a088c1.jar%2372!/:?]
at dev.architectury.registry.registries.DeferredRegister.register(DeferredRegister.java:74) ~[B4bc001a088c1-B4bc001a088c1.jar%2372!/:?]
at net.threetag.palladium.Palladium.init(Palladium.java:53) ~[15302119930366513808.jar%2380!/:?]
at net.threetag.palladium.forge.PalladiumForge.(PalladiumForge.java:37) ~[%2370!/:?]
... 14 more