Refactor Some Class stuff out in favor of StorageChannel.

This commit is contained in:
AlgorithmX2
2014-07-23 14:11:12 -05:00
parent e1fe66adf9
commit 298ae41198
13 changed files with 24 additions and 26 deletions
+8 -6
View File
@@ -9,22 +9,24 @@ import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.IMEMonitorHandlerReceiver;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.util.Platform;
import appeng.util.inv.ItemListIgnoreCrafting;
import appeng.util.item.ItemList;
public class MEMonitorPassthu<T extends IAEStack<T>> extends MEPassthru<T> implements IMEMonitor<T>, IMEMonitorHandlerReceiver<T>
{
HashMap<IMEMonitorHandlerReceiver<T>, Object> listeners = new HashMap();
IMEMonitor<T> monitor;
StorageChannel channel;
public BaseActionSource changeSource;
public MEMonitorPassthu(IMEInventory<T> i, Class<? extends IAEStack> cla) {
super( i, cla );
public MEMonitorPassthu(IMEInventory<T> i, StorageChannel channel ) {
super( i );
this.channel = channel;
if ( i instanceof IMEMonitor )
monitor = (IMEMonitor<T>) i;
}
@@ -36,13 +38,13 @@ public class MEMonitorPassthu<T extends IAEStack<T>> extends MEPassthru<T> imple
monitor.removeListener( this );
monitor = null;
IItemList<T> before = getInternal() == null ? new ItemList( clz ) : getInternal().getAvailableItems( new ItemListIgnoreCrafting( new ItemList( clz ) ) );
IItemList<T> before = getInternal() == null ? channel.createList() : getInternal().getAvailableItems( new ItemListIgnoreCrafting( channel.createList() ) );
super.setInternal( i );
if ( i instanceof IMEMonitor )
monitor = (IMEMonitor<T>) i;
IItemList<T> after = getInternal() == null ? new ItemList( clz ) : getInternal().getAvailableItems( new ItemListIgnoreCrafting( new ItemList( clz ) ) );
IItemList<T> after = getInternal() == null ? channel.createList() : getInternal().getAvailableItems( new ItemListIgnoreCrafting( channel.createList() ) );
if ( monitor != null )
monitor.addListener( this, monitor );
@@ -74,7 +76,7 @@ public class MEMonitorPassthu<T extends IAEStack<T>> extends MEPassthru<T> imple
{
if ( monitor == null )
{
IItemList<T> out = new ItemList( clz );
IItemList<T> out = channel.createList();
getInternal().getAvailableItems( new ItemListIgnoreCrafting( out ) );
return out;
}