Reduce flint and steel durability like on rightclick blocks

Discussion in 'Spigot Plugin Development' started by Script1996, May 15, 2015.

  1. Hey guys,

    I want to reduce the durability of flint and steel like if you right click blocks with fns in hands.

    But this doesn't work:
    item.setDurability((short) -1);

    How can I do this ?
     
  2. Code (Text):
    item.setDurability(item.getdurability-1)
     
  3. @Script1996 durability goes from 0 to max durability, rather than from max durability to 0 (so 0 is unused, max durability is broken / nearly broken). Add one rather than subtracting one.
     
    • Informative Informative x 2
    • Like Like x 1
  4. Thanks! Haha.
     
  5. hello, what i must write to replace "item" ?
     
  6. Did you just necropost a 6 year old thread?

    Its a method available with ItemStack, on 1.16 you need to get the ItemMeta, check if its of Damagable and update that (and update the item meta afterwards.)
     
  7. oh god I came here to find a solution. I didn't notice this was 6 years old
    no necropost pls thanks

    anyways can someone lock this thread