I have an item which consumes some energy from its capability and teleports the player on right click. It works fine both in creative and in survival.
Until I duplicate the item by middle-clicking in creative mode. After that, the capability data of every single existing itemstack, as well as the new one, is reset to its default value of "0 energy".
I am aware that, in creative mode, the client tells the server what to sync, instead of the other way around. The strange part is that ALL itemstacks are affected, instead of just the copied one, as I would expect.
Returning to survival mode doesn't fix the problem. While, restarting the game does.
What could be causing this, and how do I fix it? I tried to take a look at get and read ShareTag, but they had no visible effect. They didn't even alter the nbt tag.
Here is the problematic file, in the code's repo.