Jump to content

{SOLVED} [1.17.1] (Forge 37.0.44) Minecraft crashes when adding an axe.


Recommended Posts

Posted (edited)

 

I added a new system of tools with obviously modified statistics, everything is excellent until it is time to add an ax, in which minecraft crashes without even being able to see the main menu.

 

The error is: ExampleMod  (examplemod) encountered an error during the common_setup event phase

                     java.lang.ExceptionInInitializerError: null

 

The crash report: 

---- Minecraft Crash Report ----
// You should try our sister game, Minceraft!

Time: 26/08/21, 7:39 p. m.
Description: Mod loading error has occurred

java.lang.Exception: Mod Loading has failed
	at net.minecraftforge.fmllegacy.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:69) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2373%2379!:?] {re:classloading}
	at net.minecraftforge.fmlclient.ClientModLoader.completeModLoading(ClientModLoader.java:183) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2373%2379!:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.lambda$new$1(Minecraft.java:556) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.Util.ifElse(Util.java:361) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading}
	at net.minecraft.client.Minecraft.lambda$new$2(Minecraft.java:550) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.gui.screens.LoadingOverlay.render(LoadingOverlay.java:135) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:874) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1040) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:660) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:186) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:runtimedistcleaner:A}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?] {}
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
	at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?] {}
	at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:38) ~[fmlloader-1.17.1-37.0.44.jar%233!:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.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 gworld --
Details:
	Caused by 0: java.lang.ExceptionInInitializerError
		at jp.gianka.gworld.elements.init.GWorldItems.lambda$static$0(GWorldItems.java:26) ~[%2378!:?] {re:classloading}
		at net.minecraftforge.registries.DeferredRegister.lambda$register$0(DeferredRegister.java:121) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2373%2379!:?] {re:classloading}
		at net.minecraftforge.registries.DeferredRegister.addEntries(DeferredRegister.java:197) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2373%2379!:?] {re:classloading}
		at net.minecraftforge.registries.DeferredRegister$EventDispatcher.handleEvent(DeferredRegister.java:169) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2373%2379!:?] {re:classloading}
		at net.minecraftforge.eventbus.ASMEventHandler_0_EventDispatcher_handleEvent_Register.invoke(.dynamic) ~[?:?] {}
		at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-5.0.3.jar%237!:?] {}
		at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-5.0.3.jar%237!:?] {}
		at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-5.0.3.jar%237!:?] {}
		at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:120) ~[javafmllanguage-1.17.1-37.0.44.jar%2375!:?] {}
		at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:121) ~[fmlcore-1.17.1-37.0.44.jar%2377!:?] {}
		at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1800) ~[?:?] {}
		at net.minecraftforge.fml.ModWorkManager$SyncExecutor.driveOne(ModWorkManager.java:56) ~[fmlcore-1.17.1-37.0.44.jar%2377!:?] {}
		at net.minecraftforge.fml.ModWorkManager$DrivenExecutor.drive(ModWorkManager.java:40) ~[fmlcore-1.17.1-37.0.44.jar%2377!:?] {}
		at net.minecraftforge.fml.ModLoader.waitForTransition(ModLoader.java:216) ~[fmlcore-1.17.1-37.0.44.jar%2377!:?] {}
		at net.minecraftforge.fml.ModLoader.lambda$dispatchAndHandleError$21(ModLoader.java:201) ~[fmlcore-1.17.1-37.0.44.jar%2377!:?] {}
		at java.util.Optional.ifPresent(Optional.java:178) ~[?:?] {}
		at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:201) ~[fmlcore-1.17.1-37.0.44.jar%2377!:?] {}
		at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$11(ModLoader.java:178) ~[fmlcore-1.17.1-37.0.44.jar%2377!:?] {}
		at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] {}
		at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:178) ~[fmlcore-1.17.1-37.0.44.jar%2377!:?] {}
		at net.minecraftforge.fmlclient.ClientModLoader.lambda$begin$1(ClientModLoader.java:107) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2373%2379!:?] {re:classloading,pl:runtimedistcleaner:A}
		at net.minecraftforge.fmlclient.ClientModLoader.lambda$createRunnableWithCatch$4(ClientModLoader.java:127) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2373%2379!:?] {re:classloading,pl:runtimedistcleaner:A}
		at net.minecraftforge.fmlclient.ClientModLoader.begin(ClientModLoader.java:107) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2373%2379!:?] {re:classloading,pl:runtimedistcleaner:A}
		at net.minecraft.client.Minecraft.<init>(Minecraft.java:461) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
		at net.minecraft.client.main.Main.main(Main.java:151) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:runtimedistcleaner:A}
		at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
		at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?] {}
		at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
		at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?] {}
		at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:38) ~[fmlloader-1.17.1-37.0.44.jar%233!:?] {}
		at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%238!:?] {}
		at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%238!:?] {}
		at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%238!:?] {}
		at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%238!:?] {}
		at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%238!:?] {}
		at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%238!:?] {}
		at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%238!:?] {}
		at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {}

	Mod File: main
	Failure message: GWorld (gworld) encountered an error during the common_setup event phase
		java.lang.ExceptionInInitializerError: null
	Mod Version: 0.0.0.102
	Mod Issue URL: NOT PROVIDED
	Exception message: java.lang.NullPointerException: Registry Object not present: gworld:kyptoite_gem
