SanaRinomi Posted August 11, 2016 Share Posted August 11, 2016 After some constructive criticism from Draco18s (Sorry if I spelled it wrong) I changed my register for my blocks and items to the GameRegister.register(...) fuction. Now, upon registering the textures for the blocks my game crashes for some reason. Here's extra info if you need it. Crash Report: ---- Minecraft Crash Report ---- // Why is it breaking Time: 11/08/16 18:16 Description: Initializing game java.lang.NullPointerException: Initializing game at net.minecraftforge.client.model.ModelLoader.setCustomModelResourceLocation(ModelLoader.java:1094) at com.holydevils.client.render.blocks.BlockRenderRegistry.regBlockTexture(BlockRenderRegistry.java:22) at com.holydevils.client.render.blocks.BlockRenderRegistry.registerBlockRenderer(BlockRenderRegistry.java:14) at com.holydevils.main.ClientProxy.registerRenderInfo(ClientProxy.java:13) at com.holydevils.main.MainRegistry.preLoad(MainRegistry.java:32) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:579) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:235) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:213) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:593) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:255) at net.minecraft.client.Minecraft.startGame(Minecraft.java:477) at net.minecraft.client.Minecraft.run(Minecraft.java:386) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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 net.minecraftforge.client.model.ModelLoader.setCustomModelResourceLocation(ModelLoader.java:1094) at com.holydevils.client.render.blocks.BlockRenderRegistry.regBlockTexture(BlockRenderRegistry.java:22) at com.holydevils.client.render.blocks.BlockRenderRegistry.registerBlockRenderer(BlockRenderRegistry.java:14) at com.holydevils.main.ClientProxy.registerRenderInfo(ClientProxy.java:13) at com.holydevils.main.MainRegistry.preLoad(MainRegistry.java:32) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:579) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:235) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:213) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:593) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:255) at net.minecraft.client.Minecraft.startGame(Minecraft.java:477) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:386) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) -- System Details -- Details: Minecraft Version: 1.10.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.8.0_91, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 712786512 bytes (679 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.32 Powered by Forge 12.18.1.2011 4 mods loaded, 4 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCH mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) UCH FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.1.2011.jar) UCH Forge{12.18.1.2011} [Minecraft Forge] (forgeSrc-1.10.2-12.18.1.2011.jar) UCE morethingsmod{v0.05} [More Things Mod] (bin) Loaded coremods (and transformers): GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.5.13447 Compatibility Profile Context 16.300.2311.0' Renderer: 'AMD Radeon R7 200 Series' Launched Version: 1.10.2 LWJGL: 2.9.4 OpenGL: AMD Radeon R7 200 Series GL version 4.5.13447 Compatibility Profile Context 16.300.2311.0, ATI Technologies Inc. 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 (United Kingdom) Profiler Position: N/A (disabled) CPU: 8x AMD FX(tm)-8350 Eight-Core Processor Block Texture Render class: package com.holydevils.client.render.blocks; import com.holydevils.blocks.ModBlocks; import com.holydevils.items.ModItems; import com.holydevils.lib.StringReferences; import net.minecraft.block.Block; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.client.model.ModelLoader; public class BlockRenderRegistry { public static void registerBlockRenderer(){ regBlockTexture(ModBlocks.industrializedWood); regBlockTexture(ModBlocks.purpleGlowstone); regBlockTexture(ModBlocks.hardenedIndustrializedWood); } public static String modid = StringReferences.MODID; public static void regBlockTexture(Block block) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory")); } } ModBlocks class: package com.holydevils.blocks; import com.holydevils.items.ModItems; import com.holydevils.main.MTCreativeTabs; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry; public class ModBlocks { public static Block industrializedWood; public static Block purpleGlowstone; public static Block hardenedIndustrializedWood; public static void createBlocks(){ regBlocks(industrializedWood = new BasicBlocks("industrializedWood", Material.WOOD, 1.0F, 5.0F, "axe", 0), "industrializedWood"); regBlocks(hardenedIndustrializedWood = new BasicBlocks("hardenedIndustrializedWood", Material.WOOD, 20.0F, 150.0F, "axe", 2), "hardenedIndustrializedWood"); regBlocks(purpleGlowstone = new SpecialBlocks("purpleGlowstone", Material.GLASS, MTCreativeTabs.tabMoreThingsBlocks, 0.5F, 2.5F, 16, 0.9F, "pickaxe", 0, ModItems.purpleGlowstoneDust, 0, 2, 4), "purpleGlowstone"); } public static void regBlocks(Block block, String name){ GameRegistry.register(block.setRegistryName(name)); } } BasicBlock class: package com.holydevils.blocks; import com.holydevils.lib.StringReferences; import com.holydevils.main.MTCreativeTabs; import net.minecraft.block.Block; import net.minecraft.block.material.Material; public class BasicBlocks extends Block{ public BasicBlocks(String name, Material material, float hardness, float resistance, int opacity, int lightLevel, String toolClass, int toolLevel, boolean shouldTick) { super(material); this.setUnlocalizedName(name); this.setCreativeTab(MTCreativeTabs.tabMoreThingsBlocks); this.setHardness(hardness); this.setResistance(resistance); this.setLightOpacity(opacity); this.setLightLevel(lightLevel); this.setHarvestLevel(toolClass, toolLevel); this.setTickRandomly(shouldTick); } public BasicBlocks(String name, Material material, float hardness, float resistance, int opacity, float lightLevel, String toolClass, int toolLevel) { super(material); this.setUnlocalizedName(name); this.setCreativeTab(MTCreativeTabs.tabMoreThingsBlocks); this.setHardness(hardness); this.setResistance(resistance); this.setLightOpacity(opacity); this.setLightLevel(lightLevel); this.setHarvestLevel(toolClass, toolLevel); } public BasicBlocks(String name, Material material, float hardness, float resistance, String toolClass, int toolLevel) { super(material); this.setUnlocalizedName(name); this.setCreativeTab(MTCreativeTabs.tabMoreThingsBlocks); this.setHardness(hardness); this.setResistance(resistance); this.setHarvestLevel(toolClass, toolLevel); } public BasicBlocks(String name, Material material, String toolClass, int toolLevel) { super(material); this.setUnlocalizedName(name); this.setCreativeTab(MTCreativeTabs.tabMoreThingsBlocks); this.setHarvestLevel(toolClass, toolLevel); } } Quote Link to comment Share on other sites More sharing options...
Matryoshika Posted August 11, 2016 Share Posted August 11, 2016 Where are you calling your BlockRenderRegistry? It must be called client-side only, and after you initialize ModBlocks Quote Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials. Link to comment Share on other sites More sharing options...
SanaRinomi Posted August 11, 2016 Author Share Posted August 11, 2016 Where are you calling your BlockRenderRegistry? It must be called client-side only, and after you initialize ModBlocks I'm calling it from my client proxy. Quote Link to comment Share on other sites More sharing options...
SanaRinomi Posted August 11, 2016 Author Share Posted August 11, 2016 You are most likely trying to register your block models before even creating your Blocks. My proxy is the last piece of code read. Here: Main class: package com.holydevils.main; import com.holydevils.blocks.ModBlocks; import com.holydevils.client.render.items.ItemRenderRegistry; import com.holydevils.items.ModItems; import com.holydevils.lib.StringReferences; import com.holydevils.world.ModWorld; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.SidedProxy; 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.registry.GameRegistry; @Mod(modid = StringReferences.MODID, name =StringReferences.NAME, version =StringReferences.VERSION) public class MainRegistry { @SidedProxy(clientSide = StringReferences.CLIENTPROXY, serverSide = StringReferences.SERVERPROXY) public static ServerProxy proxyServer; public static ModWorld mWorld = new ModWorld(); @EventHandler public static void preLoad(FMLPreInitializationEvent PreEvent){ ModItems.createItems(); ModBlocks.createBlocks(); CraftingManager.craftRegister(); GameRegistry.registerWorldGenerator(mWorld, 1); proxyServer.registerRenderInfo(); } public static void load(FMLInitializationEvent Event){ } public static void postLoad(FMLPostInitializationEvent PostEvent){ } } ServerProxy class: package com.holydevils.main; import com.holydevils.world.ModWorld; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; public class ServerProxy { public void registerRenderInfo(){ } } Client proxy: package com.holydevils.main; import com.holydevils.client.render.blocks.BlockRenderRegistry; import com.holydevils.client.render.items.ItemRenderRegistry; import com.holydevils.world.ModWorld; import net.minecraftforge.fml.common.registry.GameRegistry; public class ClientProxy extends ServerProxy{ @Override public void registerRenderInfo(){ ItemRenderRegistry.registerItemRenderer(); BlockRenderRegistry.registerBlockRenderer(); } } Quote Link to comment Share on other sites More sharing options...
SanaRinomi Posted August 11, 2016 Author Share Posted August 11, 2016 Oh... yeah. You are not creating an ItemBlock for any of your Blocks, hence Item.getItemFromBlock returns null. Ok, so will I have to register the the Block and the ItemBlock or just the ItemBlock? EDIT: Let me refrase that, how on earth do I fix this? Quote Link to comment Share on other sites More sharing options...
Draco18s Posted August 11, 2016 Share Posted August 11, 2016 To clarify: you need to register both. The old 'registerBlock' method automatically created an itemblock for you, but not any more (allowing for technical blocks). Just create a new instance of the ItemBlock and give it the same registry name as your block. Quote 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. Link to comment Share on other sites More sharing options...
SanaRinomi Posted August 11, 2016 Author Share Posted August 11, 2016 Both. It's still crashes... just for different reasons... Of which I don't know of. Here's the crash report: ---- Minecraft Crash Report ---- // Oh - I know what I did wrong! Time: 11/08/16 22:32 Description: Initializing game java.lang.NullPointerException: Initializing game at net.minecraftforge.fml.common.registry.GameData$ItemCallbacks.onAdd(GameData.java:324) at net.minecraftforge.fml.common.registry.GameData$ItemCallbacks.onAdd(GameData.java:313) at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.addObjectRaw(FMLControlledNamespacedRegistry.java:586) at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.add(FMLControlledNamespacedRegistry.java:484) at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.register(FMLControlledNamespacedRegistry.java:822) at net.minecraftforge.fml.common.registry.GameData.register_impl(GameData.java:250) at net.minecraftforge.fml.common.registry.GameRegistry.register(GameRegistry.java:153) at com.holydevils.blocks.ModBlocks.regBlocks(ModBlocks.java:29) at com.holydevils.blocks.ModBlocks.createBlocks(ModBlocks.java:22) at com.holydevils.main.MainRegistry.preLoad(MainRegistry.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:579) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:235) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:213) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:593) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:255) at net.minecraft.client.Minecraft.startGame(Minecraft.java:477) at net.minecraft.client.Minecraft.run(Minecraft.java:386) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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 net.minecraftforge.fml.common.registry.GameData$ItemCallbacks.onAdd(GameData.java:324) at net.minecraftforge.fml.common.registry.GameData$ItemCallbacks.onAdd(GameData.java:313) at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.addObjectRaw(FMLControlledNamespacedRegistry.java:586) at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.add(FMLControlledNamespacedRegistry.java:484) at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.register(FMLControlledNamespacedRegistry.java:822) at net.minecraftforge.fml.common.registry.GameData.register_impl(GameData.java:250) at net.minecraftforge.fml.common.registry.GameRegistry.register(GameRegistry.java:153) at com.holydevils.blocks.ModBlocks.regBlocks(ModBlocks.java:29) at com.holydevils.blocks.ModBlocks.createBlocks(ModBlocks.java:22) at com.holydevils.main.MainRegistry.preLoad(MainRegistry.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:579) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:235) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:213) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:593) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:255) at net.minecraft.client.Minecraft.startGame(Minecraft.java:477) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:386) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) -- System Details -- Details: Minecraft Version: 1.10.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.8.0_91, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 741413096 bytes (707 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.32 Powered by Forge 12.18.1.2011 4 mods loaded, 4 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCH mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) UCH FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.1.2011.jar) UCH Forge{12.18.1.2011} [Minecraft Forge] (forgeSrc-1.10.2-12.18.1.2011.jar) UCE morethingsmod{v0.05} [More Things Mod] (bin) Loaded coremods (and transformers): GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.5.13447 Compatibility Profile Context 16.300.2311.0' Renderer: 'AMD Radeon R7 200 Series' Launched Version: 1.10.2 LWJGL: 2.9.4 OpenGL: AMD Radeon R7 200 Series GL version 4.5.13447 Compatibility Profile Context 16.300.2311.0, ATI Technologies Inc. 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 (United Kingdom) Profiler Position: N/A (disabled) CPU: 8x AMD FX(tm)-8350 Eight-Core Processor And here's the ModBlocks class: package com.holydevils.blocks; import com.holydevils.items.ModItems; import com.holydevils.main.MTCreativeTabs; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraftforge.fml.common.registry.GameRegistry; public class ModBlocks { public static Block industrializedWood; public static Block purpleGlowstone; public static Block hardenedIndustrializedWood; public static ItemBlock industrializedWoodItem; public static ItemBlock purpleGlowstoneItem; public static ItemBlock hardenedIndustrializedWoodItem; public static void createBlocks(){ regBlocks(industrializedWoodItem = new ItemBlock(industrializedWood),industrializedWood = new BasicBlocks("industrializedWood", Material.WOOD, 1.0F, 5.0F, "axe", 0)); regBlocks(hardenedIndustrializedWoodItem = new ItemBlock(hardenedIndustrializedWood),hardenedIndustrializedWood = new BasicBlocks("hardenedIndustrializedWood", Material.WOOD, 20.0F, 150.0F, "axe", 2)); regBlocks(purpleGlowstoneItem = new ItemBlock(purpleGlowstone),purpleGlowstone = new SpecialBlocks("purpleGlowstone", Material.GLASS, MTCreativeTabs.tabMoreThingsBlocks, 0.5F, 2.5F, 16, 0.9F, "pickaxe", 0, ModItems.purpleGlowstoneDust, 0, 2, 4)); } public static void regBlocks(ItemBlock IBlock, Block block){ GameRegistry.register(block.setRegistryName(block.getUnlocalizedName().substring(5))); GameRegistry.register(IBlock.setRegistryName(block.getRegistryName())); } } EDIT: It will still crash the same way even if I change GameRegistry.register(IBlock.setRegistryName(block.getRegistryName())); to GameRegistry.register(IBlock.setRegistryName(block.getUnlocalizedName().substring(5))); Quote Link to comment Share on other sites More sharing options...
SanaRinomi Posted August 11, 2016 Author Share Posted August 11, 2016 You are trying to use the fields that store your block instance (e.g. industrializedWood ) before you initialize them. Also I think you need to register the Block before the ItemBlock. Crash Report... ---- Minecraft Crash Report ---- // Surprise! Haha. Well, this is awkward. Time: 11/08/16 22:46 Description: Initializing game java.lang.NullPointerException: Initializing game at net.minecraftforge.fml.common.registry.GameData$ItemCallbacks.onAdd(GameData.java:324) at net.minecraftforge.fml.common.registry.GameData$ItemCallbacks.onAdd(GameData.java:313) at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.addObjectRaw(FMLControlledNamespacedRegistry.java:586) at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.add(FMLControlledNamespacedRegistry.java:484) at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.register(FMLControlledNamespacedRegistry.java:822) at net.minecraftforge.fml.common.registry.GameData.register_impl(GameData.java:250) at net.minecraftforge.fml.common.registry.GameRegistry.register(GameRegistry.java:153) at com.holydevils.blocks.ModBlocks.regBlocks(ModBlocks.java:30) at com.holydevils.blocks.ModBlocks.createBlocks(ModBlocks.java:23) at com.holydevils.main.MainRegistry.preLoad(MainRegistry.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:579) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:235) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:213) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:593) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:255) at net.minecraft.client.Minecraft.startGame(Minecraft.java:477) at net.minecraft.client.Minecraft.run(Minecraft.java:386) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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 net.minecraftforge.fml.common.registry.GameData$ItemCallbacks.onAdd(GameData.java:324) at net.minecraftforge.fml.common.registry.GameData$ItemCallbacks.onAdd(GameData.java:313) at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.addObjectRaw(FMLControlledNamespacedRegistry.java:586) at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.add(FMLControlledNamespacedRegistry.java:484) at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.register(FMLControlledNamespacedRegistry.java:822) at net.minecraftforge.fml.common.registry.GameData.register_impl(GameData.java:250) at net.minecraftforge.fml.common.registry.GameRegistry.register(GameRegistry.java:153) at com.holydevils.blocks.ModBlocks.regBlocks(ModBlocks.java:30) at com.holydevils.blocks.ModBlocks.createBlocks(ModBlocks.java:23) at com.holydevils.main.MainRegistry.preLoad(MainRegistry.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:579) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:235) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:213) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:142) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:593) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:255) at net.minecraft.client.Minecraft.startGame(Minecraft.java:477) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:386) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) -- System Details -- Details: Minecraft Version: 1.10.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.8.0_91, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 742279208 bytes (707 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.32 Powered by Forge 12.18.1.2011 4 mods loaded, 4 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCH mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) UCH FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.1.2011.jar) UCH Forge{12.18.1.2011} [Minecraft Forge] (forgeSrc-1.10.2-12.18.1.2011.jar) UCE morethingsmod{v0.05} [More Things Mod] (bin) Loaded coremods (and transformers): GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.5.13447 Compatibility Profile Context 16.300.2311.0' Renderer: 'AMD Radeon R7 200 Series' Launched Version: 1.10.2 LWJGL: 2.9.4 OpenGL: AMD Radeon R7 200 Series GL version 4.5.13447 Compatibility Profile Context 16.300.2311.0, ATI Technologies Inc. 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 (United Kingdom) Profiler Position: N/A (disabled) CPU: 8x AMD FX(tm)-8350 Eight-Core Processor Quote Link to comment Share on other sites More sharing options...
SanaRinomi Posted August 11, 2016 Author Share Posted August 11, 2016 Updated code: package com.holydevils.blocks; import com.holydevils.items.ModItems; import com.holydevils.lib.StringReferences; import com.holydevils.main.MTCreativeTabs; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraftforge.fml.common.registry.GameRegistry; public class ModBlocks { public static Block industrializedWood; public static Block purpleGlowstone; public static Block hardenedIndustrializedWood; public static ItemBlock industrializedWoodItem; public static ItemBlock purpleGlowstoneItem; public static ItemBlock hardenedIndustrializedWoodItem; public static void createBlocks(){ regBlocks(industrializedWoodItem = new ItemBlock(industrializedWood),industrializedWood = new BasicBlocks("industrializedWood", Material.WOOD, 1.0F, 5.0F, "axe", 0)); regBlocks(hardenedIndustrializedWoodItem = new ItemBlock(hardenedIndustrializedWood),hardenedIndustrializedWood = new BasicBlocks("hardenedIndustrializedWood", Material.WOOD, 20.0F, 150.0F, "axe", 2)); regBlocks(purpleGlowstoneItem = new ItemBlock(purpleGlowstone),purpleGlowstone = new SpecialBlocks("purpleGlowstone", Material.GLASS, MTCreativeTabs.tabMoreThingsBlocks, 0.5F, 2.5F, 16, 0.9F, "pickaxe", 0, ModItems.purpleGlowstoneDust, 0, 2, 4)); } public static void regBlocks(ItemBlock IBlock, Block block){ IBlock.setRegistryName(block.getUnlocalizedName().substring(5)); GameRegistry.register(IBlock); GameRegistry.register(block); } } Note: I put IBlock.setRegistryName(block.getUnlocalizedName().substring(5)); because the unlocalizedName (except the tile. part) is the same as the registry name. Quote Link to comment Share on other sites More sharing options...
SanaRinomi Posted August 11, 2016 Author Share Posted August 11, 2016 Well, thanks for the help. <3 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.