Jump to content

Recommended Posts

Posted (edited)

This problem is pretty strange, the code works properly, the item can be registered.

public static final RegistryObject<Item> MIND_CRYSTAL = ITEMS.register(NameUtil.fromClass(ItemMindCrystal.class, "Item"), ItemMindCrystal::new);

But the following code throws an error.

    public static final RegistryObject<Item> MIND_CRYSTAL = registerItem(ItemMindCrystal::new);

    public static <T extends Item> RegistryObject<Item> registerItem(Supplier<T> itemSupplier){
        return registerItem(itemSupplier, NameUtil.fromClass(itemSupplier.get(), "Item"));
    }

    private static <T extends Item> RegistryObject<Item> registerItem(Supplier<T> itemSupplier, String name){
        return ITEMS.register(name, itemSupplier);
    }

The NameUtil is used to automatically generate registered names.

Why? What's the problem.

And, is there any other way to do it? I want to register my mod object by just type in one parameter, rather than type in NameUtli repeatedly every time I register my mod Object.

Sorry for my poor English, I have ask this question on discord, but receive no answer I need.

Edited by LYXHAHA1
Posted

and the crash log is here

[08Sep2022 08:09:15.885] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--launchTarget, forgeclientuserdev, --version, MOD_DEV, --assetIndex, 1.19, --assetsDir, C:\Users\LYXHAHA\.gradle\caches\forge_gradle\assets, --gameDir, ., --fml.forgeVersion, 43.1.1, --fml.mcVersion, 1.19.2, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20220805.130853]
[08Sep2022 08:09:15.912] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.8+10.0.8+main.0ef7e830 starting: java version 17.0.3 by Eclipse Adoptium; OS Windows 10 arch amd64 version 10.0
[08Sep2022 08:09:16.090] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/C:/Users/LYXHAHA/.gradle/caches/modules-2/files-2.1/org.spongepowered/mixin/0.8.5/9d1c0c3a304ae6697ecd477218fa61b850bf57fc/mixin-0.8.5.jar%23120!/ Service=ModLauncher Env=CLIENT
[08Sep2022 08:09:16.482] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\LYXHAHA\.gradle\caches\modules-2\files-2.1\net.minecraftforge\javafmllanguage\1.19.2-43.1.1\4ed0d46c3cd0883da364ee1aace4f012ab07f408\javafmllanguage-1.19.2-43.1.1.jar is missing mods.toml file
[08Sep2022 08:09:16.485] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\LYXHAHA\.gradle\caches\modules-2\files-2.1\net.minecraftforge\lowcodelanguage\1.19.2-43.1.1\f185fdcfb9aa2db13cb366d80f6902bb29b10437\lowcodelanguage-1.19.2-43.1.1.jar is missing mods.toml file
[08Sep2022 08:09:16.489] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\LYXHAHA\.gradle\caches\modules-2\files-2.1\net.minecraftforge\mclanguage\1.19.2-43.1.1\5c1fbe775a983c4f8bdba7b491644b50b619f11d\mclanguage-1.19.2-43.1.1.jar is missing mods.toml file
[08Sep2022 08:09:16.492] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\LYXHAHA\.gradle\caches\modules-2\files-2.1\net.minecraftforge\fmlcore\1.19.2-43.1.1\4108eba77f38a55539813fecb638eeccf7fd6314\fmlcore-1.19.2-43.1.1.jar is missing mods.toml file
[08Sep2022 08:09:16.622] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.JarInJarDependencyLocator/]: No dependencies to load found. Skipping!
[08Sep2022 08:09:18.094] [main/INFO] [mixin/]: Compatibility level set to JAVA_17
[08Sep2022 08:09:18.096] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'forgeclientuserdev' with arguments [--version, MOD_DEV, --gameDir, ., --assetsDir, C:\Users\LYXHAHA\.gradle\caches\forge_gradle\assets, --assetIndex, 1.19]
[08Sep2022 08:09:18.453] [main/INFO] [mixin/]: Remapping refMap patchouli.refmap.json using C:\Users\LYXHAHA\IdeaProjects\SaintChapter/build/createSrgToMcp/output.srg
[08Sep2022 08:09:22.133] [pool-3-thread-1/INFO] [net.minecraft.util.datafix.DataFixers/]: Building unoptimized datafixer
[08Sep2022 08:09:23.998] [Render thread/WARN] [net.minecraft.server.packs.VanillaPackResources/]: Assets URL 'union:/C:/Users/LYXHAHA/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.19.2-43.1.1_mapped_parchment_2022.09.04-1.19.2/forge-1.19.2-43.1.1_mapped_parchment_2022.09.04-1.19.2-recomp.jar%23183!/assets/.mcassetsroot' uses unexpected schema
[08Sep2022 08:09:23.998] [Render thread/WARN] [net.minecraft.server.packs.VanillaPackResources/]: Assets URL 'union:/C:/Users/LYXHAHA/.gradle/caches/forge_gradle/minecraft_user_repo/net/minecraftforge/forge/1.19.2-43.1.1_mapped_parchment_2022.09.04-1.19.2/forge-1.19.2-43.1.1_mapped_parchment_2022.09.04-1.19.2-recomp.jar%23183!/data/.mcassetsroot' uses unexpected schema
[08Sep2022 08:09:24.036] [Render thread/INFO] [com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService/]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[08Sep2022 08:09:24.042] [Render thread/INFO] [net.minecraft.client.Minecraft/]: Setting user: Dev
[08Sep2022 08:09:24.222] [Render thread/INFO] [net.minecraft.client.Minecraft/]: Backend library: LWJGL version 3.3.1 build 7
[08Sep2022 08:09:25.015] [modloading-worker-0/INFO] [net.minecraftforge.common.ForgeMod/FORGEMOD]: Forge mod loading, version 43.1.1, for MC 1.19.2 with MCP 20220805.130853
[08Sep2022 08:09:25.018] [modloading-worker-0/INFO] [net.minecraftforge.common.MinecraftForge/FORGE]: MinecraftForge v43.1.1 Initialized
[08Sep2022 08:09:25.097] [modloading-worker-0/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/LOADING]: Failed to create mod instance. ModID: saintchapter, class net.writingwithfire.saintchapter.SaintChapter
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:68) ~[javafmllanguage-1.19.2-43.1.1.jar%23184!/:?]
	at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$10(ModContainer.java:121) ~[fmlcore-1.19.2-43.1.1.jar%23187!/:?]
	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.ExceptionInInitializerError
	at net.writingwithfire.saintchapter.common.registry.RegisterEventHandler.attachEventHandlers(RegisterEventHandler.java:24) ~[%23188!/:?]
	at net.writingwithfire.saintchapter.common.CommonProxy.attachLifecycle(CommonProxy.java:36) ~[%23188!/:?]
	at net.writingwithfire.saintchapter.client.ClientProxy.attachLifecycle(ClientProxy.java:21) ~[%23188!/:?]
	at net.writingwithfire.saintchapter.SaintChapter.<init>(SaintChapter.java:30) ~[%23188!/:?]
	... 14 more
