From 8bcd34622663dc6a4bcdbd94a66c57e3f6b26016 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Wed, 23 Jul 2014 17:39:42 -0500 Subject: [PATCH] Storage Buses no longer assume an inventory can be accessed just because it implements IInventory. --- core/features/registries/entries/ExternalIInv.java | 8 +++++--- helpers/DualityInterface.java | 2 +- integration/modules/helpers/MFRDSUHandler.java | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/features/registries/entries/ExternalIInv.java b/core/features/registries/entries/ExternalIInv.java index 2efe69955..85776666d 100644 --- a/core/features/registries/entries/ExternalIInv.java +++ b/core/features/registries/entries/ExternalIInv.java @@ -22,9 +22,11 @@ public class ExternalIInv implements IExternalStorageHandler @Override public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src) { - if ( channel == StorageChannel.ITEMS && te instanceof IInventory ) - return new MEMonitorIInventory( InventoryAdaptor.getAdaptor( (IInventory) te, d ) ); - + InventoryAdaptor ad = InventoryAdaptor.getAdaptor( (IInventory) te, d ); + + if ( channel == StorageChannel.ITEMS && ad != null ) + return new MEMonitorIInventory( ad ); + return null; } diff --git a/helpers/DualityInterface.java b/helpers/DualityInterface.java index 4de76ed6b..29ecb62fd 100644 --- a/helpers/DualityInterface.java +++ b/helpers/DualityInterface.java @@ -380,7 +380,7 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt { public InterfaceInventory(DualityInterface tileInterface) { - super( InventoryAdaptor.getAdaptor( tileInterface.storage, ForgeDirection.UP ) ); + super( new AdaptorIInventory( tileInterface.storage ) ); mySource = new MachineSource( iHost ); } diff --git a/integration/modules/helpers/MFRDSUHandler.java b/integration/modules/helpers/MFRDSUHandler.java index a8c297b4a..1a059355c 100644 --- a/integration/modules/helpers/MFRDSUHandler.java +++ b/integration/modules/helpers/MFRDSUHandler.java @@ -24,6 +24,7 @@ public class MFRDSUHandler implements IExternalStorageHandler { if ( chan == StorageChannel.ITEMS ) return new MEMonitorIInventory( new IMEAdaptor( DSU.instance.getDSU( te ), src ) ); + return null; } }