Topic category: Help with Minecraft modding (Java Edition)
Hey guys, how are you?
So, I'm trying to create an oxidizing procedure for a copper sword for a mod I'm developing, and I've successfully managed to create the oxidation by changing one item for another within the procedures. However, I've realized that people can even enchant or change the item name before it is changed to another, and I've been trying to copy them into the new item, but I haven't had any success so far.
Could someone help me here?
The thing is: After some time, the copper sword oxidizes and turns into an oxidized copper sword, but it doesn't keep the original Copper Sword NBTs such as enchantments and name.
(for now i'm using the right click button trigger on item, as an action for testing)
hey did you find how to do it?
i need this
I think you would need to create a local itemstack variable. Then set the itemstack variable to be the oxidized copper sword (or whatever the item is). Next copy the nbt of the provided itemstack onto the itemstack variable. Then add the itemstack variable which now has the nbt, into the player's inventory. Lastly, remove the provided itemstack.
The reason why the initial copper sword oxidizing procedure didn't work is because it gives the player an oxidized copper sword, then applies the nbt to a new oxidized copper sword that has no relation to the one that is given.