Caused by: java.lang.IllegalStateException: Registry is already frozen
	at net.minecraftforge.registries.NamespacedHolderHelper.createIntrusiveHolder(NamespacedHolderHelper.java:192) ~[forge-1.19.2-43.1.1_mapped_parchment_2022.09.04-1.19.2-recomp.jar%23182%23189!/:?]
	at net.minecraftforge.registries.NamespacedDefaultedWrapper.createIntrusiveHolder(NamespacedDefaultedWrapper.java:210) ~[forge-1.19.2-43.1.1_mapped_parchment_2022.09.04-1.19.2-recomp.jar%23182%23189!/:?]
	at net.minecraft.world.item.Item.<init>(Item.java:57) ~[forge-1.19.2-43.1.1_mapped_parchment_2022.09.04-1.19.2-recomp.jar%23183!/:?]
	at net.writingwithfire.saintchapter.common.item.base.SCCustomItem.<init>(SCCustomItem.java:7) ~[%23188!/:?]
	at net.writingwithfire.saintchapter.common.item.ItemMindCrystal.<init>(ItemMindCrystal.java:8) ~[%23188!/:?]
	at net.writingwithfire.saintchapter.common.registry.RegistryItems.<clinit>(RegistryItems.java:42) ~[%23188!/:?]
	at net.writingwithfire.saintchapter.common.registry.RegisterEventHandler.attachEventHandlers(RegisterEventHandler.java:24) ~[%23188!/:?]
	at net.writingwithfire.saintchapter.common.CommonProxy.attachLifecycle(CommonProxy.java:36) ~[%23188!/:?]
	at net.writingwithfire.saintchapter.client.ClientProxy.attachLifecycle(ClientProxy.java:21) ~[%23188!/:?]
	at net.writingwithfire.saintchapter.SaintChapter.<init>(SaintChapter.java:30) ~[%23188!/:?]
	... 14 more
