Jump to content

Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.world.level.LevelSettings.getLifecycle()" because "this


Recommended Posts

Posted (edited)

I was making my own effect for after an explosion (radiation) but whenever i try to run the game it crashed with this error '        Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.world.level.LevelSettings.getLifecycle()" because "this.settings" is null
 '
Anyone that can help me?

This is my main mod class (NuclearApocalypse.java)

package net.elileo.nuclearapocalypse;

import com.mojang.logging.LogUtils;
import net.elileo.nuclearapocalypse.command.SkipTimerCommand;
import net.elileo.nuclearapocalypse.event.CountdownTimerHandler;
import net.minecraft.client.Minecraft;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.event.server.ServerStartingEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.slf4j.Logger;

@Mod(NuclearApocalypse.MOD_ID)
public class NuclearApocalypse {
    public static final String MOD_ID = "nuclearapocalypse";
    private static final Logger LOGGER = LogUtils.getLogger();

    public NuclearApocalypse() {
        IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();


        // Register common setup and creative tab listeners
        modEventBus.addListener(this::commonSetup);
        modEventBus.addListener(this::addCreative);

        // Register the mod to the global event bus
        MinecraftForge.EVENT_BUS.register(this);
    }

    private void commonSetup(final FMLCommonSetupEvent event) {
        // Common setup logic (if any) can go here
    }

    @SubscribeEvent
    public static void registerCommands(RegisterCommandsEvent event) {
        SkipTimerCommand.register(event.getDispatcher()); // Register the command here
    }

    private void addCreative(BuildCreativeModeTabContentsEvent event) {
        // Your creative tab logic here
    }

    @Mod.EventBusSubscriber(modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
    public static class ClientModEvents {
        @SubscribeEvent
        public static void onClientSetup(FMLClientSetupEvent event) {
            LOGGER.info("HELLO FROM CLIENT SETUP");
            LOGGER.info("MINECRAFT NAME >> {}", Minecraft.getInstance().getUser().getName());
        }
    }
    @Mod.EventBusSubscriber(modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE)
    public static class ModEvents {

        @SubscribeEvent
        public static void onServerStarting(ServerStartingEvent event) {
            // Register commands or other necessary setups here
            SkipTimerCommand.register(event.getServer().getCommands().getDispatcher());



        }

    }
}

This is the error report

---- Minecraft Crash Report ----
// Uh... Did I do that?

Time: 2024-11-01 20:44:02
Description: Rendering screen

java.lang.NullPointerException: Cannot invoke "net.minecraft.world.level.LevelSettings.getLifecycle()" because "this.settings" is null
	at TRANSFORMER/[email protected]/net.minecraft.world.level.storage.LevelSummary.isLifecycleExperimental(LevelSummary.java:281) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.worldselection.WorldSelectionList$WorldListEntry.renderExperimentalWarning(WorldSelectionList.java:457) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.worldselection.WorldSelectionList$WorldListEntry.render(WorldSelectionList.java:406) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.components.AbstractSelectionList.renderItem(AbstractSelectionList.java:447) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.components.AbstractSelectionList.renderListItems(AbstractSelectionList.java:432) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.components.AbstractSelectionList.renderWidget(AbstractSelectionList.java:188) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.worldselection.WorldSelectionList.renderWidget(WorldSelectionList.java:160) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.components.AbstractWidget.render(AbstractWidget.java:65) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.Screen.render(Screen.java:124) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.worldselection.SelectWorldScreen.render(SelectWorldScreen.java:96) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.Screen.renderWithTooltip(Screen.java:112) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraftforge.client.ForgeHooksClient.drawScreenInternal(ForgeHooksClient.java:377) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading}
	at TRANSFORMER/[email protected]/net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:371) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading}
	at TRANSFORMER/[email protected]/net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:888) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.Minecraft.runTick(Minecraft.java:1180) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.Minecraft.run(Minecraft.java:795) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.main.Main.main(Main.java:228) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?] {}
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?] {}
	at SECURE-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:91) ~[fmlloader-1.21-51.0.33.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonLaunchHandler.lambda$makeService$0(CommonLaunchHandler.java:75) ~[fmlloader-1.21-51.0.33.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:77) [modlauncher-10.2.1.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:97) [modlauncher-10.2.1.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:116) [modlauncher-10.2.1.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:75) [modlauncher-10.2.1.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapEntry.main(BootstrapEntry.java:17) [modlauncher-10.2.1.jar!/:?] {}
	at [email protected]/net.minecraftforge.bootstrap.Bootstrap.moduleMain(Bootstrap.java:188) [bootstrap-2.1.3.jar!/:?] {}
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?] {}
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?] {}
	at net.minecraftforge.bootstrap.Bootstrap.bootstrapMain(Bootstrap.java:133) [bootstrap-2.1.3.jar:2.1.3] {}
	at net.minecraftforge.bootstrap.Bootstrap.start(Bootstrap.java:53) [bootstrap-2.1.3.jar:2.1.3] {}
	at net.minecraftforge.bootstrap.ForgeBootstrap.main(ForgeBootstrap.java:19) [bootstrap-2.1.3.jar:2.1.3] {}


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