Stacktrace:
	at java.util.Objects.requireNonNull(Objects.java:334) ~[?:?] {}
	at net.minecraftforge.fmllegacy.RegistryObject.get(RegistryObject.java:120) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2373%2379!:?] {re:classloading}
	at jp.gianka.gworld.elements.config.GWorldTiers.lambda$static$0(GWorldTiers.java:12) ~[%2378!:?] {re:classloading}
	at jp.gianka.gworld.elements.config.GWorldTiers.<init>(GWorldTiers.java:28) ~[%2378!:?] {re:classloading}
	at jp.gianka.gworld.elements.config.GWorldTiers.<clinit>(GWorldTiers.java:11) ~[%2378!:?] {re:classloading}
	at jp.gianka.gworld.elements.init.GWorldItems.lambda$static$0(GWorldItems.java:26) ~[%2378!:?] {re:classloading}
	at net.minecraftforge.registries.DeferredRegister.lambda$register$0(DeferredRegister.java:121) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2373%2379!:?] {re:classloading}
	at net.minecraftforge.registries.DeferredRegister.addEntries(DeferredRegister.java:197) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2373%2379!:?] {re:classloading}
	at net.minecraftforge.registries.DeferredRegister$EventDispatcher.handleEvent(DeferredRegister.java:169) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2373%2379!:?] {re:classloading}
	at net.minecraftforge.eventbus.ASMEventHandler_0_EventDispatcher_handleEvent_Register.invoke(.dynamic) ~[?:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-5.0.3.jar%237!:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-5.0.3.jar%237!:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-5.0.3.jar%237!:?] {}
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:120) ~[javafmllanguage-1.17.1-37.0.44.jar%2375!:?] {}
	at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:121) ~[fmlcore-1.17.1-37.0.44.jar%2377!:?] {}
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1800) ~[?:?] {}
	at net.minecraftforge.fml.ModWorkManager$SyncExecutor.driveOne(ModWorkManager.java:56) ~[fmlcore-1.17.1-37.0.44.jar%2377!:?] {}
	at net.minecraftforge.fml.ModWorkManager$DrivenExecutor.drive(ModWorkManager.java:40) ~[fmlcore-1.17.1-37.0.44.jar%2377!:?] {}
	at net.minecraftforge.fml.ModLoader.waitForTransition(ModLoader.java:216) ~[fmlcore-1.17.1-37.0.44.jar%2377!:?] {}
	at net.minecraftforge.fml.ModLoader.lambda$dispatchAndHandleError$21(ModLoader.java:201) ~[fmlcore-1.17.1-37.0.44.jar%2377!:?] {}
	at java.util.Optional.ifPresent(Optional.java:178) ~[?:?] {}
	at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:201) ~[fmlcore-1.17.1-37.0.44.jar%2377!:?] {}
	at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$11(ModLoader.java:178) ~[fmlcore-1.17.1-37.0.44.jar%2377!:?] {}
	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] {}
	at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:178) ~[fmlcore-1.17.1-37.0.44.jar%2377!:?] {}
	at net.minecraftforge.fmlclient.ClientModLoader.lambda$begin$1(ClientModLoader.java:107) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2373%2379!:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraftforge.fmlclient.ClientModLoader.lambda$createRunnableWithCatch$4(ClientModLoader.java:127) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2373%2379!:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraftforge.fmlclient.ClientModLoader.begin(ClientModLoader.java:107) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2373%2379!:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.<init>(Minecraft.java:461) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:151) ~[forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp.jar%2374!:?] {re:classloading,pl:runtimedistcleaner:A}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[?:?] {}
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
	at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?] {}
	at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:38) ~[fmlloader-1.17.1-37.0.44.jar%233!:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%238!:?] {}
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {}


