Basic reformat, hit once, hope never again

This commit is contained in:
thatsIch
2015-04-03 08:54:31 +02:00
parent 4ff1631f89
commit d34c988c88
886 changed files with 31400 additions and 30990 deletions
@@ -18,6 +18,7 @@
package appeng.me.storage;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -38,30 +39,16 @@ import appeng.util.item.AEItemStack;
import appeng.util.prioitylist.FuzzyPriorityList;
import appeng.util.prioitylist.PrecisePriorityList;
public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> implements ICellInventoryHandler
{
NBTTagCompound openNbtData()
CellInventoryHandler( IMEInventory c )
{
return Platform.openNbtData( this.getCellInv().getItemStack() );
}
@Override
public ICellInventory getCellInv()
{
Object o = this.internal;
if ( o instanceof MEPassThrough )
o = ((MEPassThrough) o).getInternal();
return (ICellInventory) (o instanceof ICellInventory ? o : null);
}
CellInventoryHandler(IMEInventory c) {
super( c, StorageChannel.ITEMS );
ICellInventory ci = this.getCellInv();
if ( ci != null )
if( ci != null )
{
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
@@ -72,40 +59,40 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
boolean hasInverter = false;
boolean hasFuzzy = false;
for (int x = 0; x < upgrades.getSizeInventory(); x++)
for( int x = 0; x < upgrades.getSizeInventory(); x++ )
{
ItemStack is = upgrades.getStackInSlot( x );
if ( is != null && is.getItem() instanceof IUpgradeModule )
if( is != null && is.getItem() instanceof IUpgradeModule )
{
Upgrades u = ((IUpgradeModule) is.getItem()).getType( is );
if ( u != null )
Upgrades u = ( (IUpgradeModule) is.getItem() ).getType( is );
if( u != null )
{
switch (u)
switch( u )
{
case FUZZY:
hasFuzzy = true;
break;
case INVERTER:
hasInverter = true;
break;
default:
case FUZZY:
hasFuzzy = true;
break;
case INVERTER:
hasInverter = true;
break;
default:
}
}
}
}
for (int x = 0; x < config.getSizeInventory(); x++)
for( int x = 0; x < config.getSizeInventory(); x++ )
{
ItemStack is = config.getStackInSlot( x );
if ( is != null )
if( is != null )
priorityList.add( AEItemStack.create( is ) );
}
this.setWhitelist( hasInverter ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST );
if ( !priorityList.isEmpty() )
if( !priorityList.isEmpty() )
{
if ( hasFuzzy )
if( hasFuzzy )
this.setPartitionList( new FuzzyPriorityList<IAEItemStack>( priorityList, fzMode ) );
else
this.setPartitionList( new PrecisePriorityList<IAEItemStack>( priorityList ) );
@@ -113,10 +100,21 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
}
}
@Override
public ICellInventory getCellInv()
{
Object o = this.internal;
if( o instanceof MEPassThrough )
o = ( (MEPassThrough) o ).getInternal();
return (ICellInventory) ( o instanceof ICellInventory ? o : null );
}
@Override
public boolean isPreformatted()
{
return ! this.getPartitionList().isEmpty();
return !this.getPartitionList().isEmpty();
}
@Override
@@ -131,14 +129,18 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
return this.getWhitelist();
}
public int getStatusForCell()
NBTTagCompound openNbtData()
{
int val = this.getCellInv().getStatusForCell();
if ( val == 1 && this.isPreformatted() )
val = 2;
return val;
return Platform.openNbtData( this.getCellInv().getItemStack() );
}
public int getStatusForCell()
{
int val = this.getCellInv().getStatusForCell();
if( val == 1 && this.isPreformatted() )
val = 2;
return val;
}
}