Jump to content

Recommended Posts

Posted

If there is nothing in ForgeRegistries, use the vanilla Registry class.

Double check it is not @Deprecated which means it is in ForgeRegistries and you missed it. 🙂

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

I get this error 

-- Head --
Thread: Render thread
Stacktrace:
	at java.util.Objects.requireNonNull(Objects.java:334) ~[?:?] {}
-- 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.2.jar%23182!/:?] {}
		at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$10(ModContainer.java:121) ~[fmlcore-1.19.1-42.0.2.jar%23185!/:?] {}
		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) ~[%23186!/:?] {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.2.jar%23182!/:?] {}
		at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$10(ModContainer.java:121) ~[fmlcore-1.19.1-42.0.2.jar%23185!/:?] {}
		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/Ben-10-Mod/build/resources/main/
	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/RealYusufIsmail/Ben-10-Mod/issues
	Exception message: java.lang.NullPointerException: Registry Object not present: bentenmod:legendary_ore
Stacktrace:
	at java.util.Objects.requireNonNull(Objects.java:334) ~[?:?] {}
	at net.minecraftforge.registries.RegistryObject.get(RegistryObject.java:204) ~[forge-1.19.1-42.0.2_mapped_parchment_1.18.2-2022.08.02-1.19.1-recomp.jar%23180%23187!/:?] {re:classloading}
	at io.github.realyusufismail.bentenmod.core.init.ConfiguredFeaturesInit.<clinit>(ConfiguredFeaturesInit.java:25) ~[%23186!/:?] {re:classloading}
	at io.github.realyusufismail.bentenmod.BenTenMod.<init>(BenTenMod.java:63) ~[%23186!/:?] {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.2.jar%23182!/:?] {}
	at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$10(ModContainer.java:121) ~[fmlcore-1.19.1-42.0.2.jar%23185!/:?] {}
	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

For blocks i register with ForgeRegistries 

 public static final DeferredRegister<Block> BLOCKS =
            DeferredRegister.create(ForgeRegistries.BLOCKS, BenTenMod.MOD_ID);

were as with CONFIGURED_FEATURES i use Registry

 public static final DeferredRegister<ConfiguredFeature<?, ?>> CONFIGURED_FEATURES =
            DeferredRegister.create(Registry.CONFIGURED_FEATURE_REGISTRY, BenTenMod.MOD_ID);

same with. PLACED_FEATURES 

 public static final DeferredRegister<PlacedFeature> PLACED_FEATURES =
            DeferredRegister.create(Registry.PLACED_FEATURE_REGISTRY, BenTenMod.MOD_ID);

 

Posted
Quote

net.minecraftforge.registries.RegistryObject.get

None of the code above shows a RegistryObject.get().

 

Please don't just post any error you get in this forum without thinking about it.

We are not here to write/debug your code for you. You need to take the time to work things out for yourself.

You spent less than 6 minutes on this problem.

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 (edited)
 public static final Supplier<List<OreConfiguration.TargetBlockState>> OVERWORLD_LEGENDARY_ORE =
            regOverWoldOres(BlockInit.LEGENDARY_ORE.get(), BlockInit.DEEPSLATE_LEGENDARY_ORE.get());
 public static Supplier<List<OreConfiguration.TargetBlockState>> regOverWoldOres(Block normalOre,
            Block deepslateOre) {
        return Suppliers.memoize(() -> List.of(
                OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES,
                        normalOre.defaultBlockState()),
                OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES,
                        deepslateOre.defaultBlockState())));
    }

 

Edited by YusufTheCoder
Posted
 public BenTenMod() {
        final var bus = FMLJavaModLoadingContext.get().getModEventBus();

        ItemInit.ITEMS.register(bus);
        BlockInit.BLOCKS.register(bus);
        EntityTypesInit.ENTITY_TYPES.register(bus);
        MenuTypeInit.MENUS.register(bus);
        RecipeTypeInit.TYPES.register(bus);
        RecipeSerializerInit.SERIALIZERS.register(bus);
        ConfiguredFeaturesInit.CONFIGURED_FEATURES.register(bus);
        PlacedFeaturesInit.PLACED_FEATURES.register(bus);

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

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

 

Posted

Do you understand how Suppliers work in terms of deferring code execution?

Are those RegistryObject.get() invocations run during classloading or during the Supplier.get() for the List at registration time?

 

It should be more like this.

 public static final Supplier<List<OreConfiguration.TargetBlockState>> OVERWORLD_LEGENDARY_ORE =
            
            // Pass the suppliers, the blocks have not been created yet we are in the classloading
            regOverWoldOres(BlockInit.LEGENDARY_ORE, BlockInit.DEEPSLATE_LEGENDARY_ORE);

  public static Supplier<List<OreConfiguration.TargetBlockState>> regOverWoldOres(RegistryObject<Block> normalOre,
            RegistryObject<Block> deepslateOre) {
        return Suppliers.memoize(() -> List.of(
                OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES,

                        // Use the supplier at registration time when the blocks now exist
                        normalOre.get().defaultBlockState()),
                OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES,
                        deepslateOre.get().defaultBlockState())));
    }

 

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.