Posted January 1, 201411 yr I've registered recipes as usually: RecipeLoader.class package SackCastellon.craftablehorsearmor.loader; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.registry.GameRegistry; public class RecipeLoader { public static final Item Stirrup = (Item)Item.field_150901_e.getObject("stirrup"); public void load() { Item.field_150901_e.func_148756_a(500, "stirrup", (new Item()).setUnlocalizedName("Stirrup").setCreativeTab(CreativeTabs.tabMisc).setTextureName(Reference.TexturePath + "Stirrup")); } } ItemLoader.class package SackCastellon.craftablehorsearmor.loader; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.registry.GameRegistry; public class RecipeLoader { public static void load() { GameRegistry.addRecipe(new ItemStack(ItemLoader.Stirrup, 2), new Object[] {" I ", "I I", "III", 'I', Items.iron_ingot}); } } Main class package SackCastellon.craftablehorsearmor; import java.io.File; import SackCastellon.core.helper.LogHelper; import SackCastellon.craftablehorsearmor.loader.RecipeLoader; import SackCastellon.craftablehorsearmor.proxy.CommonProxy; import SackCastellon.craftablehorsearmor.reference.Reference; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; @Mod(modid=Reference.MODID, name=Reference.NAME, version=Reference.VERSION, dependencies=Reference.DEPENDENCIES) public class CraftableHorseArmor { @Instance(Reference.MODID) public static CraftableHorseArmor instance; @SidedProxy(clientSide=Reference.CLPROXY, serverSide=Reference.CMPROXY) public static CommonProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event) { // Items LogHelper.info(Reference.MODID, "Loading items."); try { ItemLoader.load(); LogHelper.info(Reference.MODID, "Items succesfully loaded."); } catch(Exception e) { LogHelper.severe(Reference.MODID, "Could not load items."); } } @EventHandler public void load(FMLInitializationEvent event) { // Recipes LogHelper.info(Reference.MODID, "Loading Recipes."); try { RecipeLoader.load(); LogHelper.info(Reference.MODID, "Recipes succesfully loaded."); } catch(Exception e) { LogHelper.severe(Reference.MODID, "Could not load Recipes."); } } @EventHandler public void postInit(FMLPostInitializationEvent event) {} } But when i run minecraft i get this crash: Crash [02:21:35] [Client thread/FATAL]: Reported exception thrown! net.minecraft.util.ReportedException: Rendering item at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1139) ~[EntityRenderer.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:979) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:869) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:103) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_25] at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?] Caused by: java.lang.NullPointerException at net.minecraft.item.ItemStack.getItemDamage(ItemStack.java:231) ~[itemStack.class:?] at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:406) ~[RenderItem.class:?] at net.minecraft.client.renderer.entity.RenderItem.renderItemAndEffectIntoGUI(RenderItem.java:548) ~[RenderItem.class:?] at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:271) ~[GuiContainer.class:?] at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:101) ~[GuiContainer.class:?] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1109) ~[EntityRenderer.class:?] ... 9 more ---- Minecraft Crash Report ---- // Everything's going to plan. No, really, that was supposed to happen. Time: 1/01/14 2:21 Description: Rendering item java.lang.NullPointerException: Rendering item at net.minecraft.item.ItemStack.getItemDamage(ItemStack.java:231) at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:406) at net.minecraft.client.renderer.entity.RenderItem.renderItemAndEffectIntoGUI(RenderItem.java:548) at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:271) at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:101) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1109) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:979) at net.minecraft.client.Minecraft.run(Minecraft.java:869) at net.minecraft.client.main.Main.main(Main.java:103) 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:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraft.item.ItemStack.getItemDamage(ItemStack.java:231) at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:406) -- Item being rendered -- Details: Item Type: null Item Aux: ~~ERROR~~ NullPointerException: null Item NBT: null Item Foil: ~~ERROR~~ NullPointerException: null Stacktrace: at net.minecraft.client.renderer.entity.RenderItem.renderItemAndEffectIntoGUI(RenderItem.java:548) at net.minecraft.client.gui.inventory.GuiContainer.func_146977_a(GuiContainer.java:271) at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:101) -- Screen render details -- Details: Screen name: net.minecraft.client.gui.inventory.GuiCrafting Mouse location: Scaled: (176, 65). Absolute: (353, 348) Screen size: Scaled: (427, 240). Absolute: (854, 480). Scale factor of 2 -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityClientPlayerMP['Player72'/2, l='MpServer', x=743,57, y=58,62, z=517,93]] Chunk stats: MultiplayerChunkCache: 225, 225 Level seed: 0 Level generator: ID 01 - flat, ver 0. Features enabled: false Level generator options: Level spawn location: World: (740,4,514), Chunk: (at 4,0,2 in 46,32; contains blocks 736,0,512 to 751,255,527), Region: (1,1; contains chunks 32,32 to 63,63, blocks 512,0,512 to 1023,255,1023) Level time: 58474 game time, 58474 day time Level dimension: 0 Level storage version: 0x00000 - Unknown? Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false Forced entities: 3 total; [EntitySpider['Spider'/0, l='MpServer', x=718,53, y=56,00, z=531,75], EntitySpider['Spider'/1, l='MpServer', x=737,78, y=56,00, z=496,22], EntityClientPlayerMP['Player72'/2, l='MpServer', x=743,57, y=58,62, z=517,93]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:384) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2430) at net.minecraft.client.Minecraft.run(Minecraft.java:891) at net.minecraft.client.main.Main.main(Main.java:103) 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:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) -- System Details -- Details: Minecraft Version: 1.7.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0_25, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 68640496 bytes (65 MB) / 414646272 bytes (395 MB) up to 878051328 bytes (837 MB) JVM Flags: 0 total; AABB Pool Size: 20006 (1120336 bytes; 1 MB) allocated, 61 (3416 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.01-pre FML v7.2.28.976 Minecraft Forge 10.12.0.976 6 mods loaded, 6 mods active mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.2.28.976} [Forge Mod Loader] (forge-1.7.2-10.12.0.976-mcp.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.12.0.976} [Minecraft Forge] (forge-1.7.2-10.12.0.976-mcp.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available examplemod{1.0} [Example Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available SKC-Core{1.1.0.0} [sKC Core] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available SKC-CraftableHorseArmor{1.1.0.0} [Craftable Horse Armor] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Launched Version: 1.7.2 LWJGL: 2.9.0 OpenGL: Intel(R) HD Graphics GL version 2.1.0 - Build 8.15.10.2827, Intel Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: ~~ERROR~~ NullPointerException: null Profiler Position: N/A (disabled) Vec3 Pool Size: 262 (14672 bytes; 0 MB) allocated, 61 (3416 bytes; 0 MB) used Anisotropic Filtering: Off (1) #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Juanjo hijo\AppData\Roaming\Modding\forge-1.7.2-10.12.0.976-src\.\crash-reports\crash-2014-01-01_02.21.35-client.txt AL lib: (EE) alc_cleanup: 1 device not closed I couldn't find the problem. So hope someone can find it. Thanks for helping and have a happy new year. SOLUTION: Click here: http://www.minecraftforge.net/forum/index.php/topic,15103.msg76893.html#msg76893 Or go to the penultimate message
January 2, 201411 yr I'm unclear as the code changes from 1.6 to 1.7 as far as this or if you left code out for just the post but by looking at what you posted I can see You forgot to put this at the top of your load eventhandler proxy.registerRenderers(); Also another change to help you is how your associating your other files functions. try: ItemLoader: package SackCastellon.craftablehorsearmor.loader; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.registry.GameRegistry; public class ItemLoader { private static ItemStack stirrupStack = new ItemStack(this.Stirrup, 2); private static ItemStack ironStack = new ItemStack(Items.ingot, 1); public static void load() { GameRegistry.addRecipe(stirrupStack ," I ","I I","III", 'I',ironStack); } } Also With that hopefully your already registering the stirrup Item using gameregistry and languageregistry prior to your recipe registry below would be how you bring it into your load event. package SackCastellon.craftablehorsearmor; import java.io.File; import SackCastellon.core.helper.LogHelper; import SackCastellon.craftablehorsearmor.loader.RecipeLoader; import SackCastellon.craftablehorsearmor.proxy.CommonProxy; import SackCastellon.craftablehorsearmor.reference.Reference; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; @Mod(modid=Reference.MODID, name=Reference.NAME, version=Reference.VERSION, dependencies=Reference.DEPENDENCIES) public class CraftableHorseArmor { @Instance(Reference.MODID) public static CraftableHorseArmor instance; @SidedProxy(clientSide=Reference.CLPROXY, serverSide=Reference.CMPROXY) public static CommonProxy proxy; public static ItemLoader registerItems = new ItemLoader (); @EventHandler public void preInit(FMLPreInitializationEvent event) {} @EventHandler public void load(FMLInitializationEvent event) { proxy.registerRenderers(); // Items registerItems.load(); } @EventHandler public void postInit(FMLPostInitializationEvent event) {} }
January 2, 201411 yr I get recipes work in my mod. Code is below GameRegistry.addRecipe(new ItemStack(mysimpletool, 1), new Object[]{ "XXX", " # ", " # ", ('X'), Items.apple, ('#'), Items.coal}); mysimple tool is described in main class of mod public static Item mysimpletool; and in preInit in mainclass mysimpletool = new ItemMySimpleTool().setUnlocalizedName("mysimpletool"); P.S. I would appreciate if you say me how to register textures [spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here [spoiler=Spoiler]And here too [spoiler=Spoiler]But that image is pretty good
January 2, 201411 yr Author I get recipes work in my mod. Code is below GameRegistry.addRecipe(new ItemStack(mysimpletool, 1), new Object[]{ "XXX", " # ", " # ", ('X'), Items.apple, ('#'), Items.coal}); mysimple tool is described in main class of mod public static Item mysimpletool; and in preInit in mainclass mysimpletool = new ItemMySimpleTool().setUnlocalizedName("mysimpletool"); P.S. I would appreciate if you say me how to register textures Thanks, it works
January 3, 201411 yr I get recipes work in my mod. Code is below GameRegistry.addRecipe(new ItemStack(mysimpletool, 1), new Object[]{ "XXX", " # ", " # ", ('X'), Items.apple, ('#'), Items.coal}); mysimple tool is described in main class of mod public static Item mysimpletool; and in preInit in mainclass mysimpletool = new ItemMySimpleTool().setUnlocalizedName("mysimpletool"); P.S. I would appreciate if you say me how to register textures That should work public static Item mysimpletool; mysimpletool = new ItemMySimpleTool().setUnlocalizedName("mysimpletool").setTextureName("yourmodid:mysimpletool"); GameRegistry.registerItem(mysimpletool, "mysimpletool");
January 3, 201411 yr Author I get recipes work in my mod. Code is below GameRegistry.addRecipe(new ItemStack(mysimpletool, 1), new Object[]{ "XXX", " # ", " # ", ('X'), Items.apple, ('#'), Items.coal}); mysimple tool is described in main class of mod public static Item mysimpletool; and in preInit in mainclass mysimpletool = new ItemMySimpleTool().setUnlocalizedName("mysimpletool"); P.S. I would appreciate if you say me how to register textures That should work public static Item mysimpletool; mysimpletool = new ItemMySimpleTool().setUnlocalizedName("mysimpletool").setTextureName("yourmodid:mysimpletool"); GameRegistry.registerItem(mysimpletool, "mysimpletool"); Yes, it works, but i already used it
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.