How to make item take damage

Discussion in 'Help' started by LyricalLyfes, Sep 24, 2021.

  1. LyricalLyfes

    LyricalLyfes Spider Jockey

    Let's say I have this pickaxe that shows how many blocks you mined in the lore.

    Now in order to update the block mined count, I would have to increment the block mined count and then
    $item->setItemInHand to update the lore.

    The problem here is the item's durability gets reset every time I $item->setItemInHand to update the lore.

    How would I go about making the item get damaged even when I $item->setItemInHand

    I've tried doing $item->setDamage($item->getDamage() - 1) but that would make unbreaking enchant useless

    Attached Files:

  2. Axon

    Axon Zombie

    Can’t you get the item then change the lore?
    Agent likes this.
  3. LyricalLyfes

    LyricalLyfes Spider Jockey

    That’s what I’m doing right now but block break event gets the damage before breaking the block and not the damage after breaking the block so the durability remains the same

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.