Topic category: Help with modding (Java Edition)
In my mod, I am making a container of magic energy as an item, called a magic battery. I will have many wands and such that will use this magic battery's energy from the user's inventory. I have come across a problem: I cannot directly set an NBT tag on an item from the player's inventory, only a copy of such item. I have thought of a workaround, in which I use a custom return-type procedure that uses an itemstack variable that I set to the already-existing magic battery. I apply changes to the magic level of the variable via NBT tags, then replace the existing battery with the variable. My problem with that is that I can't specify the slot the new battery is put in, so it just places it in the player's next available slot.