Jump to content

forge error on run


Just_EmSee

Recommended Posts

---- Minecraft Crash Report ----
// Shall we play a game?

Time: 30/04/2023, 13:47
Description: Mod loading error has occurred

java.lang.Exception: Mod Loading has failed
	at net.minecraftforge.logging.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:55) ~[forge-1.18.2-40.1.51_mapped_parchment_2022.03.13-1.18.2-recomp.jar%2375%2382!/:?] {re:classloading}
	at net.minecraftforge.client.loading.ClientModLoader.completeModLoading(ClientModLoader.java:170) ~[forge-1.18.2-40.1.51_mapped_parchment_2022.03.13-1.18.2-recomp.jar%2375%2382!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.lambda$new$1(Minecraft.java:560) ~[forge-1.18.2-40.1.51_mapped_parchment_2022.03.13-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.Util.ifElse(Util.java:400) ~[forge-1.18.2-40.1.51_mapped_parchment_2022.03.13-1.18.2-recomp.jar%2376!/:?] {re:classloading}
	at net.minecraft.client.Minecraft.lambda$new$2(Minecraft.java:554) ~[forge-1.18.2-40.1.51_mapped_parchment_2022.03.13-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screens.LoadingOverlay.render(LoadingOverlay.java:135) ~[forge-1.18.2-40.1.51_mapped_parchment_2022.03.13-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:891) ~[forge-1.18.2-40.1.51_mapped_parchment_2022.03.13-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1070) ~[forge-1.18.2-40.1.51_mapped_parchment_2022.03.13-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:668) ~[forge-1.18.2-40.1.51_mapped_parchment_2022.03.13-1.18.2-recomp.jar%2376!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:205) ~[forge-1.18.2-40.1.51_mapped_parchment_2022.03.13-1.18.2-recomp.jar%2376!/:?] {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:24) ~[fmlloader-1.18.2-40.1.51.jar%230!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.1.3.jar%2310!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.1.3.jar%2310!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.1.3.jar%2310!/:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.1.3.jar%2310!/:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.1.3.jar%2310!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.1.3.jar%2310!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.1.3.jar%2310!/:?] {}
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) [bootstraplauncher-1.0.0.jar:?] {}


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

-- Head --
Thread: Render thread
Stacktrace:
	at java.util.Objects.requireNonNull(Objects.java:334) ~[?:?] {}
-- MOD majestic --
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:67) ~[javafmllanguage-1.18.2-40.1.51.jar%2377!/:?] {}
		at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:106) ~[fmlcore-1.18.2-40.1.51.jar%2380!/:?] {}
		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 net.JustEmSee_Burd.the_majestic.The_Majestic.<init>(The_Majestic.java:47) ~[%2381!/:?] {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:67) ~[javafmllanguage-1.18.2-40.1.51.jar%2377!/:?] {}
		at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:106) ~[fmlcore-1.18.2-40.1.51.jar%2380!/:?] {}
		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: main
	Failure message: The Majestic (majestic) has failed to load correctly
		java.lang.reflect.InvocationTargetException: null
	Mod Version: 0.0NONE
	Mod Issue URL: NOT PROVIDED
	Exception message: java.lang.NullPointerException: Registry Object not present: majestic:fire_crystal_ore
Stacktrace:
	at java.util.Objects.requireNonNull(Objects.java:334) ~[?:?] {}
	at net.minecraftforge.registries.RegistryObject.get(RegistryObject.java:320) ~[forge-1.18.2-40.1.51_mapped_parchment_2022.03.13-1.18.2-recomp.jar%2375%2382!/:?] {re:classloading,xf:fml:forge:registry_object_binary_compat}
	at net.JustEmSee_Burd.the_majestic.world.feature.ModConfiguredFeatures.RegisterOre(ModConfiguredFeatures.java:23) ~[%2381!/:?] {re:classloading}
	at net.JustEmSee_Burd.the_majestic.item.ModCrystalItems.registerCrystalOre(ModCrystalItems.java:117) ~[%2381!/:?] {re:classloading}
	at net.JustEmSee_Burd.the_majestic.item.ModCrystalItems.registerCrystal(ModCrystalItems.java:105) ~[%2381!/:?] {re:classloading}
	at net.JustEmSee_Burd.the_majestic.item.ModCrystalItems.<clinit>(ModCrystalItems.java:40) ~[%2381!/:?] {re:classloading}
	at net.JustEmSee_Burd.the_majestic.The_Majestic.<init>(The_Majestic.java:47) ~[%2381!/:?] {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:67) ~[javafmllanguage-1.18.2-40.1.51.jar%2377!/:?] {}
	at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:106) ~[fmlcore-1.18.2-40.1.51.jar%2380!/:?] {}
	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) ~[?:?] {}


