Jump to content

Damage item rp2 handaw type


Recommended Posts

Try something like this (it's the same method from vroominator with additional 2 lines):


    public void onCrafting(EntityPlayer player, ItemStack item, IInventory inv) 
        for(int i=0; i < inv.getSizeInventory(); i++)
            if(inv.getStackInSlot(i) != null)
                ItemStack j = inv.getStackInSlot(i);
                if(j.getItem() != null && j.getItem() == Your Item)
                    ItemStack k = new ItemStack(Your Item, 2, (j.getItemDamage() + 1));
                    // these two lines are added by me:
                    if(k.getItemDamage() >= k.getMaxDamage())
                        k = null;
                    inv.setInventorySlotContents(i, k);

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

This topic is now closed to further replies.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.