-- Head --
Thread: Render thread
Suspected Mods: NONE
Stacktrace:
	at TRANSFORMER/[email protected]/net.minecraft.world.level.storage.LevelSummary.isLifecycleExperimental(LevelSummary.java:281) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar%230!/:?] {re:classloading}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.worldselection.WorldSelectionList$WorldListEntry.renderExperimentalWarning(WorldSelectionList.java:457) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar%230!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.worldselection.WorldSelectionList$WorldListEntry.render(WorldSelectionList.java:406) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar%230!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.components.AbstractSelectionList.renderItem(AbstractSelectionList.java:447) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar%230!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.components.AbstractSelectionList.renderListItems(AbstractSelectionList.java:432) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar%230!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.components.AbstractSelectionList.renderWidget(AbstractSelectionList.java:188) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar%230!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.worldselection.WorldSelectionList.renderWidget(WorldSelectionList.java:160) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar%230!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.components.AbstractWidget.render(AbstractWidget.java:65) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar%230!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.Screen.render(Screen.java:124) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar%230!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.worldselection.SelectWorldScreen.render(SelectWorldScreen.java:96) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar%230!/:?] {re:classloading,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.gui.screens.Screen.renderWithTooltip(Screen.java:112) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar%230!/:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraftforge.client.ForgeHooksClient.drawScreenInternal(ForgeHooksClient.java:377) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar%231!/:?] {re:classloading}
	at TRANSFORMER/[email protected]/net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:371) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar%231!/:?] {re:classloading}
-- Screen render details --
Details:
	Screen name: net.minecraft.client.gui.screens.worldselection.SelectWorldScreen
	Mouse location: Scaled: (211, 121). Absolute: (423.000000, 242.000000)
	Screen size: Scaled: (427, 240). Absolute: (854, 480). Scale factor of 2.000000
Stacktrace:
	at TRANSFORMER/[email protected]/net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:888) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.Minecraft.runTick(Minecraft.java:1180) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.Minecraft.run(Minecraft.java:795) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.main.Main.main(Main.java:228) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?] {}
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?] {}
	at SECURE-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:91) ~[fmlloader-1.21-51.0.33.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonLaunchHandler.lambda$makeService$0(CommonLaunchHandler.java:75) ~[fmlloader-1.21-51.0.33.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:77) [modlauncher-10.2.1.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:97) [modlauncher-10.2.1.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:116) [modlauncher-10.2.1.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:75) [modlauncher-10.2.1.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapEntry.main(BootstrapEntry.java:17) [modlauncher-10.2.1.jar!/:?] {}
	at [email protected]/net.minecraftforge.bootstrap.Bootstrap.moduleMain(Bootstrap.java:188) [bootstrap-2.1.3.jar!/:?] {}
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?] {}
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?] {}
	at net.minecraftforge.bootstrap.Bootstrap.bootstrapMain(Bootstrap.java:133) [bootstrap-2.1.3.jar:2.1.3] {}
	at net.minecraftforge.bootstrap.Bootstrap.start(Bootstrap.java:53) [bootstrap-2.1.3.jar:2.1.3] {}
	at net.minecraftforge.bootstrap.ForgeBootstrap.main(ForgeBootstrap.java:19) [bootstrap-2.1.3.jar:2.1.3] {}


-- Uptime --
Details:
	JVM uptime: 24.395s
	Wall uptime: 11.532s
	High-res time: 20.334s
	Client ticks: 160 ticks / 8.000s
