Fabricators-of-Create / Porting-Lib

A collection of utilities for porting mods from Forge to Fabric.
Other
113 stars 33 forks source link

[1.21] Fix empty slots having a slot limit of 1 in ItemStackHandler. #131

Closed MerchantPug closed 3 weeks ago

MerchantPug commented 3 weeks ago

By using ItemStack#getMaxStackSize, you are limiting any empty slot to have a slot limit of 1, as that defaults to 1 when there is no max stack size component present (empty stacks don't have it).

The fix is to instead getOrDefault the stack size component and default it to max value, that way, mods that increase the max stack size further than 99 can also be slotted into empty slots.

IThundxr commented 3 weeks ago

I'm not entirely sure setting it to int max value is the best fix here, previously ItemStack#EMPTY had a stacksize of 64 so ideally it'd default to the default stack size

MerchantPug commented 3 weeks ago

I'm not entirely sure setting it to int max value is the best fix here, previously ItemStack#EMPTY had a stacksize of 64 so ideally it'd default to the default stack size

That's fair, I'll change it then.

MerchantPug commented 3 weeks ago

accident!