-- System Details --
Details:
	Minecraft Version: 1.18.2
	Minecraft Version ID: 1.18.2
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 17.0.2, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode, sharing), Oracle Corporation
	Memory: 1758408704 bytes (1676 MiB) / 2187329536 bytes (2086 MiB) up to 4282384384 bytes (4084 MiB)
	CPUs: 16
	Processor Vendor: AuthenticAMD
	Processor Name: AMD Ryzen 7 3700X 8-Core Processor             
	Identifier: AuthenticAMD Family 23 Model 113 Stepping 0
	Microarchitecture: Zen 2
	Frequency (GHz): 3.59
	Number of physical packages: 1
	Number of physical CPUs: 8
	Number of logical CPUs: 16
	Graphics card #0 name: NVIDIA GeForce GTX 970
	Graphics card #0 vendor: NVIDIA (0x10de)
	Graphics card #0 VRAM (MB): 4095.00
	Graphics card #0 deviceId: 0x13c2
	Graphics card #0 versionInfo: DriverVersion=31.0.15.2737
	Memory slot #0 capacity (MB): 8192.00
	Memory slot #0 clockSpeed (GHz): 2.13
	Memory slot #0 type: DDR4
	Memory slot #1 capacity (MB): 8192.00
	Memory slot #1 clockSpeed (GHz): 2.13
	Memory slot #1 type: DDR4
	Virtual memory max (MB): 41929.35
	Virtual memory used (MB): 18962.37
	Swap memory total (MB): 25600.00
	Swap memory used (MB): 984.88
	JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
	ModLauncher: 9.1.3+9.1.3+main.9b69c82a
	ModLauncher launch target: forgeclientuserdev
	ModLauncher naming: mcp
	ModLauncher services: 
		 mixin PLUGINSERVICE 
		 eventbus PLUGINSERVICE 
		 slf4jfixer PLUGINSERVICE 
		 object_holder_definalize PLUGINSERVICE 
		 runtime_enum_extender PLUGINSERVICE 
		 capability_token_subclass PLUGINSERVICE 
		 accesstransformer PLUGINSERVICE 
		 runtimedistcleaner PLUGINSERVICE 
		 mixin TRANSFORMATIONSERVICE 
		 fml TRANSFORMATIONSERVICE 
	FML Language Providers: 
		[email protected]
		lowcodefml@null
		javafml@null
	Mod List: 
		forge-1.18.2-40.1.51_mapped_parchment_2022.03.13-1|Minecraft                     |minecraft                     |1.18.2              |COMMON_SET|Manifest: a1:d4:5e:04:4f:d3:d6:e0:7b:37:97:cf:77:b0:de:ad:4a:47:ce:8c:96:49:5f:0a:cf:8c:ae:b2:6d:4b:8a:3f
		                                                  |Forge                         |forge                         |40.1.51             |COMMON_SET|Manifest: NOSIGNATURE
		Patchouli-1.18.2-71.1_mapped_parchment_2022.03.13-|Patchouli                     |patchouli                     |1.18.2-71.1         |COMMON_SET|Manifest: NOSIGNATURE
		main                                              |The Majestic                  |majestic                      |0.0NONE             |ERROR     |Manifest: NOSIGNATURE
		geckolib-forge-1.18-3.0.41_mapped_parchment_2022.0|GeckoLib                      |geckolib3                     |3.0.41              |COMMON_SET|Manifest: NOSIGNATURE
		jei-1.18.2-9.7.1.255_mapped_parchment_2022.03.13-1|Just Enough Items             |jei                           |9.7.1.255           |COMMON_SET|Manifest: NOSIGNATURE
	Crash Report UUID: 670498e1-ca33-4e4d-b9d9-7456cf682631
	FML: 40.1
	Forge: net.minecraftforge:40.1.51

