Posted October 25, 20177 yr Hello, I am new to modding in Minecraft. After creating a few test blocks and a TileEntity I wanted to test my mod to see if things were working alright. However when I loaded up the game in Eclipse the game crashed and I got this error, and I cannot figure out what the problem is: ---- Minecraft Crash Report ---- // Hey, that tickles! Hehehe! Time: 10/24/17 8:31 PM Description: Initializing game java.lang.NullPointerException: Initializing game at com.benthom123.test.proxy.CommonProxy.registerItems(CommonProxy.java:52) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_5_CommonProxy_registerItems_Register.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:143) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179) at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:741) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:603) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:266) at net.minecraft.client.Minecraft.init(Minecraft.java:513) at net.minecraft.client.Minecraft.run(Minecraft.java:421) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace: at com.benthom123.test.proxy.CommonProxy.registerItems(CommonProxy.java:52) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_5_CommonProxy_registerItems_Register.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:143) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179) at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:741) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:603) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:266) at net.minecraft.client.Minecraft.init(Minecraft.java:513) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:421) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) -- System Details -- Details: Minecraft Version: 1.12.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_151, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 805540112 bytes (768 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP 9.42 Powered by Forge 14.23.0.2515 5 mods loaded, 5 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored | State | ID | Version | Source | Signature | |:----- |:--------- |:------------ |:-------------------------------- |:--------- | | UCH | minecraft | 1.12.2 | minecraft.jar | None | | UCH | mcp | 9.42 | minecraft.jar | None | | UCH | FML | 8.0.99.99 | forgeSrc-1.12.2-14.23.0.2515.jar | None | | UCH | forge | 14.23.0.2515 | forgeSrc-1.12.2-14.23.0.2515.jar | None | | UCH | btm | 0.0.1 | bin | None | Loaded coremods (and transformers): GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 385.41' Renderer: 'GeForce GTX 1080 Ti/PCIe/SSE2' Launched Version: 1.12.2 LWJGL: 2.9.4 OpenGL: GeForce GTX 1080 Ti/PCIe/SSE2 GL version 4.5.0 NVIDIA 385.41, NVIDIA Corporation GL Caps: Using GL 1.3 multitexturing. Using GL 1.3 texture combiners. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Shaders are available because OpenGL 2.1 is supported. VBOs are available because OpenGL 1.5 is supported. Using VBOs: Yes Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: Current Language: English (US) Profiler Position: N/A (disabled) CPU: 8x Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz It should be noted that I am following this tutorial to learn to mod: https://wiki.mcjty.eu/modding/index.php/Main_Page I believe the problem is in CommonProxy, so here is what that looks like: package com.benthom123.test.proxy; import java.io.File; import com.benthom123.test.Config; import com.benthom123.test.ModBlocks; import com.benthom123.test.ModItems; import com.benthom123.test.modClass; import com.benthom123.test.blocks.FirstBlock; import com.benthom123.test.blocks.datablock.DataTileEntity; import com.benthom123.test.items.FirstItem; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry; @Mod.EventBusSubscriber public class CommonProxy { // Config instance public static Configuration config; public void preInit(FMLPreInitializationEvent e) { File directory = e.getModConfigurationDirectory(); config = new Configuration(new File(directory.getPath(), "modtut.cfg")); Config.readConfig(); } public void init(FMLInitializationEvent e) { if (config.hasChanged()) { config.save(); } } public void postInit(FMLPostInitializationEvent e) { } @SubscribeEvent public static void registerBlocks(RegistryEvent.Register<Block> event) { event.getRegistry().register(new FirstBlock()); GameRegistry.registerTileEntity(DataTileEntity.class, modClass.MODID + "_datablock"); } @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { event.getRegistry().register(new ItemBlock(ModBlocks.SmoothObsidian).setRegistryName(ModBlocks.SmoothObsidian.getRegistryName())); event.getRegistry().register(new FirstItem()); event.getRegistry().register(new ItemBlock(ModBlocks.dataBlock).setRegistryName(ModBlocks.dataBlock.getRegistryName())); } } if another class is the issue, here is the entire project on GitHub: https://github.com/InterdimensionalCat/src Any help would be appreciated! EDIT: It looks like this line of code specifically in CommonProxy is the issue: event.getRegistry().register(new ItemBlock(ModBlocks.SmoothObsidian).setRegistryName(ModBlocks.SmoothObsidian.getRegistryName())); Edited October 25, 20177 yr by InterdimensionalCat
October 25, 20177 yr public static final String MODID = "btm"; @ObjectHolder("modClass:SmoothObsidian") public static FirstBlock SmoothObsidian; Hmmm Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.