Can't Add NBT Tags To Itemstacks in the TileEntity

Started by liang233 on

Topic category: Help with modding (Java Edition)

Last seen on 01:45, 16. Feb 2024
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can't Add NBT Tags To Itemstacks in the TileEntity
Sat, 01/21/2023 - 13:44 (edited)

Sorry for my poor English

I was trying to make a machine to give an item a custom attribute(using NBT) 

Then I need to add NBTs to the itemstack in the machine.

My Procedure

Part of my procedure

Full Procedure: https://drive.google.com/file/d/1hViKzmZGCgaf7msl1PX0EJsbzJstknlJ/view?usp=sharing

But it seems that this doesn't work 

NBT Tag is not added to the item!

The NBT tag is not added to the itemstack.

Anything wrong with my procedure? Or there are bugs in MCreator?

(Any other solution is OK.)

Full Workspace: https://drive.google.com/file/d/17is6Foi9pur2NTLS5PZ5W7i7Wy2zQ8ZM/view?usp=share_link

Thank you for your help :)

Edited by liang233 on Sat, 01/21/2023 - 13:44
Procedure blocks "get a copy…
Sun, 01/22/2023 - 16:19

Procedure blocks "get a copy of itemstack" give you a copy of a stack in the slot, not original stack. So this means you are not assigning NBT to the stack in slot but to its copy.

You need to store copy of that stack to a local itemstack type variable, assign NBT to this variable itemstack and then set item in slot to that variable

Last seen on 01:45, 16. Feb 2024
Joined Jan 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you :)
Mon, 01/23/2023 - 03:30

Thank you :)