"Add item to provided player inventory" bug

Published by Goldorion on
Status
Duplicate
Issue description

Hi,
I just don't know why, but when I add an item to the player with "Add item to provided player inventory" procedure block, the game clear every items when the player quit the game (the world) and return in this world. The game clear also the vanilla item.
I record what is happen with an armor of my mod.

So if you can fix this bug for the next update it will be very very nice for my new mod. :)

https://youtu.be/USC8AXLpZp4

Issue comments

When I add the procedure that makes an item go to my inventory, it keeps making them go into my inventory until it's full and then they start dropping on the ground, do you know any way to stop the procedure so it only sends 1 to my inventory?

 Yeah, so what's happening is I have a procedure for a set bonus and what im trying to do is that when you have the whole set of armor on, it sends an item to your inventory, but im guessing that it sends infinite amounts of that item to my inventory because I still have the armor on so the code repeats itself, do you know any way to do what im trying to do though or is it not possible?

You can use entity NBT tag to have a "flag" that indicated if item has already been added to the inventory or not. Set the logic flag to say true after you add item to inventory and only add item if the flag is not true yet.

I suggest you check our tutorials collection playlist on our YouTube channel which contains many examples and tutorials that can help you get started with MCreator: https://www.youtube.com/playlist?list=PLAeL-oIFIEngE6jRgFYeFMfuj8WQsO3Ei

You have NBT tag procedures for items, entities and blocks. Use entity NBT tags. You can search on this website, there have been many similar cases to yours asked in the past.

Can you guide me on how to do what you said earlier, iv'e been trying this for a while and didn't want to ask you because iv'e already asked you so many questions but i'm so confused lol. i found the NBT tags but i have no idea on anything else.

Hey Klemen, Is there a way to set an NBT tag for a potion effect, i want when i put on a set of armor i get a health boost, everything works fine except when i load into the game every time i heal it instantly destroys the heart that got healed. the extra hearts show up but are empty because every time they get full it empty's them again

No, why not use them? Use NBT tags to flag if the action was already set or not yet. This issue has been asked on the forums countless times too. Search a bit.