Trying to figure out how to repair items

Started by Guacaroni on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Trying to figure out how to repair items

It seems fairly easy. Just put the item in an anvil and set the repair item, but I want to set up a different system. In said system, items will slowly repair, but for free. The problem is, I don't know how to restore durability. Just sacrificing an item and giving a completely new one is the easy way, but that's not what I'm interested in. For example, after a trigger happens, like right-clicking or something, 1 use will be restored to the item in hand. 

Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It can be done with…
Thu, 09/03/2020 - 15:23

It can be done with procedures:

Set durability of itemstack to: get durability of itemstack + 1

Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm not sure why, but it…
Thu, 09/03/2020 - 17:39

I'm not sure why, but it didn't work. I tried it with a wooden shovel initially, but it didn't work. On the off chance it doesn't affect vanilla items, I made an item called test shovel. I destroyed a block with it, making its durability 49 out of 50. I right-clicked blocks, and nothing happened. I am new to this, so I might be missing something obvious.

Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Okay, I found my mistake…
Thu, 09/03/2020 - 17:48

Okay, I found my mistake. Thank you for your help; it works.

Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It doesn't seem to be…
Thu, 09/03/2020 - 19:09

It doesn't seem to be possible with vanilla items, unless I'm missing something. Test shovel works great, but when I change itemstack to a specific item, like the vanilla shovel, there's no effect whatsoever. If it's possible to edit a vanilla item, other than what they drop, I don't know how.

Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nevermind; I figured it out,…
Thu, 09/03/2020 - 21:31

Nevermind; I figured it out, to a certain extent.