turtle.suck() and turtle.drop() give incorrect return values when an inventory is full
Twijn opened this issue ยท 3 comments
turtle.drop(), turtle.dropUp(), turtle.dropDown(), turtle.suck(), turtle.suckDown(), and turtle.suckUp() will sometimes give incorrect return values when putting items into an inventory.
- Inserting X into an item full of Y will result in "false, No space for items" (Expected)
- Inserting X into an item full of X will result in "true" (Unexpected) (No items were moved)
This appears to be the same for both turtle.suck() and turtle.drop().
Looked into this one, not sure why it's happening. There appears to be code covering this situation, but I can confirm that it does return true. I speculate the comparison is not valid, and ItemStack.areItemStacksEqual
be used to attempt a patch. I don't have CC setup for development right now, or I would try this.
@KingofGamesYami is correct - some implementations of IItemHandler.insertItem
(such as InvWrapper
's (and other capabilities) will clone the item stack, meaning they are not the same object. It'd probably be better to use InventoryUtil.areItemsEqual
, but otherwise the suggested fix should work :)
I looked at it a bit as well before posting the issue, though did not attempt to edit it or create a PR due to my pure inexperience to modding and lack of a CC development setup, similarly to @KingofGamesYami , though I would think that comparing only the amounts of both ItemStack's would be ample - checking if the materials or data is equivalent is irrelevant.