Stacktrace:
	at TRANSFORMER/[email protected]/net.minecraft.client.Minecraft.fillReport(Minecraft.java:2376) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.Minecraft.emergencySaveAndCrash(Minecraft.java:856) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.Minecraft.run(Minecraft.java:813) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at TRANSFORMER/[email protected]/net.minecraft.client.main.Main.main(Main.java:228) ~[forge-1.21-51.0.33_mapped_parchment_2024.07.28-1.21.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?] {}
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?] {}
	at SECURE-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:91) ~[fmlloader-1.21-51.0.33.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonLaunchHandler.lambda$makeService$0(CommonLaunchHandler.java:75) ~[fmlloader-1.21-51.0.33.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:77) [modlauncher-10.2.1.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:97) [modlauncher-10.2.1.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:116) [modlauncher-10.2.1.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:75) [modlauncher-10.2.1.jar!/:?] {}
	at SECURE-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapEntry.main(BootstrapEntry.java:17) [modlauncher-10.2.1.jar!/:?] {}
	at [email protected]/net.minecraftforge.bootstrap.Bootstrap.moduleMain(Bootstrap.java:188) [bootstrap-2.1.3.jar!/:?] {}
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?] {}
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?] {}
	at net.minecraftforge.bootstrap.Bootstrap.bootstrapMain(Bootstrap.java:133) [bootstrap-2.1.3.jar:2.1.3] {}
	at net.minecraftforge.bootstrap.Bootstrap.start(Bootstrap.java:53) [bootstrap-2.1.3.jar:2.1.3] {}
	at net.minecraftforge.bootstrap.ForgeBootstrap.main(ForgeBootstrap.java:19) [bootstrap-2.1.3.jar:2.1.3] {}


-- Last reload --
Details:
	Reload number: 1
	Reload reason: initial
	Finished: Yes
	Packs: vanilla, mod_resources

-- System Details --
Details:
	Minecraft Version: 1.21
	Minecraft Version ID: 1.21
	Operating System: Windows 11 (amd64) version 10.0
	Java Version: 21.0.4, Eclipse Adoptium
	Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Eclipse Adoptium
	Memory: 182419192 bytes (173 MiB) / 570425344 bytes (544 MiB) up to 7973371904 bytes (7604 MiB)
	CPUs: 24
	Processor Vendor: GenuineIntel
	Processor Name: 13th Gen Intel(R) Core(TM) i7-13700HX
	Identifier: Intel64 Family 6 Model 191 Stepping 2
	Microarchitecture: unknown
	Frequency (GHz): 2.30
	Number of physical packages: 1
	Number of physical CPUs: 16
	Number of logical CPUs: 24
	Graphics card #0 name: NVIDIA GeForce RTX 4070 Laptop GPU
	Graphics card #0 vendor: NVIDIA
	Graphics card #0 VRAM (MiB): 8188.00
	Graphics card #0 deviceId: VideoController1
	Graphics card #0 versionInfo: 32.0.15.5613
	Graphics card #1 name: Intel(R) UHD Graphics
	Graphics card #1 vendor: Intel Corporation
	Graphics card #1 VRAM (MiB): 1024.00
	Graphics card #1 deviceId: VideoController2
	Graphics card #1 versionInfo: 31.0.101.4502
	Memory slot #0 capacity (MiB): 16384.00
	Memory slot #0 clockSpeed (GHz): 4.80
	Memory slot #0 type: Unknown
	Memory slot #1 capacity (MiB): 16384.00
	Memory slot #1 clockSpeed (GHz): 4.80
	Memory slot #1 type: Unknown
	Virtual memory max (MiB): 33357.49
	Virtual memory used (MiB): 25194.48
	Swap memory total (MiB): 2944.00
	Swap memory used (MiB): 71.45
	Space in storage for jna.tmpdir (MiB): <path not set>
	Space in storage for org.lwjgl.system.SharedLibraryExtractPath (MiB): <path not set>
	Space in storage for io.netty.native.workdir (MiB): <path not set>
	Space in storage for java.io.tmpdir (MiB): available: 520539.13, total: 975714.00
	Space in storage for workdir (MiB): available: 520539.13, total: 975714.00
	JVM Flags: 1 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
	Launched Version: MOD_DEV
	Backend library: LWJGL version 3.3.3+5
	Backend API: NVIDIA GeForce RTX 4070 Laptop GPU/PCIe/SSE2 GL version 4.6.0 NVIDIA 556.13, NVIDIA Corporation
	Window size: 854x480
	GFLW Platform: win32
	GL Caps: Using framebuffer using OpenGL 3.2
	GL debug messages: 
	Is Modded: Definitely; Client brand changed to 'forge'
	Universe: 400921fb54442d18
	Type: Client (map_client.txt)
	Graphics mode: fancy
	Render Distance: 16/16 chunks
	Resource Packs: vanilla, mod_resources
	Current Language: en_us
	Locale: nl_NL
	System encoding: Cp1252
	File encoding: UTF-8
	CPU: 24x 13th Gen Intel(R) Core(TM) i7-13700HX
	ModLauncher: 10.2.1
	ModLauncher launch target: forge_userdev_client
	ModLauncher naming: mcp
	ModLauncher services: 
		/ slf4jfixer PLUGINSERVICE 
		/ runtimedistcleaner PLUGINSERVICE 
		/ runtime_enum_extender PLUGINSERVICE 
		/ object_holder_definalize PLUGINSERVICE 
		/ capability_token_subclass PLUGINSERVICE 
		/ accesstransformer PLUGINSERVICE 
		/ eventbus PLUGINSERVICE 
		/ mixin PLUGINSERVICE 
		/ fml TRANSFORMATIONSERVICE 
		/ mixin TRANSFORMATIONSERVICE 
	FML Language Providers: 
		[email protected]
		lowcodefml@51
		[email protected]
	Mod List: 
		                                                  |Minecraft                     |minecraft                     |1.21                |DONE      |Manifest: NOSIGNATURE
		main                                              |Nuclear Apocalypse            |nuclearapocalypse             |0.1-1.21            |DONE      |Manifest: NOSIGNATURE
		                                                  |Forge                         |forge                         |51.0.33             |DONE      |Manifest: NOSIGNATURE
	Crash Report UUID: 72b70cb9-d9d9-4220-ba2a-5f8cfa704b04
	FML: 0.0
	Forge: net.minecraftforge:51.0.33

 

 

 

 

