Started by
An Alien
on
Topic category: Help with Minecraft modding (Java Edition)
Hi.
I wanted to know how can I replace an item with another one when the first one breaks. I also want it to be in the same slot. So for example, if item1 was in the slot 4, the new item is replaced in the slot 4. Or if it was in the offhand (left hand usually), it replaces in the offhand too.
Thank you. :D
Edited by An Alien on Wed, 07/06/2022 - 21:33
Set a global trigger "when item breaks" and check if [provided itemstack] is the item you are looking for. If so, set a new item in whatever slot you want. Most items will break as they are used, so will be in "main-hand". For other types of items, use the appropriate slot.
If you want the replacement item to be a "broken" version of the original you'll want to copy over any NBT tags.
I go over this in a reply to a similar topic here.