diff --git a/src/main/java/li/cil/oc2/common/container/TypedDeviceItemStackHandler.java b/src/main/java/li/cil/oc2/common/container/TypedDeviceItemStackHandler.java index 2c11b587..15d03d8c 100644 --- a/src/main/java/li/cil/oc2/common/container/TypedDeviceItemStackHandler.java +++ b/src/main/java/li/cil/oc2/common/container/TypedDeviceItemStackHandler.java @@ -9,18 +9,20 @@ import java.util.function.Function; public class TypedDeviceItemStackHandler extends DeviceItemStackHandler { private final DeviceType deviceType; + private final Function queryFactory; /////////////////////////////////////////////////////////////////// public TypedDeviceItemStackHandler(final int size, final Function queryFactory, final DeviceType deviceType) { super(size, queryFactory); this.deviceType = deviceType; + this.queryFactory = queryFactory; } /////////////////////////////////////////////////////////////////// @Override public boolean isItemValid(final int slot, final ItemStack stack) { - return super.isItemValid(slot, stack) && Devices.getDeviceTypes(Devices.makeQuery(stack)).contains(deviceType); + return super.isItemValid(slot, stack) && Devices.getDeviceTypes(queryFactory.apply(stack)).contains(deviceType); } }