Kander16 Posted January 18, 2020 Posted January 18, 2020 Hi, I'm currently creating a 'containerItem', an item which has a specified containerItem set and if used (eaten, for example) it returns this containerItem into the inventory of the player. I made this class to get arbitrary items to work like a SoupItem (so that it can return an arbitrary item back in inventory. Everything seems to work fine except for one special case, and I don't know where to look. My code: https://pastebin.com/gwX2yDiJ The different possible cases: If the item you were eating is gone: If the containerItem is stackable and the player has the containerItemStack in its inventory, use player.addItemStackToInventory to add the containerItem to the current stack This is the one case that doesn't work sometimes. If I am eating an item with a count of 1, and had a containerItem already in my inventory with the maxStackSize reached (in my case, 64), the item completely vanishes. Any idea of what I'm doing wrong here? In any other case, just return the containerItemStack to get the containerItem If the item you were eating isn't gone: player.addItemStackToInventory (to not replace the item you were eating) Thanks in advance, Kander16 Quote Creator of the Master Chef Mod and many more to come. If I helped you, please click the 'thank you' button.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.