How to add NBT tag for the specific item? (Solved)

Started by ShAdOw112 on Wed, 04/20/2022 - 18:21

Topic category: Help with modding (Java Edition)

Last seen on 11:54, 21. Jun 2022
Joined Mar 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How to add NBT tag for the specific item? (Solved)
Wed, 04/20/2022 - 19:21 (edited)

I've found a problem: I have an NPC with its unique GUI. Once you press a button NPC gives you an item and then it must give it unique NBT tag (for the concrete item in your inventory). But MCreator doesn't allow to do this! How can I fix it?

Edited by ShAdOw112 on Wed, 04/20/2022 - 19:21
Last seen on 11:54, 21. Jun 2022
Joined Mar 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I've just solved the problemā€¦
Wed, 04/20/2022 - 19:21

I've just solved the problem:

  1. In GUI procedure I set all NBT tags I need to my character into global variables.
  2. I made a procedure with "picking up" trigger. It detects if the picked (provided) item is the one we need.
  3. Then it checks if the player's global variabls aren't equal to "" or 0 (for numerical ones) and if the item doesn't have the NBT tag yet.
  4. The procedure sets NBT item tags to the global variables we set before.
  5. After that it sets the global variables into "" or 0 (for numerical ones). That's it! The concrete item has the NBT tag now!

If you need more explanations I will send screenshots with the solution