From 25da378a516cc3e5f7ec3af1a780f742f91935c5 Mon Sep 17 00:00:00 2001 From: lordIcocain <62835225+lordIcocain@users.noreply.github.com> Date: Sun, 20 Oct 2024 16:00:14 +0300 Subject: [PATCH] Fix: Adv blocking card for omni. False positive when getAdaptor() return null. (#231) * fix_getadaptor * spotless * allow certus tank & buffers * better check * spotless * better blocking behavior --------- Co-authored-by: Martin Robertz --- .../inventory/FluidConvertingInventoryAdaptor.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/glodblock/github/inventory/FluidConvertingInventoryAdaptor.java b/src/main/java/com/glodblock/github/inventory/FluidConvertingInventoryAdaptor.java index 32ad5da8b..7075487da 100644 --- a/src/main/java/com/glodblock/github/inventory/FluidConvertingInventoryAdaptor.java +++ b/src/main/java/com/glodblock/github/inventory/FluidConvertingInventoryAdaptor.java @@ -31,7 +31,9 @@ import appeng.api.config.FuzzyMode; import appeng.api.config.InsertionMode; +import appeng.api.config.Settings; import appeng.api.config.Upgrades; +import appeng.api.config.YesNo; import appeng.api.parts.IPart; import appeng.helpers.DualityInterface; import appeng.helpers.IInterfaceHost; @@ -99,11 +101,18 @@ public static InventoryAdaptor wrap(TileEntity capProvider, ForgeDirection face) || Util.getPart(inter, face.getOpposite()) instanceof PartFluidExportBus || Util.getPart(inter, face.getOpposite()) instanceof PartFluidP2PInterface)) return InventoryAdaptor.getAdaptor(capProvider, face); + if (InventoryAdaptor.getAdaptor(capProvider, face) == null) { + if (capProvider instanceof IFluidHandler tank) { + if (!(tank.getTankInfo(face).length > 0)) return null; + } else { + return null; + } + } InventoryAdaptor item = InventoryAdaptor.getAdaptor(capProvider, face); IFluidHandler fluid = capProvider instanceof IFluidHandler ? (IFluidHandler) capProvider : null; boolean onmi = false; - if (inter instanceof TileInterface) { - onmi = ((TileInterface) inter).getTargets().size() > 1; + if (inter instanceof TileInterface in) { + if (in.getConfigManager().getSetting(Settings.BLOCK) == YesNo.NO) onmi = in.getTargets().size() > 1; } return new FluidConvertingInventoryAdaptor(capProvider, item, fluid, face, new BlockPos(inter), onmi); }