Skip to content

Commit

Permalink
Fix: Adv blocking card for omni. False positive when getAdaptor() ret…
Browse files Browse the repository at this point in the history
…urn null. (#231)

* fix_getadaptor

* spotless

* allow certus tank & buffers

* better check

* spotless

* better blocking behavior

---------

Co-authored-by: Martin Robertz <dream-master@gmx.net>
  • Loading branch information
lordIcocain and Dream-Master authored Oct 20, 2024
1 parent f8e7aba commit 25da378
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 25da378

Please sign in to comment.