Description
SidedInvWrapper is a capability wrapper for WorldlyContainer
, a vanilla interface with the following definition:
public interface WorldlyContainer extends Container {
int[] getSlotsForFace(Direction side);
boolean canPlaceItemThroughFace(int index, ItemStack itemStack, @Nullable Direction direction);
boolean canTakeItemThroughFace(int index, ItemStack stack, Direction direction);
}
As a capability wrapper for the IItemHandler
capability, SidedInvWrapper
directly accepts a null Direction
and passes it through to these methods, which is illegal in two of three cases.
These erroneous calls are in SidedInvWrapper.getSlot
and SidedInvWrapper#extractItem
. In both cases, SidedInvWrapper
needs to fallback to the equivalent behavior from InvWrapper
when the direction is null.
This behavior has gone unnoticed for quite a while, simply because none of the vanilla implementation crash when passed null values. This does not change the fact that this is a bug in SidedInvWrapper
.