How to add NBT tag to custom items

Started by YoshiDBM on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to add NBT tag to custom items

So I've made a battery(item because I couldn't make wires) and tried to make it work.

I've added an "Energy" NBT number tag. After, I've made some generators to make it able to be charged. And I've coded, that if I click into the air with this item, it writes the charge of it. I've made the charging procedures, to check, how it works. And it wrote 0.0 charge every time, but I've coded, that when I charge it in a generator, then it makes +xy higher the "Energy" tag. And I've right-clicked into the air, and it didn't work.

So could anybody help me with this? I have no idea, what should I do to this work.