[08Sep2022 08:09:25.287] [Render thread/FATAL] [net.minecraftforge.fml.ModLoader/LOADING]: Failed to complete lifecycle event CONSTRUCT, 1 errors found
[08Sep2022 08:09:25.454] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.sound.SoundEngineLoadEvent to a broken mod state
[08Sep2022 08:09:25.686] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RegisterColorHandlersEvent$Block to a broken mod state
[08Sep2022 08:09:25.690] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RegisterColorHandlersEvent$Item to a broken mod state
[08Sep2022 08:09:25.924] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RenderLevelStageEvent$RegisterStageEvent to a broken mod state
[08Sep2022 08:09:26.013] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RegisterParticleProvidersEvent to a broken mod state
[08Sep2022 08:09:26.095] [Render thread/INFO] [net.minecraftforge.gametest.ForgeGameTestHooks/]: Enabled Gametest Namespaces: []
[08Sep2022 08:09:26.095] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.event.RegisterGameTestsEvent to a broken mod state
[08Sep2022 08:09:26.101] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RegisterClientReloadListenersEvent to a broken mod state
[08Sep2022 08:09:26.101] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$RegisterLayerDefinitions to a broken mod state
[08Sep2022 08:09:26.101] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$RegisterRenderers to a broken mod state
[08Sep2022 08:09:26.103] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RegisterTextureAtlasSpriteLoadersEvent to a broken mod state
[08Sep2022 08:09:26.105] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RegisterClientTooltipComponentFactoriesEvent to a broken mod state
[08Sep2022 08:09:26.107] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RegisterEntitySpectatorShadersEvent to a broken mod state
[08Sep2022 08:09:26.108] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RegisterKeyMappingsEvent to a broken mod state
[08Sep2022 08:09:26.111] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RegisterRecipeBookCategoriesEvent to a broken mod state
[08Sep2022 08:09:26.117] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RegisterGuiOverlaysEvent to a broken mod state
[08Sep2022 08:09:26.125] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RegisterDimensionSpecialEffectsEvent to a broken mod state
[08Sep2022 08:09:26.127] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RegisterNamedRenderTypesEvent to a broken mod state
[08Sep2022 08:09:26.128] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RegisterColorHandlersEvent$ColorResolvers to a broken mod state
[08Sep2022 08:09:26.130] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RegisterItemDecorationsEvent to a broken mod state
[08Sep2022 08:09:26.229] [Render thread/INFO] [com.mojang.text2speech.NarratorWindows/]: Narrator library for x64 successfully loaded
[08Sep2022 08:09:26.271] [Render thread/INFO] [net.minecraft.server.packs.resources.ReloadableResourceManager/]: Reloading ResourceManager: Default
[08Sep2022 08:09:26.352] [Worker-Main-8/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.ModelEvent$RegisterGeometryLoaders to a broken mod state
[08Sep2022 08:09:26.385] [Worker-Main-3/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[08Sep2022 08:09:26.385] [Worker-Main-1/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[08Sep2022 08:09:26.385] [Worker-Main-2/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[08Sep2022 08:09:30.862] [Worker-Main-8/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.ModelEvent$RegisterAdditional to a broken mod state
[08Sep2022 08:09:31.068] [Worker-Main-8/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[08Sep2022 08:09:31.754] [Worker-Main-8/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[08Sep2022 08:09:31.761] [Worker-Main-8/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[08Sep2022 08:09:31.784] [Worker-Main-8/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[08Sep2022 08:09:31.805] [Worker-Main-8/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[08Sep2022 08:09:31.811] [Worker-Main-8/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[08Sep2022 08:09:31.821] [Worker-Main-8/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state
[08Sep2022 08:09:31.897] [Render thread/WARN] [net.minecraft.client.sounds.SoundEngine/]: Missing sound for event: minecraft:item.goat_horn.play
[08Sep2022 08:09:31.897] [Render thread/WARN] [net.minecraft.client.sounds.SoundEngine/]: Missing sound for event: minecraft:entity.goat.screaming.horn_break
[08Sep2022 08:09:31.944] [Render thread/INFO] [com.mojang.blaze3d.audio.Library/]: OpenAL initialized on device OpenAL Soft on VoiceMeeter Input (VB-Audio VoiceMeeter VAIO)
[08Sep2022 08:09:31.946] [Render thread/INFO] [net.minecraft.client.sounds.SoundEngine/SOUNDS]: Sound engine started
[08Sep2022 08:09:31.946] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.sound.SoundEngineLoadEvent to a broken mod state
[08Sep2022 08:09:32.078] [Render thread/INFO] [net.minecraft.client.renderer.texture.TextureAtlas/]: Created: 1024x512x4 minecraft:textures/atlas/blocks.png-atlas
[08Sep2022 08:09:32.083] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[08Sep2022 08:09:32.083] [Render thread/INFO] [net.minecraft.client.renderer.texture.TextureAtlas/]: Created: 256x128x4 minecraft:textures/atlas/signs.png-atlas
[08Sep2022 08:09:32.084] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[08Sep2022 08:09:32.084] [Render thread/INFO] [net.minecraft.client.renderer.texture.TextureAtlas/]: Created: 512x512x4 minecraft:textures/atlas/banner_patterns.png-atlas
[08Sep2022 08:09:32.084] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[08Sep2022 08:09:32.084] [Render thread/INFO] [net.minecraft.client.renderer.texture.TextureAtlas/]: Created: 512x512x4 minecraft:textures/atlas/shield_patterns.png-atlas
[08Sep2022 08:09:32.085] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[08Sep2022 08:09:32.085] [Render thread/INFO] [net.minecraft.client.renderer.texture.TextureAtlas/]: Created: 256x256x4 minecraft:textures/atlas/chest.png-atlas
[08Sep2022 08:09:32.086] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[08Sep2022 08:09:32.086] [Render thread/INFO] [net.minecraft.client.renderer.texture.TextureAtlas/]: Created: 512x256x4 minecraft:textures/atlas/beds.png-atlas
[08Sep2022 08:09:32.086] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[08Sep2022 08:09:32.086] [Render thread/INFO] [net.minecraft.client.renderer.texture.TextureAtlas/]: Created: 512x256x4 minecraft:textures/atlas/shulker_boxes.png-atlas
[08Sep2022 08:09:32.086] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[08Sep2022 08:09:32.404] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.ModelEvent$BakingCompleted to a broken mod state
[08Sep2022 08:09:32.529] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.530] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.635] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.635] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.637] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.638] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.639] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.640] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.640] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.642] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.644] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.644] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.645] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.657] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.660] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.660] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.660] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.661] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.661] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.664] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.671] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.672] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$CreateSkullModels to a broken mod state
[08Sep2022 08:09:32.672] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.EntityRenderersEvent$AddLayers to a broken mod state
[08Sep2022 08:09:32.836] [Render thread/WARN] [net.minecraft.client.renderer.ShaderInstance/]: Shader rendertype_entity_translucent_emissive could not find sampler named Sampler2 in the specified shader program.
[08Sep2022 08:09:33.019] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.RegisterShadersEvent to a broken mod state
[08Sep2022 08:09:33.051] [Render thread/INFO] [net.minecraft.client.renderer.texture.TextureAtlas/]: Created: 256x256x0 minecraft:textures/atlas/particles.png-atlas
[08Sep2022 08:09:33.052] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[08Sep2022 08:09:33.053] [Render thread/INFO] [net.minecraft.client.renderer.texture.TextureAtlas/]: Created: 256x256x0 minecraft:textures/atlas/paintings.png-atlas
[08Sep2022 08:09:33.053] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[08Sep2022 08:09:33.054] [Render thread/INFO] [net.minecraft.client.renderer.texture.TextureAtlas/]: Created: 128x128x0 minecraft:textures/atlas/mob_effects.png-atlas
[08Sep2022 08:09:33.054] [Render thread/ERROR] [net.minecraftforge.fml.ModLoader/]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state
[08Sep2022 08:09:33.239] [Render thread/FATAL] [net.minecraftforge.common.ForgeMod/]: Preparing crash report with UUID a95d0913-b1a3-477b-a34e-a24394c9112e
[08Sep2022 08:09:33.240] [Render thread/FATAL] [net.minecraftforge.client.loading.ClientModLoader/]: Crash report saved to .\crash-reports\crash-2022-09-08_08.09.33-fml.txt
[08Sep2022 08:09:33.241] [Render thread/FATAL] [net.minecraftforge.common.ForgeMod/]: Preparing crash report with UUID 0c69bef1-0696-42b2-b317-f64e179dad15
[08Sep2022 08:09:36.313] [Render thread/INFO] [net.minecraft.client.Minecraft/]: Stopping!

 

  • LYXHAHA1 changed the title to [1.19.2]DeferredRegister Crash