tried to add automatic ore generation for automictic generating blocks but got this error

Link to comment
Share on other sites

You can't dereference RegistryObjects until after the underlying objects are registered.

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

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

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.

Link to comment
Share on other sites

Paraphrasing those links since it looks like you are too lazy to read them yourself.

 

Don't call get() until you really need the value. After the RegisterEvent has been fired.

You certainly can't do it in the static initialisation of a class.

Quote

at net.JustEmSee_Burd.the_majestic.item.ModCrystalItems.<clinit>(ModCrystalItems.java:40) ~[%2381!/:?] {re:classloading}

 

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.

Link to comment
Share on other sites

Of course it is possible. You are just doing it wrong.

From that link I posted earlier that you didn't read (the part that says IMPORTANT): https://forge.gemwire.uk/wiki/Registration#DeferredRegister

 

Bad constructor (no way to pass an item in static initialisation):

MyCrystalOreBlock(Item item)

Good constructor (deferred access)

MyCrystalOreBlock(RegistryObject<Item> itemRegistryObject) // or equivalently Supplier<Item>

 

And it's not like this question hasn't been asked many times before in this forum. oh wait...

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.

Link to comment
Share on other sites

Sorry, but you are just talking to yourself unless you show what you talking about.

We have no psychic powers.

Although I suspect, you just don't understand how Suppliers (deferred access) works?

Example from a recent thread:

https://forums.minecraftforge.net/topic/123364-defective-ore-generation/

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.

Link to comment
Share on other sites

im sorry, here is the code i am referring to

 

package net.JustEmSee_Burd.the_majestic.item;

import net.JustEmSee_Burd.the_majestic.The_Majestic;
import net.JustEmSee_Burd.the_majestic.block.ModBlocks;
import net.JustEmSee_Burd.the_majestic.spell.Spell;
import net.JustEmSee_Burd.the_majestic.spell.SpellItem;
import net.JustEmSee_Burd.the_majestic.world.feature.ModConfiguredFeatures;
import net.JustEmSee_Burd.the_majestic.world.feature.ModOrePlacement;
import net.minecraft.data.worldgen.features.OreFeatures;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.levelgen.VerticalAnchor;
import net.minecraft.world.level.levelgen.placement.HeightRangePlacement;
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest;
import net.minecraft.world.level.material.Material;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;
import org.jetbrains.annotations.Nullable;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;

public class ModCrystalItems {
    private List GenerateOres = new ArrayList();
    public static final DeferredRegister<Item> CRYSTALS =
            DeferredRegister.create(ForgeRegistries.ITEMS, The_Majestic.MOD_ID);

    public static final RegistryObject<Item> MANA_CRYSTAL =  registerCrystal("mana_crystal",
            () -> new Item(new Item.Properties().tab(ModCreativeModeTab.Majestic_TAB)),
            false, false, null, 0 ,
            null, null);


