Wireless Terminal Gui Works, dose not support range, or WAPs
This commit is contained in:
@@ -40,24 +40,29 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
monitor = montiorable.getItemInventory();
|
||||
monitor.addListener( this, null );
|
||||
|
||||
cellInv = monitor;
|
||||
|
||||
if ( montiorable instanceof IPortableCell )
|
||||
powerSrc = (IPortableCell) montiorable;
|
||||
else if ( montiorable instanceof IMEChest )
|
||||
powerSrc = (IMEChest) montiorable;
|
||||
else if ( montiorable instanceof IGridHost )
|
||||
if ( monitor != null )
|
||||
{
|
||||
IGridNode node = ((IGridHost) montiorable).getGridNode( ForgeDirection.UNKNOWN );
|
||||
if ( node != null )
|
||||
monitor.addListener( this, null );
|
||||
|
||||
cellInv = monitor;
|
||||
|
||||
if ( montiorable instanceof IPortableCell )
|
||||
powerSrc = (IPortableCell) montiorable;
|
||||
else if ( montiorable instanceof IMEChest )
|
||||
powerSrc = (IMEChest) montiorable;
|
||||
else if ( montiorable instanceof IGridHost )
|
||||
{
|
||||
IGrid g = node.getGrid();
|
||||
if ( g != null )
|
||||
powerSrc = g.getCache( IEnergyGrid.class );
|
||||
IGridNode node = ((IGridHost) montiorable).getGridNode( ForgeDirection.UNKNOWN );
|
||||
if ( node != null )
|
||||
{
|
||||
IGrid g = node.getGrid();
|
||||
if ( g != null )
|
||||
powerSrc = g.getCache( IEnergyGrid.class );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
ip.player.closeScreen();
|
||||
}
|
||||
else
|
||||
monitor = null;
|
||||
@@ -122,7 +127,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito
|
||||
{
|
||||
super.addCraftingToCrafters( c );
|
||||
|
||||
if ( Platform.isServer() && c instanceof Player )
|
||||
if ( Platform.isServer() && c instanceof Player && monitor != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -168,7 +173,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito
|
||||
{
|
||||
super.removeCraftingFromCrafters( c );
|
||||
|
||||
if ( this.crafters.isEmpty() )
|
||||
if ( this.crafters.isEmpty() && monitor != null )
|
||||
monitor.removeListener( this );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,28 @@
|
||||
package appeng.container.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.helpers.WirelessTerminalGuiObject;
|
||||
|
||||
public class ContainerWirelessTerm extends ContainerMEPortableCell
|
||||
{
|
||||
|
||||
public ContainerWirelessTerm(InventoryPlayer ip, IPortableCell montiorable) {
|
||||
WirelessTerminalGuiObject wtgo;
|
||||
|
||||
public ContainerWirelessTerm(InventoryPlayer ip, WirelessTerminalGuiObject montiorable) {
|
||||
super( ip, montiorable );
|
||||
wtgo = montiorable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
|
||||
if ( !wtgo.rangeCheck() )
|
||||
{
|
||||
getPlayerInv().player.closeScreen();
|
||||
getPlayerInv().player.sendChatToPlayer( PlayerMessages.OutOfRange.get() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user