NBT numbertag being reset

Status
Works as designed
Type
Product/platform
MCreator/Windows
MCreator version
Priority
Normal
Issue description

Hello! I'm working on a magic mod and the alchemy section is giving me some trouble.

I've made a special brewing stand which is supposed to allow players to stack potion effects into a single bottle. E.g. Combining 2 speed potions will create a potion with speed 2. But it isn't working.

It seems like the crafted potion isn't keeping its NBT number tag. When I drink the potion it gives an effect of "speed 0 with duration 0".

Here are the screenshots of the crafting procedure and the drinking procedure. Would anyone be able to help?

 

Issue comments

"Get copy of item from slot X" gives you a copy.

You add NBT to the copy of your item, not original as this is how itemstack inventory is designed for code reasons.

You need to set new item in slot, where this new item is item copy with NBT set. You will need to use itemstack local variable to save current copy of item, modify it and then set in the slot.

TLDR: You are setting NBT tags on copy of your item



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.