Jump to content

Recommended Posts

Posted

I keep receiving  this error and it points to this

 

 public BenTenMod() {
        final var bus = FMLJavaModLoadingContext.get().getModEventBus();

        ItemInit.ITEMS.register(bus);
        BlockInit.BLOCKS.register(bus);
   //this line
        EntityTypesInit.ENTITY_TYPES.register(bus);

        GeckoLibMod.DISABLE_IN_DEV = false;
        GeckoLib.initialize();

        // bus.addGenericListener(RecipeSerializer.class, RegisterRecipeInit::registerRecipes)
        MinecraftForge.EVENT_BUS.register(this);
        LOGGER.info("Armour and Item loaded");
    }

and the entity type class is 

public class EntityTypesInit {
    private EntityTypesInit() {
        throw new IllegalStateException("Entity gen class");
    }

    public static final DeferredRegister<EntityType<?>> ENTITY_TYPES =
            DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, BenTenMod.MOD_ID);

    private static final Item.Properties spawn_egg_props =
            new Item.Properties().tab(MainItemGroup.MAIN);

    private static final EntityType<VilgaxEntity> vilgax =
            createStandardEntityType("vilgax", VilgaxEntity::new, MobCategory.MONSTER, 1f, 1f);

    // registering the entities
    public static final RegistryObject<EntityType<VilgaxEntity>> VILGAX_ENTITY =
            ENTITY_TYPES.register("vilgax", () -> vilgax);

    private static final EntityType<CrabEntity> crab =
            createStandardEntityType("crab", CrabEntity::new, MobCategory.MONSTER, 1.3f, 1.8f);
    public static final RegistryObject<EntityType<CrabEntity>> CRAB_ENTITY =
            ENTITY_TYPES.register("crab", () -> crab);

    private static final EntityType<CrabBoltEntity> crabBolt = createStandardEntityType("crab_bolt",
            CrabBoltEntity::new, MobCategory.MISC, 0.5F, 0.5F);

    public static final RegistryObject<EntityType<CrabBoltEntity>> CRAB_BOLT_ENTITY =
            ENTITY_TYPES.register("crab_bolt", () -> crabBolt);

    // register spawn eggs
    public static final RegistryObject<Item> VILGAX_SPAWN_EGG = ItemInit.ITEMS.register(
            "vilgax_spawn_egg",
            () -> new ForgeSpawnEggItem(VILGAX_ENTITY, 0xC4AA79, 0x7A5F22, spawn_egg_props));

    public static final RegistryObject<Item> CRAB_SPAWN_EGG =
            ItemInit.ITEMS.register("crab_spawn_egg",
                    () -> new ForgeSpawnEggItem(CRAB_ENTITY, 0xC4AA79, 0x7A5F22, spawn_egg_props));


    private static <T extends Entity> EntityType<T> createStandardEntityType(String entity_name,
            EntityType.EntityFactory<T> factory, MobCategory classification, float width,
            float height) {
        return EntityType.Builder.of(factory, classification)
            .sized(width, height)
            .build(BenTenMod.MOD_ID + ":" + entity_name);
    }
}

The full error is 

