April 27, 201510 yr Author IronFile Class: package com.hardwareplus.items; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import com.hardwareplus.creativetabs.MCreativeTabs; import com.hardwareplus.lib.RefStrings; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class IronFile extends Item{ public static void mainRegistry(){ initializeItem(); registerItem(); } public static Item iFile; public boolean doesContainerItemLeaveCraftingGrid(ItemStack stack) { return false; } public boolean hasContainerItem() { return true; } public ItemStack getContainerItem(ItemStack itemStack) { itemStack.attemptDamageItem(1, itemRand); return itemStack; } public static void initializeItem(){ iFile = new Item().setUnlocalizedName("iFile").setMaxDamage(64).setMaxStackSize(1).setNoRepair().setCreativeTab(MCreativeTabs.tabItems).setTextureName(RefStrings.MODID + ":IFile"); } public static void registerItem(){ GameRegistry.registerItem(iFile, iFile.getUnlocalizedName()); } } CraftingManager class: package com.hardwareplus.Main; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; import com.hardwareplus.items.IronFile; import com.hardwareplus.items.IronPlate; import com.hardwareplus.items.IronRod; import cpw.mods.fml.common.registry.GameRegistry; public class CraftingManager { public static void mainRegistry(){ addCraftingRec(); addSmeltingRec(); } public static void addCraftingRec(){ //Iron File GameRegistry.addRecipe(new ItemStack(IronFile.iFile, 1), new Object[]{" P"," P ","R ", 'P', IronPlate.iPlate, 'R', IronRod.iRod}); //Iron Rod GameRegistry.addShapelessRecipe(new ItemStack(IronRod.iRod, 4), new ItemStack(IronPlate.iPlate), new ItemStack(IronFile.iFile, 1)); } public static void addSmeltingRec(){ } } I don't get whats wrong
April 27, 201510 yr Ok, seriously you need to learn how to program Minecraft mods. Why do you initialize your item in your item class? You have to initialize it under the preInit in your main mod file. Please watch some Minecraft Modding tutorials before posting problems like this. I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
April 27, 201510 yr I did.....MChewy....guess he is wrong Item myItem = new Item().setUnlocalizedName("mymod:myitem"); does not equal Item myItem = new MyItem(); 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.
April 27, 201510 yr Draco is right, I didn't even notice it but, you have to set your item equal to the class for the item or anything in that class won't be called. You can't just make a class for an item and not initialize your item variable with it. I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
April 27, 201510 yr Just redo your setup with a video from MrCrayFish or something of the sort. If you give up you shouldn't of started at all. I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
April 27, 201510 yr Author OMFG!!! I DID IT!!! I followed crayfish's tutorial and posted ur code in the item class and used the recipe u posted and it fianlly works!!! it takes the durability!! DUDE i cannot thank you enough man U ARE AWESOME!!! YESSS!!!
April 27, 201510 yr Author This is my new code: Main class: package com.hardwareplus.mod; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = "hardwareplus", name = "Hardware Plus", version = "0.1") public class HardwarePlus { public static Item itemIronPlate; public static Item itemIronRod; public static Item itemIronFile; @EventHandler public void preInit(FMLPreInitializationEvent event) { //Item/Block init and registering //Config Handler itemIronPlate = new ItemIronPlate().setUnlocalizedName("ItemIronPlate").setTextureName("hardwareplus:itemironplate").setCreativeTab(tabHardwarePlus); GameRegistry.registerItem(itemIronPlate, itemIronPlate.getUnlocalizedName().substring(5)); itemIronRod = new ItemIronRod().setUnlocalizedName("ItemIronRod").setTextureName("hardwareplus:itemironrod").setCreativeTab(tabHardwarePlus); GameRegistry.registerItem(itemIronRod, itemIronRod.getUnlocalizedName().substring(5)); itemIronFile = new ItemIronFile().setUnlocalizedName("ItemIronFile").setTextureName("hardwareplus:itemironfile").setCreativeTab(tabHardwarePlus); GameRegistry.registerItem(itemIronFile, itemIronFile.getUnlocalizedName().substring(5)); } @EventHandler public void init(FMLInitializationEvent event) { //Proxy, TileEntity, entity, GUI and packet GameRegistry.addShapelessRecipe(new ItemStack(itemIronRod, 4), new ItemStack(itemIronPlate, 1), new ItemStack(itemIronFile, 1)); } @EventHandler public void PostInit(FMLPostInitializationEvent event) { } public static CreativeTabs tabHardwarePlus = new CreativeTabs("tabHardwarePlus"){ @Override public Item getTabIconItem(){ return new ItemStack(itemIronPlate).getItem(); } }; } IronFile class: package com.hardwareplus.mod; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class ItemIronFile extends Item { public ItemIronFile() { this.setMaxDamage(20); this.setMaxStackSize(1); this.setNoRepair(); } public boolean doesContainerItemLeaveCraftingGrid(ItemStack stack) { return false; } public boolean hasContainerItem() { return true; } public ItemStack getContainerItem(ItemStack itemStack) { itemStack.attemptDamageItem(1, itemRand); return itemStack; } } Your right, you should never give up man Cheers to you!! Thx alot!!!
April 27, 201510 yr No problem! Just remember, when creating code - think like the code is a person you are talking to. I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
April 27, 201510 yr Author Dude...u are suppose to add OreDictionary.WILDCARDVALUE cause just tried it and it now works properly....soooo....but still thx for everything
April 27, 201510 yr Sorry about that! Didn't realize it needed that to work. Glad you figured it out! I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
April 27, 201510 yr Author Actually i just had a hunch that it was the problem and that i needed it And i just made a hammer
April 28, 201510 yr I think my hammer might work a bit differently than yours. I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
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.