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
@@ -60,16 +60,14 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
double internalCurrentPower = 0;
double internalMaxPower = this.getAEMaxPower( stack );
if ( tag != null )
if( tag != null )
{
internalCurrentPower = tag.getDouble( "internalCurrentPower" );
}
double percent = internalCurrentPower / internalMaxPower;
lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower )
+ Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
}
@Override
@@ -114,15 +112,50 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
}
private double getInternalBattery( ItemStack is, batteryOperation op, double adjustment )
{
NBTTagCompound data = Platform.openNbtData( is );
double currentStorage = data.getDouble( this.POWER_NBT_KEY );
double maxStorage = this.getAEMaxPower( is );
switch( op )
{
case INJECT:
currentStorage += adjustment;
if( currentStorage > maxStorage )
{
double diff = currentStorage - maxStorage;
data.setDouble( this.POWER_NBT_KEY, maxStorage );
return diff;
}
data.setDouble( this.POWER_NBT_KEY, currentStorage );
return 0;
case EXTRACT:
if( currentStorage > adjustment )
{
currentStorage -= adjustment;
data.setDouble( this.POWER_NBT_KEY, currentStorage );
return adjustment;
}
data.setDouble( this.POWER_NBT_KEY, 0 );
return currentStorage;
default:
break;
}
return currentStorage;
}
/**
* inject external
*/
double injectExternalPower( PowerUnits input, ItemStack is, double amount, boolean simulate )
{
if ( simulate )
if( simulate )
{
int requiredEU = ( int ) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( is ) - this.getAECurrentPower( is ) );
if ( amount < requiredEU )
int requiredEU = (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( is ) - this.getAECurrentPower( is ) );
if( amount < requiredEU )
return 0;
return amount - requiredEU;
}
@@ -145,41 +178,6 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
return this.getInternalBattery( is, batteryOperation.EXTRACT, amt );
}
private double getInternalBattery( ItemStack is, batteryOperation op, double adjustment )
{
NBTTagCompound data = Platform.openNbtData( is );
double currentStorage = data.getDouble( this.POWER_NBT_KEY );
double maxStorage = this.getAEMaxPower( is );
switch ( op )
{
case INJECT:
currentStorage += adjustment;
if ( currentStorage > maxStorage )
{
double diff = currentStorage - maxStorage;
data.setDouble( this.POWER_NBT_KEY, maxStorage );
return diff;
}
data.setDouble( this.POWER_NBT_KEY, currentStorage );
return 0;
case EXTRACT:
if ( currentStorage > adjustment )
{
currentStorage -= adjustment;
data.setDouble( this.POWER_NBT_KEY, currentStorage );
return adjustment;
}
data.setDouble( this.POWER_NBT_KEY, 0 );
return currentStorage;
default:
break;
}
return currentStorage;
}
@Override
public double getAEMaxPower( ItemStack is )
{
@@ -202,5 +200,4 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
{
STORAGE, INJECT, EXTRACT
}
}
@@ -33,8 +33,7 @@ import appeng.transformer.annotations.Integration.InterfaceList;
import appeng.transformer.annotations.Integration.Method;
@InterfaceList( value = { @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = "IC2" ),
@Interface( iface = "ic2.api.item.IElectricItemManager", iname = "IC2" ) } )
@InterfaceList( value = { @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = "IC2" ), @Interface( iface = "ic2.api.item.IElectricItemManager", iname = "IC2" ) } )
public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem
{
public IC2( double powerCapacity, Optional<String> subName )
@@ -48,10 +47,10 @@ public abstract class IC2 extends AERootPoweredItem implements IElectricItemMana
double addedAmt = amount;
double limit = this.getTransferLimit( is );
if ( !ignoreTransferLimit && amount > limit )
if( !ignoreTransferLimit && amount > limit )
addedAmt = limit;
return addedAmt - ( ( int ) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) );
return addedAmt - ( (int) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) );
}
@Override
@@ -63,7 +62,7 @@ public abstract class IC2 extends AERootPoweredItem implements IElectricItemMana
@Override
public double getCharge( ItemStack is )
{
return ( int ) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) );
return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) );
}
@Override
@@ -75,7 +74,7 @@ public abstract class IC2 extends AERootPoweredItem implements IElectricItemMana
@Override
public boolean use( ItemStack is, double amount, EntityLivingBase entity )
{
if ( this.canUse( is, amount ) )
if( this.canUse( is, amount ) )
{
// use the power..
this.extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
@@ -138,5 +137,4 @@ public abstract class IC2 extends AERootPoweredItem implements IElectricItemMana
{
return this;
}
}