Fix crafting plan reporting invisible extractable items as available

Closes #438
This commit is contained in:
NotMyWing
2024-05-25 00:37:46 +11:00
parent 2e976a609f
commit d82cdabc6d
@@ -31,7 +31,7 @@ import appeng.api.networking.crafting.ICraftingLink;
import appeng.api.networking.security.IActionHost;
import appeng.api.networking.security.IActionSource;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
@@ -213,12 +213,16 @@ public class ContainerCraftConfirm extends AEBaseContainer {
p.setStackSize(out.getCountRequestable());
final IStorageGrid sg = grid.getCache(IStorageGrid.class);
final IMEInventory<IAEItemStack> items = sg.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
final IMEMonitor<IAEItemStack> items = sg.getInventory(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
IAEItemStack m = null;
if (c != null && this.result.isSimulation()) {
m = o.copy();
o = items.extractItems(o, Actionable.SIMULATE, this.getActionSource());
if (items.getStorageList().findPrecise(o) != null) {
o = items.extractItems(o, Actionable.SIMULATE, this.getActionSource());
} else {
o = null;
}
if (o == null) {
o = m.copy();
@@ -330,8 +334,7 @@ public class ContainerCraftConfirm extends AEBaseContainer {
if (te != null) {
Platform.openGUI(this.getInventoryPlayer().player, te, this.getOpenContext().getSide(), originalGui);
} else {
if (ah instanceof IInventorySlotAware) {
IInventorySlotAware i = ((IInventorySlotAware) ah);
if (ah instanceof IInventorySlotAware i) {
Platform.openGUI(this.getInventoryPlayer().player, i.getInventorySlot(), originalGui, i.isBaubleSlot());
}
}