Edited by Elileo28
  • Elileo28 changed the title to Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.world.level.LevelSettings.getLifecycle()" because "this

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I know that this may be a basic question, but I am very new to modding. I am trying to have it so that I can create modified Vanilla loot tables that use a custom enchantment as a condition (i.e. enchantment present = item). However, I am having trouble trying to implement this; the LootItemRandomChanceWithEnchantedBonusCondition constructor needs a Holder<Enchantment> and I am unable to use the getOrThrow() method on the custom enchantment declared in my mod's enchantments class. Here is what I have so far in the GLM:   protected void start(HolderLookup.Provider registries) { HolderLookup.RegistryLookup<Enchantment> registrylookup = registries.lookupOrThrow(Registries.ENCHANTMENT); LootItemRandomChanceWithEnchantedBonusCondition lootItemRandomChanceWithEnchantedBonusCondition = new LootItemRandomChanceWithEnchantedBonusCondition(0.0f, LevelBasedValue.perLevel(0.07f), registrylookup.getOrThrow(*enchantment here*)); this.add("nebu_from_deepslate", new AddItemModifier(new LootItemCondition[]{ LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.DEEPSLATE).build(), LootItemRandomChanceCondition.randomChance(0.25f).build(), lootItemRandomChanceWithEnchantedBonusCondition }, OrichalcumItems.NEBU.get())); }   Inserting Enchantments.[vanilla enchantment here] actually works but trying to declare an enchantment from my custom enchantments class as [mod enchantment class].[custom enchantment] does not work even though they are both a ResourceKey and are registered in Registries.ENCHANTMENT. Basically, how would I go about making it so that a custom enchantment declared as a ResourceKey<Enchantment> of value ResourceKey.create(Registries.ENCHANTMENT, ResourceLocation.fromNamespaceAndPath([modid], [name])), declared in a seperate enchantments class, can be used in the LootItemRandomChanceWithEnchantedBonusCondition constructor as a Holder? I can't use getOrThrow() because there is no level or block entity/entity in the start() method and it is running as datagen. It's driving me nuts.
    • Hi here is an update. I was able to fix the code so my mod does not crash Minecraft. Please understand that I am new to modding but I honestly am having a hard time understanding how anyone can get this to work without having extensive programming and debugging experience as well as searching across the Internet, multiple gen AI bots (claude, grok, openai), and examining source code hidden in the gradle directory and in various github repositories. I guess I am wrong because clearly there are thousands of mods so maybe I am just a newbie. Ok, rant over, here is a step by step summary so others can save the 3 days it took me to figure this out.   1. First, I am using forge 54.1.0 and Minecraft 1.21.4 2. I am creating a mod to add a shotgun to Minecraft 3. After creating the mod and compiling it, I installed the .jar file to the proper directory in Minecraft and used 1.21.4-forge-54.1.0 4. The mod immediately crashed with the error: Caused by: java.lang.NullPointerException: Item id not set 5. Using the stack trace, I determined that the Exception was being thrown from the net.minecraft.world.item.Item.Properties class 6. It seems that there are no javadocs for this class, so I used IntelliJ which was able to provide a decompiled version of the class, which I then examined to see the source of the error. Side question: Are there javadocs? 7. This method, specifically, was the culprit: protected String effectiveDescriptionId() {      return this.descriptionId.get(Objects.requireNonNull(this.id, "Item id not set"));  } 8. Now my quest was to determine how to set this.id. Looking at the same source file, I determined there was another method:  public Item.Properties setId(ResourceKey<Item> pId) {             this.id = pId;             return this;   } 9. So now, I need to figure out how to call setId(). This required working backwards a bit. Starting from the constructor, I stubbed out the variable p which is of type Item.Properties public static final RegistryObject<Item> SHOTGUN = ITEMS.register("shotgun", () -> new ShotgunItem(p)); Rather than putting this all on one line, I split it up for readability like this: private static final Item.Properties p = new Item.Properties().useItemDescriptionPrefix().setId(rk); Here is was the missing function, setId(), which takes a type of ResourceKey<Item>. My next problem is that due to the apparent lack of documentation (I tried searching the docs on this site) I could not determine the full import path to ResourceKey. I did some random searching on the Internet and stumbled across a Github repository which gave two clues: import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; Then I created the rk variable like this: private static ResourceKey<Item> rk = ResourceKey.create(Registries.ITEM, ResourceLocation.parse("modid:shotgunmod")); And now putting it all together in order: private static ResourceKey<Item> rk = ResourceKey.create(Registries.ITEM, ResourceLocation.parse("modid:shotgunmod")); private static final Item.Properties p = new Item.Properties().useItemDescriptionPrefix().setId(rk); public static final RegistryObject<Item> SHOTGUN = ITEMS.register("shotgun", () -> new ShotgunItem(p)); This compiled and the mod no longer crashes. I still have more to do on it, but hopefully this will save someone hours. I welcome any feedback and if I missed some obvious modding resource or tutorial that has this information. If not, I might suggest we add it somewhere for people trying to write a mod that doesn't crash. Thank you !!!  
    • I will keep adding to this thread with more information in case anyone can help, or at the very least I can keep my troubleshooting organized. I decided to downgrade to 54.1.0 in the hopes that this would fix the issue but it didn't. At least now I am on a "recommended" version. The crash report did confirm my earlier post that the Exception is coming from effectiveDescriptionId(). I'll continue to see if I can find a way to set the ID manually.   Caused by: java.lang.NullPointerException: Item id not set         at java.base/java.util.Objects.requireNonNull(Objects.java:259) ~[?:?]         at TRANSFORMER/[email protected]/net.minecraft.world.item.Item$Properties.effectiveDescriptionId(Item.java:465) ~[forge-1.21.4-54.1.0-client.jar!/:?]         at TRANSFORMER/[email protected]/net.minecraft.world.item.Item.<init>(Item.java:111) ~[forge-1.21.4-54.1.0-client.jar!/:?]         at TRANSFORMER/[email protected]/com.example.shotgunmod.ShotgunItem.<init>(ShotgunItem.java:19) ~[shotgunmod-1.0.0.jar!/:1.0.0]         at TRANSFORMER/[email protected]/com.example.shotgunmod.ModItems.lambda$static$0(ModItems.java:15) ~[shotgunmod-1.0.0.jar!/:1.0.0]         at TRANSFORMER/[email protected]/net.minecraftforge.registries.DeferredRegister$EventDispatcher.lambda$handleEvent      
    • It just randomly stop working after a rebooted my dedicated server PLEASE HELP!   com.google.gson   Failed to start the minecraft server com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonObject but was com.google.gson.JsonPrimitive; at path $  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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