Jump to content

Reikenz

Members
  • Posts

    2
  • Joined

  • Last visited

Reikenz's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Small mistake x) When I put a breakpoint on the damage item it does not work Resolved juste im in creative mod...
  2. Hello everyone, I have a small problem my item is working properly, but does not lose durability while I withdraw from it I watched a lot of English subjects without finding the answer. Here is my code: public ItemEffect(String name, int maxDamage, int stackSize, int coolDown, PotionEffect effect) { super(name); this.setMaxDamage(maxDamage); this.setMaxStackSize(stackSize); this.setFull3D(); this.effect = effect; this.coolDown = coolDown; } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { ItemStack itemStack = playerIn.getHeldItemMainhand(); if(worldIn.isRemote) { return new ActionResult<>(EnumActionResult.FAIL, itemStack); } if (!playerIn.inventory.hasItemStack(itemStack)) { return new ActionResult<>(EnumActionResult.FAIL, itemStack); } if (itemStack.getItemDamage() > itemStack.getMaxDamage()) { return new ActionResult<>(EnumActionResult.FAIL, itemStack); } playerIn.addPotionEffect(new PotionEffect(effect.getPotion(), effect.getDuration(), effect.getAmplifier(), effect.getIsAmbient(), effect.doesShowParticles())); playerIn.getCooldownTracker().setCooldown(this, coolDown); itemStack.damageItem(1, playerIn); itemStack.shrink(1); return new ActionResult<>(EnumActionResult.SUCCESS, itemStack); } Thank you in advance to the person who will help me.
×
×
  • Create New...

Important Information

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