Posted
Caused by: java.lang.IllegalStateException: Registry is already frozen
	at net.minecraftforge.registries.NamespacedHolderHelper.createIntrusiveHolder(NamespacedHolderHelper.java:192) ~[forge-1.19.2-43.1.1_mapped_parchment_2022.09.04-1.19.2-recomp.jar%23182%23189!/:?]
	at net.minecraftforge.registries.NamespacedDefaultedWrapper.createIntrusiveHolder(NamespacedDefaultedWrapper.java:210) ~[forge-1.19.2-43.1.1_mapped_parchment_2022.09.04-1.19.2-recomp.jar%23182%23189!/:?]
	at net.minecraft.world.item.Item.<init>(Item.java:57) ~[forge-1.19.2-43.1.1_mapped_parchment_2022.09.04-1.19.2-recomp.jar%23183!/:?]
	at net.writingwithfire.saintchapter.common.item.base.SCCustomItem.<init>(SCCustomItem.java:7) ~[%23188!/:?]
	at net.writingwithfire.saintchapter.common.item.ItemMindCrystal.<init>(ItemMindCrystal.java:8) ~[%23188!/:?]
	at net.writingwithfire.saintchapter.common.registry.RegistryItems.<clinit>(RegistryItems.java:42) ~[%23188!/:?] <-- HERE IS YOUR PROBLEM
	at net.writingwithfire.saintchapter.common.registry.RegisterEventHandler.attachEventHandlers(RegisterEventHandler.java:24) ~[%23188!/:?]
	at net.writingwithfire.saintchapter.common.CommonProxy.attachLifecycle(CommonProxy.java:36) ~[%23188!/:?]
	at net.writingwithfire.saintchapter.client.ClientProxy.attachLifecycle(ClientProxy.java:21) ~[%23188!/:?]
	at net.writingwithfire.saintchapter.SaintChapter.<init>(SaintChapter.java:30) ~[%23188!/:?] <-- HERE IT IS CREATING YOUR MOD

Looks obvious to me.

You are calling new Item() during the mod's classloading when the registries are frozen.

In your original code, you don't do that, you generate the name from the class without creating the item.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted

Because it is the wrong place.

Forge wants you to create/register objects when it is safe to do so.

Otherwise you will cause hard to debug (random) errors.

https://forge.gemwire.uk/wiki/Registration

  • Thanks 1

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted
15 hours ago, LYXHAHA1 said:
    public static <T extends Item> RegistryObject<Item> registerItem(Supplier<T> itemSupplier){
        return registerItem(itemSupplier, NameUtil.fromClass(itemSupplier.get(), "Item"));
    }

You need to pass in the Class of the Item there or you need to create the Supplier from the Class by using a constructor without arguments.

  • Thanks 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.