All Terminals now can be opened in low power / channel state and show dark slots.
This commit is contained in:
parent
5e36754cfd
commit
c40c81070c
18 changed files with 204 additions and 38 deletions
|
@ -10,7 +10,6 @@ import appeng.block.AEBaseBlock;
|
||||||
import appeng.client.render.BaseBlockRender;
|
import appeng.client.render.BaseBlockRender;
|
||||||
import appeng.client.render.blocks.RendererSecurity;
|
import appeng.client.render.blocks.RendererSecurity;
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
import appeng.core.localization.PlayerMessages;
|
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.tile.misc.TileSecurity;
|
import appeng.tile.misc.TileSecurity;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
@ -39,15 +38,10 @@ public class BlockSecurity extends AEBaseBlock
|
||||||
TileSecurity tg = getTileEntity( w, x, y, z );
|
TileSecurity tg = getTileEntity( w, x, y, z );
|
||||||
if ( tg != null )
|
if ( tg != null )
|
||||||
{
|
{
|
||||||
if ( Platform.isServer() )
|
if ( Platform.isClient() )
|
||||||
{
|
return true;
|
||||||
if ( tg.isPowered() )
|
|
||||||
{
|
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_SECURITY );
|
||||||
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_SECURITY );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
p.addChatMessage( PlayerMessages.MachineNotPowered.get() );
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class BlockChest extends AEBaseBlock
|
||||||
{
|
{
|
||||||
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_CHEST );
|
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_CHEST );
|
||||||
}
|
}
|
||||||
else if ( tg.isPowered() )
|
else
|
||||||
{
|
{
|
||||||
ItemStack cell = tg.getStackInSlot( 1 );
|
ItemStack cell = tg.getStackInSlot( 1 );
|
||||||
if ( cell != null )
|
if ( cell != null )
|
||||||
|
@ -58,8 +58,6 @@ public class BlockChest extends AEBaseBlock
|
||||||
else
|
else
|
||||||
p.addChatMessage( PlayerMessages.ChestCannotReadStorageCell.get() );
|
p.addChatMessage( PlayerMessages.ChestCannotReadStorageCell.get() );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
p.addChatMessage( PlayerMessages.MachineNotPowered.get() );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -526,7 +526,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||||
|
|
||||||
AppEngRenderItem aeri = new AppEngRenderItem();
|
AppEngRenderItem aeri = new AppEngRenderItem();
|
||||||
|
|
||||||
private boolean isPowered()
|
protected boolean isPowered()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||||
super( c );
|
super( c );
|
||||||
myScrollBar = new GuiScrollbar();
|
myScrollBar = new GuiScrollbar();
|
||||||
repo = new ItemRepo( myScrollBar, this );
|
repo = new ItemRepo( myScrollBar, this );
|
||||||
|
|
||||||
xSize = 195;
|
xSize = 195;
|
||||||
ySize = 204;
|
ySize = 204;
|
||||||
|
|
||||||
|
@ -280,6 +281,13 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateScreen()
|
||||||
|
{
|
||||||
|
repo.setPower( mecontainer.hasPower );
|
||||||
|
super.updateScreen();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||||
{
|
{
|
||||||
|
@ -354,4 +362,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||||
repo.updateView();
|
repo.updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean isPowered()
|
||||||
|
{
|
||||||
|
return repo.hasPower();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,4 +28,9 @@ public class InternalSlotME
|
||||||
{
|
{
|
||||||
return repo.getRefrenceItem( offset );
|
return repo.getRefrenceItem( offset );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasPower()
|
||||||
|
{
|
||||||
|
return repo.hasPower();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,4 +241,16 @@ public class ItemRepo
|
||||||
list.resetStatus();
|
list.resetStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean hasPower;
|
||||||
|
|
||||||
|
public boolean hasPower()
|
||||||
|
{
|
||||||
|
return hasPower;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPower(boolean hasPower)
|
||||||
|
{
|
||||||
|
this.hasPower = hasPower;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,16 @@ public class SlotME extends Slot
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getStack()
|
public ItemStack getStack()
|
||||||
{
|
{
|
||||||
return mySlot.getStack();
|
if ( mySlot.hasPower() )
|
||||||
|
return mySlot.getStack();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IAEItemStack getAEStack()
|
public IAEItemStack getAEStack()
|
||||||
{
|
{
|
||||||
return mySlot.getAEStack();
|
if ( mySlot.hasPower() )
|
||||||
|
return mySlot.getAEStack();
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,7 +52,9 @@ public class SlotME extends Slot
|
||||||
@Override
|
@Override
|
||||||
public boolean getHasStack()
|
public boolean getHasStack()
|
||||||
{
|
{
|
||||||
return getStack() != null;
|
if ( mySlot.hasPower() )
|
||||||
|
return getStack() != null;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -115,8 +115,8 @@ public abstract class AEBaseContainer extends Container
|
||||||
public ContainerOpenContext openContext;
|
public ContainerOpenContext openContext;
|
||||||
|
|
||||||
protected IMEInventoryHandler<IAEItemStack> cellInv;
|
protected IMEInventoryHandler<IAEItemStack> cellInv;
|
||||||
protected IEnergySource powerSrc;
|
|
||||||
protected HashSet<Integer> locked = new HashSet();
|
protected HashSet<Integer> locked = new HashSet();
|
||||||
|
protected IEnergySource powerSrc;
|
||||||
|
|
||||||
public void lockPlayerInventorySlot(int idx)
|
public void lockPlayerInventorySlot(int idx)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,8 @@ import net.minecraft.inventory.ICrafting;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
|
import appeng.api.config.PowerMultiplier;
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.api.config.SortDir;
|
import appeng.api.config.SortDir;
|
||||||
|
@ -38,6 +40,7 @@ import appeng.core.AELog;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||||
import appeng.core.sync.packets.PacketValueConfig;
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
|
import appeng.me.helpers.ChannelPowerSrc;
|
||||||
import appeng.util.ConfigManager;
|
import appeng.util.ConfigManager;
|
||||||
import appeng.util.IConfigManagerHost;
|
import appeng.util.IConfigManagerHost;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
@ -52,9 +55,12 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||||
IConfigManager clientCM;
|
IConfigManager clientCM;
|
||||||
|
|
||||||
public boolean canAccessViewCells = false;
|
public boolean canAccessViewCells = false;
|
||||||
|
public boolean hasPower = false;
|
||||||
|
|
||||||
public SlotRestrictedInput cellView[] = new SlotRestrictedInput[5];
|
public SlotRestrictedInput cellView[] = new SlotRestrictedInput[5];
|
||||||
|
|
||||||
public IConfigManagerHost gui;
|
public IConfigManagerHost gui;
|
||||||
|
private IGridNode networkNode;
|
||||||
|
|
||||||
protected ContainerMEMonitorable(InventoryPlayer ip, ITerminalHost montiorable, boolean bindInventory) {
|
protected ContainerMEMonitorable(InventoryPlayer ip, ITerminalHost montiorable, boolean bindInventory) {
|
||||||
super( ip, montiorable instanceof TileEntity ? (TileEntity) montiorable : null, montiorable instanceof IPart ? (IPart) montiorable : null );
|
super( ip, montiorable instanceof TileEntity ? (TileEntity) montiorable : null, montiorable instanceof IPart ? (IPart) montiorable : null );
|
||||||
|
@ -85,9 +91,10 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||||
IGridNode node = ((IGridHost) montiorable).getGridNode( ForgeDirection.UNKNOWN );
|
IGridNode node = ((IGridHost) montiorable).getGridNode( ForgeDirection.UNKNOWN );
|
||||||
if ( node != null )
|
if ( node != null )
|
||||||
{
|
{
|
||||||
|
networkNode = node;
|
||||||
IGrid g = node.getGrid();
|
IGrid g = node.getGrid();
|
||||||
if ( g != null )
|
if ( g != null )
|
||||||
powerSrc = g.getCache( IEnergyGrid.class );
|
powerSrc = new ChannelPowerSrc( networkNode, (IEnergyGrid) g.getCache( IEnergyGrid.class ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,6 +187,8 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updatePowerStatus();
|
||||||
|
|
||||||
boolean oldCanAccessViewCells = canAccessViewCells;
|
boolean oldCanAccessViewCells = canAccessViewCells;
|
||||||
canAccessViewCells = hasAccess( SecurityPermissions.BUILD, false );
|
canAccessViewCells = hasAccess( SecurityPermissions.BUILD, false );
|
||||||
if ( canAccessViewCells != oldCanAccessViewCells )
|
if ( canAccessViewCells != oldCanAccessViewCells )
|
||||||
|
@ -201,11 +210,46 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void updatePowerStatus()
|
||||||
|
{
|
||||||
|
boolean oldHasPower = hasPower;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if ( networkNode != null )
|
||||||
|
hasPower = networkNode.isActive();
|
||||||
|
else if ( powerSrc instanceof IEnergyGrid )
|
||||||
|
hasPower = ((IEnergyGrid) powerSrc).isNetworkPowered();
|
||||||
|
else
|
||||||
|
hasPower = powerSrc.extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.8;
|
||||||
|
}
|
||||||
|
catch (Throwable t)
|
||||||
|
{
|
||||||
|
// :P
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( hasPower != oldHasPower )
|
||||||
|
{
|
||||||
|
for (Object c : this.crafters)
|
||||||
|
{
|
||||||
|
if ( c instanceof ICrafting )
|
||||||
|
{
|
||||||
|
ICrafting cr = (ICrafting) c;
|
||||||
|
cr.sendProgressBarUpdate( this, 98, hasPower ? 1 : 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCraftingToCrafters(ICrafting c)
|
public void addCraftingToCrafters(ICrafting c)
|
||||||
{
|
{
|
||||||
super.addCraftingToCrafters( c );
|
super.addCraftingToCrafters( c );
|
||||||
|
queueInventory( c );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void queueInventory(ICrafting c)
|
||||||
|
{
|
||||||
if ( Platform.isServer() && c instanceof EntityPlayer && monitor != null )
|
if ( Platform.isServer() && c instanceof EntityPlayer && monitor != null )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -238,11 +282,27 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onListUpdate()
|
||||||
|
{
|
||||||
|
for (Object c : this.crafters)
|
||||||
|
{
|
||||||
|
if ( c instanceof ICrafting )
|
||||||
|
{
|
||||||
|
ICrafting cr = (ICrafting) c;
|
||||||
|
queueInventory( cr );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateProgressBar(int idx, int value)
|
public void updateProgressBar(int idx, int value)
|
||||||
{
|
{
|
||||||
super.updateProgressBar( idx, value );
|
super.updateProgressBar( idx, value );
|
||||||
|
|
||||||
|
if ( idx == 98 )
|
||||||
|
hasPower = value == 1;
|
||||||
|
|
||||||
if ( idx == 99 )
|
if ( idx == 99 )
|
||||||
canAccessViewCells = value == 1;
|
canAccessViewCells = value == 1;
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,8 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
|
||||||
@Override
|
@Override
|
||||||
public void updateProgressBar(int key, int value)
|
public void updateProgressBar(int key, int value)
|
||||||
{
|
{
|
||||||
|
super.updateProgressBar( key, value );
|
||||||
|
|
||||||
if ( key == 0 )
|
if ( key == 0 )
|
||||||
security = value;
|
security = value;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +94,7 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
|
||||||
@Override
|
@Override
|
||||||
public void detectAndSendChanges()
|
public void detectAndSendChanges()
|
||||||
{
|
{
|
||||||
verifyPermissions( SecurityPermissions.SECURITY, true );
|
verifyPermissions( SecurityPermissions.SECURITY, false );
|
||||||
|
|
||||||
int newSecurity = 0;
|
int newSecurity = 0;
|
||||||
|
|
||||||
|
@ -105,6 +107,8 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
|
||||||
newSecurity = newSecurity | (1 << sp.ordinal());
|
newSecurity = newSecurity | (1 << sp.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updatePowerStatus();
|
||||||
|
|
||||||
if ( newSecurity != security )
|
if ( newSecurity != security )
|
||||||
{
|
{
|
||||||
if ( Platform.isServer() )
|
if ( Platform.isServer() )
|
||||||
|
|
1
me/cache/GridStorageCache.java
vendored
1
me/cache/GridStorageCache.java
vendored
|
@ -27,6 +27,7 @@ import appeng.api.storage.data.IAEStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.me.storage.ItemWatcher;
|
import appeng.me.storage.ItemWatcher;
|
||||||
import appeng.me.storage.NetworkInventoryHandler;
|
import appeng.me.storage.NetworkInventoryHandler;
|
||||||
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.SetMultimap;
|
import com.google.common.collect.SetMultimap;
|
||||||
|
|
||||||
|
|
15
me/cache/NetworkMonitor.java
vendored
15
me/cache/NetworkMonitor.java
vendored
|
@ -1,11 +1,14 @@
|
||||||
package appeng.me.cache;
|
package appeng.me.cache;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import appeng.api.networking.events.MENetworkStorageEvent;
|
import appeng.api.networking.events.MENetworkStorageEvent;
|
||||||
import appeng.api.networking.security.BaseActionSource;
|
import appeng.api.networking.security.BaseActionSource;
|
||||||
import appeng.api.storage.IMEInventoryHandler;
|
import appeng.api.storage.IMEInventoryHandler;
|
||||||
|
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||||
import appeng.api.storage.MEMonitorHandler;
|
import appeng.api.storage.MEMonitorHandler;
|
||||||
import appeng.api.storage.StorageChannel;
|
import appeng.api.storage.StorageChannel;
|
||||||
import appeng.api.storage.data.IAEStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
|
@ -23,6 +26,18 @@ public class NetworkMonitor<T extends IAEStack<T>> extends MEMonitorHandler<T>
|
||||||
public void forceUpdate()
|
public void forceUpdate()
|
||||||
{
|
{
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
|
|
||||||
|
Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = getListeners();
|
||||||
|
while (i.hasNext())
|
||||||
|
{
|
||||||
|
Entry<IMEMonitorHandlerReceiver<T>, Object> o = i.next();
|
||||||
|
IMEMonitorHandlerReceiver<T> recv = o.getKey();
|
||||||
|
|
||||||
|
if ( recv.isValid( o.getValue() ) )
|
||||||
|
recv.onListUpdate();
|
||||||
|
else
|
||||||
|
i.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public NetworkMonitor(GridStorageCache cache, StorageChannel chan) {
|
public NetworkMonitor(GridStorageCache cache, StorageChannel chan) {
|
||||||
|
|
27
me/helpers/ChannelPowerSrc.java
Normal file
27
me/helpers/ChannelPowerSrc.java
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
package appeng.me.helpers;
|
||||||
|
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
|
import appeng.api.config.PowerMultiplier;
|
||||||
|
import appeng.api.networking.IGridNode;
|
||||||
|
import appeng.api.networking.energy.IEnergySource;
|
||||||
|
|
||||||
|
public class ChannelPowerSrc implements IEnergySource
|
||||||
|
{
|
||||||
|
|
||||||
|
IGridNode node;
|
||||||
|
IEnergySource realSrc;
|
||||||
|
|
||||||
|
public ChannelPowerSrc(IGridNode networkNode, IEnergySource src) {
|
||||||
|
node = networkNode;
|
||||||
|
realSrc = src;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double extractAEPower(double amt, Actionable mode, PowerMultiplier usePowerMultiplier)
|
||||||
|
{
|
||||||
|
if ( node.isActive() )
|
||||||
|
return realSrc.extractAEPower( amt, mode, usePowerMultiplier );
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -22,7 +22,7 @@ public class MEMonitorPassthu<T extends IAEStack<T>> extends MEPassthru<T> imple
|
||||||
public BaseActionSource changeSource;
|
public BaseActionSource changeSource;
|
||||||
|
|
||||||
public MEMonitorPassthu(IMEInventory<T> i, Class<? extends IAEStack> cla) {
|
public MEMonitorPassthu(IMEInventory<T> i, Class<? extends IAEStack> cla) {
|
||||||
super( i,cla );
|
super( i, cla );
|
||||||
if ( i instanceof IMEMonitor )
|
if ( i instanceof IMEMonitor )
|
||||||
monitor = (IMEMonitor<T>) i;
|
monitor = (IMEMonitor<T>) i;
|
||||||
}
|
}
|
||||||
|
@ -34,13 +34,13 @@ public class MEMonitorPassthu<T extends IAEStack<T>> extends MEPassthru<T> imple
|
||||||
monitor.removeListener( this );
|
monitor.removeListener( this );
|
||||||
|
|
||||||
monitor = null;
|
monitor = null;
|
||||||
IItemList<T> before = getInternal() == null ? new ItemList(clz) : getInternal().getAvailableItems( new ItemList(clz) );
|
IItemList<T> before = getInternal() == null ? new ItemList( clz ) : getInternal().getAvailableItems( new ItemList( clz ) );
|
||||||
|
|
||||||
super.setInternal( i );
|
super.setInternal( i );
|
||||||
if ( i instanceof IMEMonitor )
|
if ( i instanceof IMEMonitor )
|
||||||
monitor = (IMEMonitor<T>) i;
|
monitor = (IMEMonitor<T>) i;
|
||||||
|
|
||||||
IItemList<T> after = getInternal() == null ? new ItemList(clz) : getInternal().getAvailableItems( new ItemList(clz) );
|
IItemList<T> after = getInternal() == null ? new ItemList( clz ) : getInternal().getAvailableItems( new ItemList( clz ) );
|
||||||
|
|
||||||
if ( monitor != null )
|
if ( monitor != null )
|
||||||
monitor.addListener( this, monitor );
|
monitor.addListener( this, monitor );
|
||||||
|
@ -64,7 +64,7 @@ public class MEMonitorPassthu<T extends IAEStack<T>> extends MEPassthru<T> imple
|
||||||
public IItemList<T> getStorageList()
|
public IItemList<T> getStorageList()
|
||||||
{
|
{
|
||||||
if ( monitor == null )
|
if ( monitor == null )
|
||||||
return getInternal().getAvailableItems( new ItemList<T>(clz) );
|
return getInternal().getAvailableItems( new ItemList<T>( clz ) );
|
||||||
return monitor.getStorageList();
|
return monitor.getStorageList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,4 +88,19 @@ public class MEMonitorPassthu<T extends IAEStack<T>> extends MEPassthru<T> imple
|
||||||
i.remove();
|
i.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onListUpdate()
|
||||||
|
{
|
||||||
|
Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = listeners.entrySet().iterator();
|
||||||
|
while (i.hasNext())
|
||||||
|
{
|
||||||
|
Entry<IMEMonitorHandlerReceiver<T>, Object> e = i.next();
|
||||||
|
IMEMonitorHandlerReceiver<T> recv = e.getKey();
|
||||||
|
if ( recv.isValid( e.getValue() ) )
|
||||||
|
recv.onListUpdate();
|
||||||
|
else
|
||||||
|
i.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -576,4 +576,17 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||||
return super.getInventoryByName( name );
|
return super.getInventoryByName( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onListUpdate()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
updateReportingValue( proxy.getStorage().getItemInventory() );
|
||||||
|
}
|
||||||
|
catch (GridAccessException e)
|
||||||
|
{
|
||||||
|
// ;P
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -411,4 +411,10 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||||
return type == PipeType.ITEM && with == side ? ConnectOverride.CONNECT : ConnectOverride.DISCONNECT;
|
return type == PipeType.ITEM && with == side ? ConnectOverride.CONNECT : ConnectOverride.DISCONNECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onListUpdate()
|
||||||
|
{
|
||||||
|
// not used here.
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import appeng.api.storage.IMEMonitor;
|
||||||
import appeng.api.storage.ITerminalHost;
|
import appeng.api.storage.ITerminalHost;
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
import appeng.client.texture.CableBusTextures;
|
import appeng.client.texture.CableBusTextures;
|
||||||
import appeng.core.localization.PlayerMessages;
|
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
import appeng.tile.inventory.AppEngInternalInventory;
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
|
@ -79,15 +78,7 @@ public class PartTerminal extends PartMonitor implements ITerminalHost, IConfigM
|
||||||
if ( Platform.isClient() )
|
if ( Platform.isClient() )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ( proxy.isActive() )
|
Platform.openGUI( player, getHost().getTile(), side, getGui() );
|
||||||
Platform.openGUI( player, getHost().getTile(), side, getGui() );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( proxy.isPowered() )
|
|
||||||
player.addChatMessage( PlayerMessages.CommunicationError.get() );
|
|
||||||
else
|
|
||||||
player.addChatMessage( PlayerMessages.MachineNotPowered.get() );
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,6 +319,12 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onListUpdate()
|
||||||
|
{
|
||||||
|
// not used here
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ChestMonitorHandler<T extends IAEStack> extends MEMonitorHandler<T>
|
class ChestMonitorHandler<T extends IAEStack> extends MEMonitorHandler<T>
|
||||||
|
|
Loading…
Add table
Reference in a new issue