Posted June 2, 201411 yr Ok so I am trying to make a crafting item for my mod that has 2 tiers. One of the tiers I want 1 durability to be taken from the items durability EXCEPT when I am trying to upgrade it to tier 2. Then I want it to take 5 durability from it. However I am having trouble changing the amount taken based on crafting. Crystal class (item, both tiers are called to this class) package items; import keystuff.myMod; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class Crystals extends Item { public Crystals() { setCreativeTab(myMod.daftcraft); setMaxDamage(5); } @Override public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) { return false; } @Override public ItemStack getContainerItem(ItemStack itemStack) { ItemStack cStack=itemStack.copy(); cStack.setItemDamage(cStack.getItemDamage()+1); cStack.stackSize=1; return cStack; } @Override public boolean hasContainerItem(ItemStack stack) { return stack.getItemDamage()<5; } }//class crafting recipe GameRegistry.addRecipe(new ItemStack(rubyCrystalT2), " D ", "DRD", " D ", 'R',new ItemStack(rubyCrystal,1,OreDictionary.WILDCARD_VALUE), 'D',Items.diamond); setting the items public static Item rubyCrystal; public static Item rubyCrystalT2; rubyCrystalT2=new Crystals().setUnlocalizedName("ruby tier 2"); GameRegistry.registerItem(rubyCrystalT2,"ruby tier 2"); rubyCrystal=new Crystals().setUnlocalizedName("ruby"); GameRegistry.registerItem(rubyCrystal,"ruby"); This uses the code but only reduces durability by 1 for them all. Any helps would be appreciated thanks
June 2, 201411 yr Assuming you use 1.7.2, you should register a listener for ItemCraftedEvent. See wiki for tutorial.
June 2, 201411 yr Author would you be able to send a link? I'm having trouble finding how it works on the wiki. Thanks
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.