You can now access the contents of the ME Chest if it has energy in its battery.

This commit is contained in:
AlgorithmX2 2014-02-09 01:56:24 -06:00
parent 49da876b6f
commit 36c3834284
2 changed files with 27 additions and 12 deletions

View file

@ -1,7 +1,6 @@
package appeng.block.storage; package appeng.block.storage;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -18,6 +17,7 @@ import appeng.client.render.blocks.RenderMEChest;
import appeng.core.features.AEFeature; import appeng.core.features.AEFeature;
import appeng.core.localization.PlayerMessages; import appeng.core.localization.PlayerMessages;
import appeng.core.sync.GuiBridge; import appeng.core.sync.GuiBridge;
import appeng.helpers.AENoHandler;
import appeng.tile.storage.TileChest; import appeng.tile.storage.TileChest;
import appeng.util.Platform; import appeng.util.Platform;
@ -56,20 +56,35 @@ public class BlockChest extends AEBaseBlock
{ {
ICellHandler ch = AEApi.instance().registries().cell().getHander( cell ); ICellHandler ch = AEApi.instance().registries().cell().getHander( cell );
List<IMEInventoryHandler> ih = tg.getCellArray( StorageChannel.ITEMS ); try
if ( ch != null && ih != null && ih.size() == 1 )
{ {
IMEInventoryHandler mine = ih.get( 0 ); IMEInventoryHandler ih = tg.getHandler( StorageChannel.ITEMS );
ch.openChestGui( p, tg, ch, mine, cell, StorageChannel.ITEMS ); if ( ch != null && ih != null )
return true; {
IMEInventoryHandler mine = ih;
ch.openChestGui( p, tg, ch, mine, cell, StorageChannel.ITEMS );
return true;
}
}
catch (AENoHandler e)
{
// :P
} }
List<IMEInventoryHandler> fh = tg.getCellArray( StorageChannel.FLUIDS ); try
if ( ch != null && fh != null && ih.size() == 1 )
{ {
IMEInventoryHandler mine = fh.get( 0 ); IMEInventoryHandler fh = tg.getHandler( StorageChannel.FLUIDS );
ch.openChestGui( p, tg, ch, mine, cell, StorageChannel.FLUIDS ); if ( ch != null && fh != null )
return true; {
IMEInventoryHandler mine = fh;
ch.openChestGui( p, tg, ch, mine, cell, StorageChannel.FLUIDS );
return true;
}
}
catch (AENoHandler e)
{
// :P
} }
} }

View file

@ -330,7 +330,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
return g; return g;
} }
private IMEInventoryHandler getHandler(StorageChannel channel) throws AENoHandler public IMEInventoryHandler getHandler(StorageChannel channel) throws AENoHandler
{ {
if ( !isCached ) if ( !isCached )
{ {