-- System Details --
Details:
	Minecraft Version: 1.17.1
	Minecraft Version ID: 1.17.1
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 16.0.2, Oracle Corporation
	Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Oracle Corporation
	Memory: 761360384 bytes (726 MiB) / 1350565888 bytes (1288 MiB) up to 2147483648 bytes (2048 MiB)
	CPUs: 6
	Processor Vendor: AuthenticAMD
	Processor Name: AMD Processor model unknown
	Identifier: AuthenticAMD Family 16 Model 10 Stepping 0
	Microarchitecture: K10
	Frequency (GHz): 4,01
	Number of physical packages: 1
	Number of physical CPUs: 6
	Number of logical CPUs: 12
	Graphics card #0 name: AMD Radeon (TM) R9 390X Series
	Graphics card #0 vendor: Advanced Micro Devices, Inc. (0x1002)
	Graphics card #0 VRAM (MB): 8192,00
	Graphics card #0 deviceId: 0x6939
	Graphics card #0 versionInfo: DriverVersion=27.20.20903.8001
	Virtual memory max (MB): 15144,09
	Virtual memory used (MB): 12227,07
	Swap memory total (MB): 30.348,85
	Swap memory used (MB): 799,25
	JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
	ModLauncher: 9.0.7+91+master.8569cdf
	ModLauncher launch target: forgeclientuserdev
	ModLauncher naming: mcp
	ModLauncher services: 
		 eventbus PLUGINSERVICE 
		 object_holder_definalize PLUGINSERVICE 
		 runtime_enum_extender PLUGINSERVICE 
		 capability_inject_definalize PLUGINSERVICE 
		 accesstransformer PLUGINSERVICE 
		 runtimedistcleaner PLUGINSERVICE 
		 fml TRANSFORMATIONSERVICE 
	FML Language Providers: 
		minecraft@1.0
		javafml@null
	Mod List: 
		forge-1.17.1-37.0.44_mapped_official_1.17.1-recomp|Minecraft                     |minecraft                     |1.17.1              |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                         |37.0.44             |COMMON_SET|Manifest: NOSIGNATURE
		main                                              |GWorld                        |gworld                        |0.0.0.102           |ERROR     |Manifest: NOSIGNATURE
	Crash Report UUID: 08751ce5-ac20-4a49-a512-b5af79c03159
	FML: 37.0
	Forge: net.minecraftforge:37.0.44

 

It seems like the error is starting the "GWorldItems" event, but I really don't know how to fix it.

 

My code:

 

The Main:

@Mod(GWorld.modid)
public class GWorld {
    public static final String modid = "gworld";
    private static final Logger LOGGER = LogManager.getLogger("gworld");
    public static final CreativeModeTab gworld = new GWorldTab();

    public GWorld() {
        IEventBus modEventbus = FMLJavaModLoadingContext.get().getModEventBus();

        GWorldBlocks.BLOCKS.register(modEventbus);
        GWorldItems.ITEMS.register(modEventbus);

        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup);

        ModLoadingContext.get().registerConfig(Type.COMMON, GWorldConfig.SPEC, "gworld-common.toml");

        MinecraftForge.EVENT_BUS.register(this);
    }

    private void setup(final FMLCommonSetupEvent event) {
        event.enqueueWork(() -> {
            OreGeneration.registerConfiguredFeatures();
        });
        LOGGER.info("Hello from preinit");
        LOGGER.info("Dirt block >> {}", Blocks.DIRT.getRegistryName());
    }

    @OnlyIn(Dist.CLIENT)
    public void clientSetup(FMLClientSetupEvent event) {
        LOGGER.info("Hello from client setup");
    }

    @SubscribeEvent
    public void serverStarting(FMLServerStartingEvent event) {
        LOGGER.info("Hello from server starting");
    }

    @EventBusSubscriber(bus = Bus.MOD)
    public static class RegistryEvents {
        public RegistryEvents() {
        }

        @SubscribeEvent
        public static void registerBlocks(final RegistryEvent.Register<Block> event) {
            LOGGER.info("Hello from Register Block");
        }

        @SubscribeEvent
        public static void registerItems(final RegistryEvent.Register<Item> event) {
            LOGGER.info("Hello from Register Item");
        }
    }
}

 

 

