Refactor Some Class stuff out in favor of StorageChannel.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user