Item Duplication on inventory merge (i.e. Smart-Dropoff) into full chest
CorbinSteele opened this issue ยท 1 comments
Example of how to duplicate
- Fill a chest completely with cobblestone, except for one inventory slot.
- Add exactly half of a stack of diamonds in the empty inventory slot.
- With a full stack of diamonds in your player inventory (not the hotbar), click the 'Merge' button to attempt to drop off as many diamonds as possible into the chest.
- BUG: The chest fills with diamonds, but the diamonds in the player's inventory are not removed.
NOTE: The specific items and quantities don't really matter. Attempting to smart-drop off more of an item than will fit into a chest containing a partial stack of the item causes the item duplication bug.
Suspected Cause
Being a programmer myself, I think I tracked down the problem:
vazkii.quark.base.handler.DropoffHandler Lines 215-216
if(!ItemStack.areItemsEqual(stackAt, ret)) inv.setInventorySlotContents(i, ret);
Those lines seem like they would skip updating the player's inventory if the insert operation doesn't complete, including when the insert operation partially completes. I'm guessing this can be easily fixed by using some other method instead, or maybe even always setting the inventory slot contents.
(Take my guess with a grain of salt, I have very little prior experience with Minecraft code.)