The GWorldItems:

public class GWorldItems {
    public static final DeferredRegister<Item> ITEMS;

    public static final RegistryObject<AxeItem> KYPTOITE_AXE;
    public static final RegistryObject<Item> KYPTOITE_DUST;
    public static final RegistryObject<Item> KYPTOITE_GEM;
    public static final RegistryObject<Item> KYPTOITE_ORE;
    public static final RegistryObject<PickaxeItem> KYPTOITE_PICKAXE;
    public static final RegistryObject<SwordItem> KYPTOITE_SWORD;

    static {
        ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, "gworld");

        KYPTOITE_AXE = ITEMS.register("kyptoite_axe", () -> {
            return new AxeItem(GWorldTiers.KYPTOITE_TOOL, 5.0F, -3.0F, (new Properties()).tab(GWorld.gworld));
        });
        KYPTOITE_DUST = ITEMS.register("kyptoite_dust", () -> {
            return new Item((new Properties()).tab(GWorld.gworld));
        });
        KYPTOITE_GEM = ITEMS.register("kyptoite_gem", () -> {
            return new Item((new Properties()).tab(GWorld.gworld));
        });
        KYPTOITE_ORE = ITEMS.register("kyptoite_ore", () -> {
            return new BlockItem((Block) GWorldBlocks.KYPTOITE_ORE.get(), (new Properties()).tab(GWorld.gworld));
        });
        KYPTOITE_PICKAXE = ITEMS.register("kyptoite_pickaxe", () -> {
            return new PickaxeItem(GWorldTiers.KYPTOITE_TOOL, 1, -2.8F, (new Properties()).tab(GWorld.gworld));
        });
        KYPTOITE_SWORD = ITEMS.register("kyptoite_sword", () -> {
            return new SwordItem(GWorldTiers.KYPTOITE_TOOL, 3, -2.4F, (new Properties()).tab(GWorld.gworld));
        });
    }
}

 

 

The GWorldTiers:

public enum GWorldTiers implements Tier {
    KYPTOITE_TOOL(5, 2500, 15.0F, 5.0F, 25, () -> {
        return Ingredient.of(new ItemLike[]{(ItemLike) GWorldItems.KYPTOITE_GEM.get()});
    });

    private final int level;
    private final int uses;
    private final float speed;
    private final float damage;
    private final int enchantmentValue;
    private final Ingredient repairIngredient;

    private GWorldTiers(int level, int uses, float speed, float damage, int enchantmentValue, Supplier<Ingredient> repairIngredient) {
        this.level = level;
        this.uses = uses;
        this.speed = speed;
        this.damage = damage;
        this.enchantmentValue = enchantmentValue;
        this.repairIngredient = (Ingredient) repairIngredient.get();
    }

    public int getLevel() {
        return this.level;
    }

    public int getUses() {
        return this.uses;
    }

    public float getSpeed() {
        return this.speed;
    }

    public float getAttackDamageBonus() {
        return this.damage;
    }

    public int getEnchantmentValue() {
        return this.enchantmentValue;
    }

    public Ingredient getRepairIngredient() {
        return this.repairIngredient;
    }
}

 

 

Could someone help me with this error?

Edited by Gianka1485
Solved
Posted (edited)
33 minutes ago, diesieben07 said:

In GWorldTiers you immediately access your registry events and call get on them. This won't work, because the registry events have not necessarily run yet. Your GWorldTiers should instead store the supplier, instead of immediately calling get().

But it only happens with the ax, everything else works fine, the sword, the shovel, the pick, the hoe, I'm going to test what you say, see how it goes ...

Edited by Gianka1485
  • Gianka1485 changed the title to {SOLVED} [1.17.1] (Forge 37.0.44) Minecraft crashes when adding an axe.
Posted (edited)

After doing what diesieben07 said, the problem still continued, so I thought "what if we change the position of the axe variable so that it is not the first to be registered?" and boom, solved ...

Edited by Gianka1485

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.