replace an item but keep the old durabity on the new item

Started by joab_ruben on Wed, 12/02/2020 - 03:15

Topic category: Help with modding (Java Edition)

Last seen on 23:15, 15. Dec 2020
Joined Dec 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
replace an item but keep the old durabity on the new item
Wed, 12/02/2020 - 03:15

so my problem is the following, i wanted to create a crossbow like the vanilla one, so i created an item with a procedure that when you right-click it replaces itself with a version with a new texture to make the illusion of animation then o the final one if you right-click again it will shoot an arrow via the procedure and replace itself again with a unload version and it works great and looks just like a vanilla crossbow,(i made a 3d to make it center on the screen like the vanilla one) but I also wanted to make that every time you fire an arrow it deal one damage to the item and so consumes 1 durability and it would work but as I'm replacing a crossbow for another item to create animation effect the health of the old item is also replaced so I can't make it to both have animation and changing/store loaded effect and keep the item durability every time it replaces itself, so how could I make a health value that is keeping throughout all the replacing and firing process?