Fixed Crash in Portable Cell.

Can no longer pick up Open Portable Cell.
Can no longer insert Portable Cell into itself.
This commit is contained in:
AlgorithmX2 2014-02-01 16:25:15 -06:00
parent fbcee6ca12
commit 58d9939503
2 changed files with 15 additions and 8 deletions

View file

@ -2,12 +2,13 @@ package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.container.implementations.ContainerMEPortableCell;
public class GuiMEPortableCell extends GuiMEMonitorable
{
public GuiMEPortableCell(InventoryPlayer inventoryPlayer, IPortableCell te) {
super( inventoryPlayer, te );
super( inventoryPlayer, te, new ContainerMEPortableCell( inventoryPlayer, null ) );
maxRows = 3;
}

View file

@ -14,9 +14,10 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
IPortableCell civ;
public ContainerMEPortableCell(InventoryPlayer ip, IPortableCell montiorable) {
super( ip, (IStorageMonitorable) montiorable, Platform.isServer() );
super( ip, (IStorageMonitorable) montiorable, false );
lockPlayerInventorySlot( ip.currentItem );
civ = montiorable;
bindPlayerInventory( ip, 0, 0 );
}
int ticks = 0;
@ -26,18 +27,23 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
{
ItemStack currentItem = getPlayerInv().getCurrentItem();
if ( currentItem != civ.getItemStack() )
if ( civ != null )
{
if ( currentItem != null )
if ( currentItem != civ.getItemStack() )
{
if ( Platform.isSameItem( civ.getItemStack(), currentItem ) )
getPlayerInv().setInventorySlotContents( getPlayerInv().currentItem, civ.getItemStack() );
if ( currentItem != null )
{
if ( Platform.isSameItem( civ.getItemStack(), currentItem ) )
getPlayerInv().setInventorySlotContents( getPlayerInv().currentItem, civ.getItemStack() );
else
getPlayerInv().player.closeScreen();
}
else
getPlayerInv().player.closeScreen();
}
else
getPlayerInv().player.closeScreen();
}
else
getPlayerInv().player.closeScreen();
// drain 1 ae t
ticks++;