java.lang.Exception: Mod Loading has failed
	at net.minecraftforge.logging.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:55) ~[forge-1.19.1-42.0.1_mapped_parchment_1.18.2-2022.06.26-1.19.1-recomp.jar%23178%23185!/:?] {re:classloading}
	at net.minecraftforge.client.loading.ClientModLoader.completeModLoading(ClientModLoader.java:167) ~[forge-1.19.1-42.0.1_mapped_parchment_1.18.2-2022.06.26-1.19.1-recomp.jar%23178%23185!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.lambda$new$2(Minecraft.java:587) ~[forge-1.19.1-42.0.1_mapped_parchment_1.18.2-2022.06.26-1.19.1-recomp.jar%23179!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.Util.ifElse(Util.java:441) ~[forge-1.19.1-42.0.1_mapped_parchment_1.18.2-2022.06.26-1.19.1-recomp.jar%23179!/:?] {re:classloading}
	at net.minecraft.client.Minecraft.lambda$new$3(Minecraft.java:581) ~[forge-1.19.1-42.0.1_mapped_parchment_1.18.2-2022.06.26-1.19.1-recomp.jar%23179!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screens.LoadingOverlay.render(LoadingOverlay.java:135) ~[forge-1.19.1-42.0.1_mapped_parchment_1.18.2-2022.06.26-1.19.1-recomp.jar%23179!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:897) ~[forge-1.19.1-42.0.1_mapped_parchment_1.18.2-2022.06.26-1.19.1-recomp.jar%23179!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1138) ~[forge-1.19.1-42.0.1_mapped_parchment_1.18.2-2022.06.26-1.19.1-recomp.jar%23179!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:702) ~[forge-1.19.1-42.0.1_mapped_parchment_1.18.2-2022.06.26-1.19.1-recomp.jar%23179!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.run(Main.java:212) ~[forge-1.19.1-42.0.1_mapped_parchment_1.18.2-2022.06.26-1.19.1-recomp.jar%23179!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:51) ~[forge-1.19.1-42.0.1_mapped_parchment_1.18.2-2022.06.26-1.19.1-recomp.jar%23179!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {}
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {}
	at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:25) ~[fmlloader-1.19.1-42.0.1.jar%2393!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) [modlauncher-10.0.8.jar%23105!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-10.0.8.jar%23105!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-10.0.8.jar%23105!/:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-10.0.8.jar%23105!/:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-10.0.8.jar%23105!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-10.0.8.jar%23105!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-10.0.8.jar%23105!/:?] {}
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) [bootstraplauncher-1.1.2.jar:?] {}


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
	at net.minecraftforge.registries.NamespacedHolderHelper.createIntrusiveHolder(NamespacedHolderHelper.java:192) ~[forge-1.19.1-42.0.1_mapped_parchment_1.18.2-2022.06.26-1.19.1-recomp.jar%23178%23185!/:?] {re:classloading}
-- MOD bentenmod --
Details:
	Caused by 0: java.lang.reflect.InvocationTargetException
		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.1-42.0.1.jar%23180!/:?] {}
		at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$10(ModContainer.java:121) ~[fmlcore-1.19.1-42.0.1.jar%23183!/:?] {}
		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 1: java.lang.ExceptionInInitializerError
		at io.github.realyusufismail.bentenmod.BenTenMod.<init>(BenTenMod.java:63) ~[%23184!/:?] {re:classloading}
		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.1-42.0.1.jar%23180!/:?] {}
		at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$10(ModContainer.java:121) ~[fmlcore-1.19.1-42.0.1.jar%23183!/:?] {}
		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) ~[?:?] {}

	Mod File: /Users/YI/Documents/GitHub/
	Failure message: Ben10 Mod (bentenmod) has failed to load correctly
		java.lang.reflect.InvocationTargetException: null
	Mod Version: 0.0NONE
	Mod Issue URL: https://github.com/
	Exception message: java.lang.IllegalStateException: Registry is already frozen
Stacktrace:
	at net.minecraftforge.registries.NamespacedHolderHelper.createIntrusiveHolder(NamespacedHolderHelper.java:192) ~[forge-1.19.1-42.0.1_mapped_parchment_1.18.2-2022.06.26-1.19.1-recomp.jar%23178%23185!/:?] {re:classloading}
	at net.minecraftforge.registries.NamespacedDefaultedWrapper.createIntrusiveHolder(NamespacedDefaultedWrapper.java:210) ~[forge-1.19.1-42.0.1_mapped_parchment_1.18.2-2022.06.26-1.19.1-recomp.jar%23178%23185!/:?] {re:classloading}
	at net.minecraft.world.entity.EntityType.<init>(EntityType.java:158) ~[forge-1.19.1-42.0.1_mapped_parchment_1.18.2-2022.06.26-1.19.1-recomp.jar%23179!/:?] {re:classloading}
	at net.minecraft.world.entity.EntityType$Builder.build(EntityType.java:712) ~[forge-1.19.1-42.0.1_mapped_parchment_1.18.2-2022.06.26-1.19.1-recomp.jar%23179!/:?] {re:classloading}
	at io.github.realyusufismail.bentenmod.core.init.EntityTypesInit.createStandardEntityType(EntityTypesInit.java:94) ~[%23184!/:?] {re:classloading}
	at io.github.realyusufismail.bentenmod.core.init.EntityTypesInit.<clinit>(EntityTypesInit.java:62) ~[%23184!/:?] {re:classloading}
	at io.github.realyusufismail.bentenmod.BenTenMod.<init>(BenTenMod.java:63) ~[%23184!/:?] {re:classloading}
	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.1-42.0.1.jar%23180!/:?] {}
	at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$10(ModContainer.java:121) ~[fmlcore-1.19.1-42.0.1.jar%23183!/:?] {}
	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) ~[?:?] {}

 

Posted

The whole point of using a RegistryObject is that creating the real object is deferred until it is safe to do so.

You are creating the EntityType objects in static initializers (i.e. during classloading) which is long before this is true.

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

Use same pattern you use for all RegistryObjects:

- private static final EntityType<CrabEntity> crab =
            createStandardEntityType("crab", CrabEntity::new, MobCategory.MONSTER, 1.3f, 1.8f);
- public static final RegistryObject<EntityType<CrabEntity>> CRAB_ENTITY =
            ENTITY_TYPES.register("crab", () -> crab);
  
+ public static final RegistryObject<EntityType<CrabEntity>> CRAB_ENTITY =
            ENTITY_TYPES.register("crab", () -> createStandardEntityType("crab", CrabEntity::new, MobCategory.MONSTER, 1.3f, 1.8f));

Then you get the real object later when you need it using CRAB_ENTITY.get()

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.

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.