diff --git a/src/main/java/net/neoforged/neoforge/items/wrapper/SidedInvWrapper.java b/src/main/java/net/neoforged/neoforge/items/wrapper/SidedInvWrapper.java index 9aef467e1e..b04d82b42e 100644 --- a/src/main/java/net/neoforged/neoforge/items/wrapper/SidedInvWrapper.java +++ b/src/main/java/net/neoforged/neoforge/items/wrapper/SidedInvWrapper.java @@ -47,6 +47,9 @@ public SidedInvWrapper(WorldlyContainer inv, @Nullable Direction side) { } public static int getSlot(WorldlyContainer inv, int slot, @Nullable Direction side) { + if (side == null) { + return slot; + } int[] slots = inv.getSlotsForFace(side); if (slot < slots.length) return slots[slot]; @@ -74,6 +77,9 @@ public int hashCode() { @Override public int getSlots() { + if (side == null) { + return inv.getContainerSize(); + } return inv.getSlotsForFace(side).length; } @@ -181,7 +187,7 @@ public ItemStack extractItem(int slot, int amount, boolean simulate) { if (stackInSlot.isEmpty()) return ItemStack.EMPTY; - if (!inv.canTakeItemThroughFace(slot1, stackInSlot, side)) + if (side != null && !inv.canTakeItemThroughFace(slot1, stackInSlot, side)) return ItemStack.EMPTY; if (simulate) {