`SmartItemHandlerSlot` ignores the stack size of the item itself, bypassing stack limit restrictions, allowing you to stack unstackable items up to 64
alcatrazEscapee opened this issue ยท 1 comments
Reproduction steps:
- Place a crafting station (from Tinker's Construct) adjacent to a Chest
- Open the crafting station.
- Observe you can stack items up to 64 in the chest, even items that should not normally stack, and bypass all stack size restrictions:
Mods:
- Minecraft 1.18.2
- Forge 40.2.1
- Mantle 1.9.43
- Tinkers Construct 3.6.3.111
Logs: debug.log
Explanation
This method:
is an incomplete implementation. The vanilla implementation here takes the minimum of both the slot's stack size limit, and the item stack's size limit. This does not consider stack dependent slot restrictions, and as a result enables bypassing vanilla behavior using the crafting station.
What that should read, is:
@Override
public int getMaxStackSize(ItemStack stack) {
return Math.min(stack.getMaxStackSize(), getItemHandler().getSlotLimit(getSlotIndex()));
}