    public static final RegistryObject<Item> FIRE_CRYSTAL =  registerCrystal("fire_crystal",
            () -> new Item(new Item.Properties().tab(ModCreativeModeTab.Majestic_TAB)),
            true, false, OreFeatures.NETHER_ORE_REPLACEABLES, 100 ,
            ModOrePlacement.commonOrePlacement(1 ,HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-80), VerticalAnchor.aboveBottom(80))), null);

    public static final RegistryObject<Item> WATER_CRYSTAL =  registerCrystal("water_crystal",
            () -> new Item(new Item.Properties().tab(ModCreativeModeTab.Majestic_TAB)),
            true, true, OreFeatures.STONE_ORE_REPLACEABLES, 100 ,
            ModOrePlacement.commonOrePlacement(1 ,HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-80), VerticalAnchor.aboveBottom(80))), null);

    public static final RegistryObject<Item> EARTH_CRYSTAL =  registerCrystal("earth_crystal",
            () -> new Item(new Item.Properties().tab(ModCreativeModeTab.Majestic_TAB)),
            true, true, OreFeatures.STONE_ORE_REPLACEABLES, 100 ,
            ModOrePlacement.commonOrePlacement(1 ,HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-80), VerticalAnchor.aboveBottom(80))), null);

    public static final RegistryObject<Item> AIR_CRYSTAL =  registerCrystal("air_crystal",
            () -> new Item(new Item.Properties().tab(ModCreativeModeTab.Majestic_TAB)),
            true, true, OreFeatures.STONE_ORE_REPLACEABLES, 100 ,
            ModOrePlacement.commonOrePlacement(1 ,HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-80), VerticalAnchor.aboveBottom(80))), null);

    public static final RegistryObject<Item> MAGMA_CRYSTAL =  registerCrystal("magma_crystal",
            () -> new Item(new Item.Properties().tab(ModCreativeModeTab.Majestic_TAB)),
            false, false, null, 0 ,
            null, null);

    public static final RegistryObject<Item> ICE_CRYSTAL =  registerCrystal("ice_crystal",
            () -> new Item(new Item.Properties().tab(ModCreativeModeTab.Majestic_TAB)),
            false, false, null, 0 ,
            null, null);

    public static final RegistryObject<Item> NATURE_CRYSTAL =  registerCrystal("nature_crystal",
            () -> new Item(new Item.Properties().tab(ModCreativeModeTab.Majestic_TAB)),
            false, false, null, 0 ,
            null, null);

    public static final RegistryObject<Item> LIGHTNING_CRYSTAL =  registerCrystal("lightning_crystal",
            () -> new Item(new Item.Properties().tab(ModCreativeModeTab.Majestic_TAB)),
            false, false, null, 0 ,
            null, null);

    public static final RegistryObject<Item> LIGHT_CRYSTAL =  registerCrystal("light_crystal",
            () -> new Item(new Item.Properties().tab(ModCreativeModeTab.Majestic_TAB)),
            false, false, null, 0 ,
            null, null);

    public static final RegistryObject<Item> DARKNESS_CRYSTAL =  registerCrystal("darkness_crystal",
            () -> new Item(new Item.Properties().tab(ModCreativeModeTab.Majestic_TAB)),
            false,false, null, 0,
            null, null);

    public static final RegistryObject<Item> VOID_CRYSTAL =  registerCrystal("void_crystal",
            () -> new Item(new Item.Properties().tab(ModCreativeModeTab.Majestic_TAB)),
            false, false, null, 0,
            null, null);

    public static void register(IEventBus eventBus) {
        CRYSTALS.register(eventBus);
    }

    private static <T extends Item> RegistryObject<T> registerCrystal(String name, Supplier<T> item, boolean hasOre, boolean hasDeepslateOre, RuleTest defaultOreReplaceBlock, int oreSize, List<PlacementModifier> orePlacementFeatures, List Features) {
        RegistryObject<T> toReturn = CRYSTALS.register(name, item);
        String oreName = null;
        String deepslateOreName = null;
        if (hasOre) oreName = name+"_ore";
        if (hasDeepslateOre)deepslateOreName = "deepslate_"+name+"_ore";
        if (hasOre || hasDeepslateOre)registerCrystalOre(oreName, deepslateOreName, ModCreativeModeTab.Majestic_TAB, defaultOreReplaceBlock, oreSize, orePlacementFeatures, Features);

        return toReturn;
    }

    private static void registerCrystalOre(String oreName, String deepslateOreName, CreativeModeTab tab,RuleTest ruleTest, int oreSize,List<PlacementModifier> orePlacementFeatures, List Features) {
        RegistryObject<Block> ore = null;
        RegistryObject<Block> deepslateOre = null;
        if(oreName != null) ore = ModBlocks.registerBlock(oreName, () -> new Block(BlockBehaviour.Properties.of(Material.STONE)
                .strength(5F).requiresCorrectToolForDrops()), tab);
        if(deepslateOreName != null) deepslateOre = ModBlocks.registerBlock(deepslateOreName, () -> new Block(BlockBehaviour.Properties.of(Material.STONE)
                .strength(5F).requiresCorrectToolForDrops()), tab);
        ModConfiguredFeatures.RegisterOre(oreName, ore, deepslateOre, ruleTest, oreSize, orePlacementFeatures, Features);
    }

}
package net.JustEmSee_Burd.the_majestic.world.feature;

import net.JustEmSee_Burd.the_majestic.The_Majestic;
import net.minecraft.core.Holder;
import net.minecraft.data.worldgen.features.FeatureUtils;
import net.minecraft.data.worldgen.features.OreFeatures;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest;
import net.minecraftforge.registries.RegistryObject;

import java.util.ArrayList;
import java.util.List;

public class ModConfiguredFeatures {

    public static List<OreConfiguration.TargetBlockState> RegisterOre(String name, RegistryObject<Block> oreBlock, RegistryObject<Block> deepslateOreBlock, RuleTest deafaultOreReplaceBlock, int OreSize, List<PlacementModifier> OrePlacementFeatures, List ExtraFeatures) {
        List<OreConfiguration.TargetBlockState> toReturn = new ArrayList<>();
        if (oreBlock != null) toReturn.add(OreConfiguration.target(deafaultOreReplaceBlock, oreBlock.get().defaultBlockState()));
        if (deepslateOreBlock != null) toReturn.add(OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, deepslateOreBlock.get().defaultBlockState()));
        if (ExtraFeatures != null) toReturn.addAll(ExtraFeatures);
        configureOre(toReturn, name, OreSize, OrePlacementFeatures);
        return toReturn;
    }

    public static Holder<ConfiguredFeature<OreConfiguration, ?>> configureOre(List<OreConfiguration.TargetBlockState> features, String name, int OreSize, List<PlacementModifier> OrePlacementFeatures) {
        Holder<ConfiguredFeature<OreConfiguration, ?>> toReturn = FeatureUtils.register(name,
                Feature.ORE, new OreConfiguration(features, OreSize));
        ModPlacedFeatures.GenerateOrePlacement(name+"_placed", toReturn, OrePlacementFeatures);
        return toReturn;
    }

    public static void registerConfiguredFeatures() {
        System.out.println("Registering ModConfiguredFeatures for " + The_Majestic.MOD_ID);
    }


}
package net.JustEmSee_Burd.the_majestic.world.feature;


import net.minecraft.world.level.levelgen.placement.*;

import java.util.List;

public class ModOrePlacement {
    public static List<PlacementModifier> orePlacement(PlacementModifier veinsPerChunk, PlacementModifier p_195348_) {
        return List.of(veinsPerChunk, InSquarePlacement.spread(), p_195348_, BiomeFilter.biome());
    }

    public static List<PlacementModifier> commonOrePlacement(int p_195344_, PlacementModifier p_195345_) {
        return orePlacement(CountPlacement.of(p_195344_), p_195345_);
    }

    public static List<PlacementModifier> rareOrePlacement(int p_195350_, PlacementModifier p_195351_) {
        return orePlacement(RarityFilter.onAverageOnceEvery(p_195350_), p_195351_);
    }
}
package net.JustEmSee_Burd.the_majestic.world.gen;


import net.minecraft.core.Holder;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.minecraftforge.event.world.BiomeLoadingEvent;

import java.util.ArrayList;
import java.util.List;

public class ModOreGeneration {
    private static List<Holder<PlacedFeature>> list = new ArrayList<>();

    public static void generateOres(final BiomeLoadingEvent event) {
        List<Holder<PlacedFeature>> base =
                event.getGeneration().getFeatures(GenerationStep.Decoration.UNDERGROUND_ORES);
        base.addAll(list);
    }
    
    public static void addOreGen(Holder<PlacedFeature> placedFeatureHolder) {
        list.add(placedFeatureHolder);
    }


}

 

or the github: https://github.com/sen2006/The-Majestic

Link to comment
Share on other sites

I'm obviously just wasting my time.

My previous response contains a link to some code by somebody who knows how to "correctly" register ConfiguredFeatures in 1.18 using a DeferredRegister<ConfiguredFeature>

Yours tries to lookup blocks that don't exist yet and then register them in the vanilla builtin registries.

Edited by warjort

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.

Link to comment
Share on other sites

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.