final variables and parameters

seeing some methods it does actually help to enforce the parameters
This commit is contained in:
thatsIch
2015-09-25 23:10:56 +02:00
parent e52400bf26
commit 410d2f1e0d
819 changed files with 9390 additions and 9396 deletions
@@ -45,7 +45,7 @@ public class ToolChargedStaff extends AEBasePoweredItem
}
@Override
public boolean hitEntity( ItemStack item, EntityLivingBase target, EntityLivingBase hitter )
public boolean hitEntity( final ItemStack item, final EntityLivingBase target, final EntityLivingBase hitter )
{
if( this.getAECurrentPower( item ) > 300 )
{
@@ -54,9 +54,9 @@ public class ToolChargedStaff extends AEBasePoweredItem
{
for( int x = 0; x < 2; x++ )
{
float dx = (float) ( Platform.getRandomFloat() * target.width + target.boundingBox.minX );
float dy = (float) ( Platform.getRandomFloat() * target.height + target.boundingBox.minY );
float dz = (float) ( Platform.getRandomFloat() * target.width + target.boundingBox.minZ );
final float dx = (float) ( Platform.getRandomFloat() * target.width + target.boundingBox.minX );
final float dy = (float) ( Platform.getRandomFloat() * target.height + target.boundingBox.minY );
final float dz = (float) ( Platform.getRandomFloat() * target.width + target.boundingBox.minZ );
ServerHelper.proxy.sendToAllNearExcept( null, dx, dy, dz, 32.0, target.worldObj, new PacketLightning( dx, dy, dz ) );
}
}
@@ -87,7 +87,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
static
{
for( AEColor col : AEColor.values() )
for( final AEColor col : AEColor.values() )
{
if( col == AEColor.Transparent )
{
@@ -116,16 +116,16 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
}
@Override
public boolean onItemUse( ItemStack is, EntityPlayer p, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
public boolean onItemUse( final ItemStack is, final EntityPlayer p, final World w, final int x, final int y, final int z, final int side, final float hitX, final float hitY, final float hitZ )
{
Block blk = w.getBlock( x, y, z );
final Block blk = w.getBlock( x, y, z );
ItemStack paintBall = this.getColor( is );
IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
final IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
if( inv != null )
{
IAEItemStack option = inv.extractItems( AEItemStack.create( paintBall ), Actionable.SIMULATE, new BaseActionSource() );
final IAEItemStack option = inv.extractItems( AEItemStack.create( paintBall ), Actionable.SIMULATE, new BaseActionSource() );
if( option != null )
{
@@ -142,11 +142,11 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
return false;
}
double powerPerUse = 100;
final double powerPerUse = 100;
if( paintBall != null && paintBall.getItem() instanceof ItemSnowball )
{
ForgeDirection orientation = ForgeDirection.getOrientation( side );
TileEntity te = w.getTileEntity( x, y, z );
final ForgeDirection orientation = ForgeDirection.getOrientation( side );
final TileEntity te = w.getTileEntity( x, y, z );
// clean cables.
if( te instanceof IColorableTile )
{
@@ -162,8 +162,8 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
}
// clean paint balls..
Block testBlk = w.getBlock( x + orientation.offsetX, y + orientation.offsetY, z + orientation.offsetZ );
TileEntity painted = w.getTileEntity( x + orientation.offsetX, y + orientation.offsetY, z + orientation.offsetZ );
final Block testBlk = w.getBlock( x + orientation.offsetX, y + orientation.offsetY, z + orientation.offsetZ );
final TileEntity painted = w.getTileEntity( x + orientation.offsetX, y + orientation.offsetY, z + orientation.offsetZ );
if( this.getAECurrentPower( is ) > powerPerUse && testBlk instanceof BlockPaint && painted instanceof TilePaint )
{
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
@@ -174,7 +174,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
}
else if( paintBall != null )
{
AEColor color = this.getColorFromItem( paintBall );
final AEColor color = this.getColorFromItem( paintBall );
if( color != null && this.getAECurrentPower( is ) > powerPerUse )
{
@@ -197,11 +197,11 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
}
@Override
public String getItemStackDisplayName( ItemStack par1ItemStack )
public String getItemStackDisplayName( final ItemStack par1ItemStack )
{
String extra = GuiText.Empty.getLocal();
AEColor selected = this.getActiveColor( par1ItemStack );
final AEColor selected = this.getActiveColor( par1ItemStack );
if( selected != null && Platform.isClient() )
{
@@ -211,12 +211,12 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
return super.getItemStackDisplayName( par1ItemStack ) + " - " + extra;
}
public AEColor getActiveColor( ItemStack tol )
public AEColor getActiveColor( final ItemStack tol )
{
return this.getColorFromItem( this.getColor( tol ) );
}
public AEColor getColorFromItem( ItemStack paintBall )
public AEColor getColorFromItem( final ItemStack paintBall )
{
if( paintBall == null )
{
@@ -230,14 +230,14 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
if( paintBall.getItem() instanceof ItemPaintBall )
{
ItemPaintBall ipb = (ItemPaintBall) paintBall.getItem();
final ItemPaintBall ipb = (ItemPaintBall) paintBall.getItem();
return ipb.getColor( paintBall );
}
else
{
int[] id = OreDictionary.getOreIDs( paintBall );
final int[] id = OreDictionary.getOreIDs( paintBall );
for( int oreID : id )
for( final int oreID : id )
{
if( ORE_TO_COLOR.containsKey( oreID ) )
{
@@ -249,13 +249,13 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
return null;
}
public ItemStack getColor( ItemStack is )
public ItemStack getColor( final ItemStack is )
{
NBTTagCompound c = is.getTagCompound();
final NBTTagCompound c = is.getTagCompound();
if( c != null && c.hasKey( "color" ) )
{
NBTTagCompound color = c.getCompoundTag( "color" );
ItemStack oldColor = ItemStack.loadItemStackFromNBT( color );
final NBTTagCompound color = c.getCompoundTag( "color" );
final ItemStack oldColor = ItemStack.loadItemStackFromNBT( color );
if( oldColor != null )
{
return oldColor;
@@ -265,17 +265,17 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
return this.findNextColor( is, null, 0 );
}
private ItemStack findNextColor( ItemStack is, ItemStack anchor, int scrollOffset )
private ItemStack findNextColor( final ItemStack is, final ItemStack anchor, final int scrollOffset )
{
ItemStack newColor = null;
IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
final IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, null, StorageChannel.ITEMS );
if( inv != null )
{
IItemList<IAEItemStack> itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
final IItemList<IAEItemStack> itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
if( anchor == null )
{
IAEItemStack firstItem = itemList.getFirstItem();
final IAEItemStack firstItem = itemList.getFirstItem();
if( firstItem != null )
{
newColor = firstItem.getItemStack();
@@ -283,9 +283,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
}
else
{
LinkedList<IAEItemStack> list = new LinkedList<IAEItemStack>();
final LinkedList<IAEItemStack> list = new LinkedList<IAEItemStack>();
for( IAEItemStack i : itemList )
for( final IAEItemStack i : itemList )
{
list.add( i );
}
@@ -294,7 +294,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
{
@Override
public int compare( IAEItemStack a, IAEItemStack b )
public int compare( final IAEItemStack a, final IAEItemStack b )
{
return ItemSorters.compareInt( a.getItemDamage(), b.getItemDamage() );
}
@@ -337,26 +337,26 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
return newColor;
}
public void setColor( ItemStack is, ItemStack newColor )
public void setColor( final ItemStack is, final ItemStack newColor )
{
NBTTagCompound data = Platform.openNbtData( is );
final NBTTagCompound data = Platform.openNbtData( is );
if( newColor == null )
{
data.removeTag( "color" );
}
else
{
NBTTagCompound color = new NBTTagCompound();
final NBTTagCompound color = new NBTTagCompound();
newColor.writeToNBT( color );
data.setTag( "color", color );
}
}
private boolean recolourBlock( Block blk, ForgeDirection side, World w, int x, int y, int z, ForgeDirection orientation, AEColor newColor, EntityPlayer p )
private boolean recolourBlock( final Block blk, final ForgeDirection side, final World w, final int x, final int y, final int z, final ForgeDirection orientation, final AEColor newColor, final EntityPlayer p )
{
if( blk == Blocks.carpet )
{
int meta = w.getBlockMetadata( x, y, z );
final int meta = w.getBlockMetadata( x, y, z );
if( newColor.ordinal() == meta )
{
return false;
@@ -371,7 +371,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
if( blk == Blocks.stained_glass )
{
int meta = w.getBlockMetadata( x, y, z );
final int meta = w.getBlockMetadata( x, y, z );
if( newColor.ordinal() == meta )
{
return false;
@@ -386,7 +386,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
if( blk == Blocks.stained_glass_pane )
{
int meta = w.getBlockMetadata( x, y, z );
final int meta = w.getBlockMetadata( x, y, z );
if( newColor.ordinal() == meta )
{
return false;
@@ -401,7 +401,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
if( blk == Blocks.stained_hardened_clay )
{
int meta = w.getBlockMetadata( x, y, z );
final int meta = w.getBlockMetadata( x, y, z );
if( newColor.ordinal() == meta )
{
return false;
@@ -417,7 +417,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
return blk.recolourBlock( w, x, y, z, side, newColor.ordinal() );
}
public void cycleColors( ItemStack is, ItemStack paintBall, int i )
public void cycleColors( final ItemStack is, final ItemStack paintBall, final int i )
{
if( paintBall == null )
{
@@ -430,15 +430,15 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
{
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
final IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
if( cdi instanceof CellInventoryHandler )
{
ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
final ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
if( cd != null )
{
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
@@ -448,37 +448,37 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
}
@Override
public int getBytes( ItemStack cellItem )
public int getBytes( final ItemStack cellItem )
{
return 512;
}
@Override
public int BytePerType( ItemStack cell )
public int BytePerType( final ItemStack cell )
{
return 8;
}
@Override
public int getBytesPerType( ItemStack cellItem )
public int getBytesPerType( final ItemStack cellItem )
{
return 8;
}
@Override
public int getTotalTypes( ItemStack cellItem )
public int getTotalTypes( final ItemStack cellItem )
{
return 27;
}
@Override
public boolean isBlackListed( ItemStack cellItem, IAEItemStack requestedAddition )
public boolean isBlackListed( final ItemStack cellItem, final IAEItemStack requestedAddition )
{
if( requestedAddition != null )
{
int[] id = OreDictionary.getOreIDs( requestedAddition.getItemStack() );
final int[] id = OreDictionary.getOreIDs( requestedAddition.getItemStack() );
for( int x : id )
for( final int x : id )
{
if( ORE_TO_COLOR.containsKey( x ) )
{
@@ -503,7 +503,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
}
@Override
public boolean isStorageCell( ItemStack i )
public boolean isStorageCell( final ItemStack i )
{
return true;
}
@@ -515,51 +515,51 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
}
@Override
public String getUnlocalizedGroupName( Set<ItemStack> others, ItemStack is )
public String getUnlocalizedGroupName( final Set<ItemStack> others, final ItemStack is )
{
return GuiText.StorageCells.getUnlocalized();
}
@Override
public boolean isEditable( ItemStack is )
public boolean isEditable( final ItemStack is )
{
return true;
}
@Override
public IInventory getUpgradesInventory( ItemStack is )
public IInventory getUpgradesInventory( final ItemStack is )
{
return new CellUpgrades( is, 2 );
}
@Override
public IInventory getConfigInventory( ItemStack is )
public IInventory getConfigInventory( final ItemStack is )
{
return new CellConfig( is );
}
@Override
public FuzzyMode getFuzzyMode( ItemStack is )
public FuzzyMode getFuzzyMode( final ItemStack is )
{
String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
try
{
return FuzzyMode.valueOf( fz );
}
catch( Throwable t )
catch( final Throwable t )
{
return FuzzyMode.IGNORE_ALL;
}
}
@Override
public void setFuzzyMode( ItemStack is, FuzzyMode fzMode )
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
{
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
}
@Override
public void onWheel( ItemStack is, boolean up )
public void onWheel( final ItemStack is, final boolean up )
{
this.cycleColors( is, this.getColor( is ), up ? 1 : -1 );
}
@@ -75,7 +75,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.flowing_lava, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( new ItemStack( Blocks.obsidian ) ) );
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.grass, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( new ItemStack( Blocks.dirt ) ) );
List<ItemStack> snowBalls = new ArrayList<ItemStack>();
final List<ItemStack> snowBalls = new ArrayList<ItemStack>();
snowBalls.add( new ItemStack( Items.snowball ) );
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.flowing_water, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( null, snowBalls ) );
this.coolDown.put( new InWorldToolOperationIngredient( Blocks.water, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( new ItemStack( Blocks.ice ) ) );
@@ -98,7 +98,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
private final Block blockID;
private final int metadata;
public InWorldToolOperationIngredient( Block blockID, int metadata )
public InWorldToolOperationIngredient( final Block blockID, final int metadata )
{
this.blockID = blockID;
this.metadata = metadata;
@@ -111,7 +111,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
}
@Override
public boolean equals( Object obj )
public boolean equals( final Object obj )
{
if( obj == null )
{
@@ -121,12 +121,12 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
{
return false;
}
InWorldToolOperationIngredient other = (InWorldToolOperationIngredient) obj;
final InWorldToolOperationIngredient other = (InWorldToolOperationIngredient) obj;
return this.blockID == other.blockID && this.metadata == other.metadata;
}
}
private void heat( Block blockID, int metadata, World w, int x, int y, int z )
private void heat( final Block blockID, final int metadata, final World w, final int x, final int y, final int z )
{
InWorldToolOperationResult r = this.heatUp.get( new InWorldToolOperationIngredient( blockID, metadata ) );
@@ -150,7 +150,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
}
}
private boolean canHeat( Block blockID, int metadata )
private boolean canHeat( final Block blockID, final int metadata )
{
InWorldToolOperationResult r = this.heatUp.get( new InWorldToolOperationIngredient( blockID, metadata ) );
@@ -162,7 +162,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
return r != null;
}
private void cool( Block blockID, int metadata, World w, int x, int y, int z )
private void cool( final Block blockID, final int metadata, final World w, final int x, final int y, final int z )
{
InWorldToolOperationResult r = this.coolDown.get( new InWorldToolOperationIngredient( blockID, metadata ) );
@@ -186,7 +186,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
}
}
private boolean canCool( Block blockID, int metadata )
private boolean canCool( final Block blockID, final int metadata )
{
InWorldToolOperationResult r = this.coolDown.get( new InWorldToolOperationIngredient( blockID, metadata ) );
@@ -199,7 +199,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
}
@Override
public boolean hitEntity( ItemStack item, EntityLivingBase target, EntityLivingBase hitter )
public boolean hitEntity( final ItemStack item, final EntityLivingBase target, final EntityLivingBase hitter )
{
if( this.getAECurrentPower( item ) > 1600 )
{
@@ -211,9 +211,9 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
}
@Override
public ItemStack onItemRightClick( ItemStack item, World w, EntityPlayer p )
public ItemStack onItemRightClick( final ItemStack item, final World w, final EntityPlayer p )
{
MovingObjectPosition target = this.getMovingObjectPositionFromPlayer( w, p, true );
final MovingObjectPosition target = this.getMovingObjectPositionFromPlayer( w, p, true );
if( target == null )
{
@@ -223,9 +223,9 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
{
if( target.typeOfHit == MovingObjectType.BLOCK )
{
int x = target.blockX;
int y = target.blockY;
int z = target.blockZ;
final int x = target.blockX;
final int y = target.blockY;
final int z = target.blockZ;
if( w.getBlock( x, y, z ).getMaterial() == Material.lava || w.getBlock( x, y, z ).getMaterial() == Material.water )
{
@@ -241,7 +241,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
}
@Override
public boolean onItemUse( ItemStack item, EntityPlayer p, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
public boolean onItemUse( final ItemStack item, final EntityPlayer p, final World w, int x, int y, int z, final int side, final float hitX, final float hitY, final float hitZ )
{
if( this.getAECurrentPower( item ) > 1600 )
{
@@ -250,8 +250,8 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
return false;
}
Block blockID = w.getBlock( x, y, z );
int metadata = w.getBlockMetadata( x, y, z );
final Block blockID = w.getBlock( x, y, z );
final int metadata = w.getBlockMetadata( x, y, z );
if( p.isSneaking() )
{
@@ -285,14 +285,14 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
return true;
}
ItemStack[] stack = Platform.getBlockDrops( w, x, y, z );
List<ItemStack> out = new ArrayList<ItemStack>();
final ItemStack[] stack = Platform.getBlockDrops( w, x, y, z );
final List<ItemStack> out = new ArrayList<ItemStack>();
boolean hasFurnaceable = false;
boolean canFurnaceable = true;
for( ItemStack i : stack )
for( final ItemStack i : stack )
{
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult( i );
final ItemStack result = FurnaceRecipes.smelting().getSmeltingResult( i );
if( result != null )
{
@@ -316,7 +316,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
if( hasFurnaceable && canFurnaceable )
{
this.extractAEPower( item, 1600 );
InWorldToolOperationResult or = InWorldToolOperationResult.getBlockOperationResult( out.toArray( new ItemStack[out.size()] ) );
final InWorldToolOperationResult or = InWorldToolOperationResult.getBlockOperationResult( out.toArray( new ItemStack[out.size()] ) );
w.playSoundEffect( x + 0.5D, y + 0.5D, z + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F );
if( or.BlockItem == null )
@@ -337,7 +337,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
}
else
{
ForgeDirection dir = ForgeDirection.getOrientation( side );
final ForgeDirection dir = ForgeDirection.getOrientation( side );
x += dir.offsetX;
y += dir.offsetY;
z += dir.offsetZ;
@@ -95,15 +95,15 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
{
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
final IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
if( cdi instanceof CellInventoryHandler )
{
ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
final ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
if( cd != null )
{
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
@@ -113,22 +113,22 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
}
@Override
public ItemStack onItemRightClick( ItemStack item, World w, EntityPlayer p )
public ItemStack onItemRightClick( final ItemStack item, final World w, final EntityPlayer p )
{
if( this.getAECurrentPower( item ) > 1600 )
{
int shots = 1;
CellUpgrades cu = (CellUpgrades) this.getUpgradesInventory( item );
final CellUpgrades cu = (CellUpgrades) this.getUpgradesInventory( item );
if( cu != null )
{
shots += cu.getInstalledUpgrades( Upgrades.SPEED );
}
IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( item, null, StorageChannel.ITEMS );
final IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( item, null, StorageChannel.ITEMS );
if( inv != null )
{
IItemList itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
final IItemList itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
IAEStack aeAmmo = itemList.getFirstItem();
if( aeAmmo instanceof IAEItemStack )
{
@@ -143,7 +143,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
}
aeAmmo.setStackSize( 1 );
ItemStack ammo = ( (IAEItemStack) aeAmmo ).getItemStack();
final ItemStack ammo = ( (IAEItemStack) aeAmmo ).getItemStack();
if( ammo == null )
{
return item;
@@ -156,29 +156,29 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
return item;
}
float f = 1.0F;
float f1 = p.prevRotationPitch + ( p.rotationPitch - p.prevRotationPitch ) * f;
float f2 = p.prevRotationYaw + ( p.rotationYaw - p.prevRotationYaw ) * f;
double d0 = p.prevPosX + ( p.posX - p.prevPosX ) * f;
double d1 = p.prevPosY + ( p.posY - p.prevPosY ) * f + 1.62D - p.yOffset;
double d2 = p.prevPosZ + ( p.posZ - p.prevPosZ ) * f;
Vec3 vec3 = Vec3.createVectorHelper( d0, d1, d2 );
float f3 = MathHelper.cos( -f2 * 0.017453292F - (float) Math.PI );
float f4 = MathHelper.sin( -f2 * 0.017453292F - (float) Math.PI );
float f5 = -MathHelper.cos( -f1 * 0.017453292F );
float f6 = MathHelper.sin( -f1 * 0.017453292F );
float f7 = f4 * f5;
float f8 = f3 * f5;
double d3 = 32.0D;
final float f = 1.0F;
final float f1 = p.prevRotationPitch + ( p.rotationPitch - p.prevRotationPitch ) * f;
final float f2 = p.prevRotationYaw + ( p.rotationYaw - p.prevRotationYaw ) * f;
final double d0 = p.prevPosX + ( p.posX - p.prevPosX ) * f;
final double d1 = p.prevPosY + ( p.posY - p.prevPosY ) * f + 1.62D - p.yOffset;
final double d2 = p.prevPosZ + ( p.posZ - p.prevPosZ ) * f;
final Vec3 vec3 = Vec3.createVectorHelper( d0, d1, d2 );
final float f3 = MathHelper.cos( -f2 * 0.017453292F - (float) Math.PI );
final float f4 = MathHelper.sin( -f2 * 0.017453292F - (float) Math.PI );
final float f5 = -MathHelper.cos( -f1 * 0.017453292F );
final float f6 = MathHelper.sin( -f1 * 0.017453292F );
final float f7 = f4 * f5;
final float f8 = f3 * f5;
final double d3 = 32.0D;
Vec3 vec31 = vec3.addVector( f7 * d3, f6 * d3, f8 * d3 );
Vec3 direction = Vec3.createVectorHelper( f7 * d3, f6 * d3, f8 * d3 );
final Vec3 vec31 = vec3.addVector( f7 * d3, f6 * d3, f8 * d3 );
final Vec3 direction = Vec3.createVectorHelper( f7 * d3, f6 * d3, f8 * d3 );
direction.normalize();
float penetration = AEApi.instance().registries().matterCannon().getPenetration( ammo ); // 196.96655f;
final float penetration = AEApi.instance().registries().matterCannon().getPenetration( ammo ); // 196.96655f;
if( penetration <= 0 )
{
ItemStack type = ( (IAEItemStack) aeAmmo ).getItemStack();
final ItemStack type = ( (IAEItemStack) aeAmmo ).getItemStack();
if( type.getItem() instanceof ItemPaintBall )
{
this.shootPaintBalls( type, w, p, vec3, vec31, direction, d0, d1, d2 );
@@ -204,17 +204,17 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
return item;
}
private void shootPaintBalls( ItemStack type, World w, EntityPlayer p, Vec3 vec3, Vec3 vec31, Vec3 direction, double d0, double d1, double d2 )
private void shootPaintBalls( final ItemStack type, final World w, final EntityPlayer p, final Vec3 vec3, final Vec3 vec31, final Vec3 direction, final double d0, final double d1, final double d2 )
{
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ), Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );
final AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ), Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );
Entity entity = null;
List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
final List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
double closest = 9999999.0D;
for( int l = 0; l < list.size(); ++l )
{
Entity entity1 = (Entity) list.get( l );
final Entity entity1 = (Entity) list.get( l );
if( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
{
@@ -226,14 +226,14 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
continue;
}
float f1 = 0.3F;
final float f1 = 0.3F;
AxisAlignedBB boundingBox = entity1.boundingBox.expand( f1, f1, f1 );
MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );
final AxisAlignedBB boundingBox = entity1.boundingBox.expand( f1, f1, f1 );
final MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );
if( movingObjectPosition != null )
{
double nd = vec3.squareDistanceTo( movingObjectPosition.hitVec );
final double nd = vec3.squareDistanceTo( movingObjectPosition.hitVec );
if( nd < closest )
{
@@ -247,7 +247,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
MovingObjectPosition pos = w.rayTraceBlocks( vec3, vec31, false );
Vec3 vec = Vec3.createVectorHelper( d0, d1, d2 );
final Vec3 vec = Vec3.createVectorHelper( d0, d1, d2 );
if( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
{
pos = new MovingObjectPosition( entity );
@@ -261,27 +261,27 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
{
CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.xCoord, (float) direction.yCoord, (float) direction.zCoord, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
}
catch( Exception err )
catch( final Exception err )
{
AELog.error( err );
}
if( pos != null && type != null && type.getItem() instanceof ItemPaintBall )
{
ItemPaintBall ipb = (ItemPaintBall) type.getItem();
final ItemPaintBall ipb = (ItemPaintBall) type.getItem();
AEColor col = ipb.getColor( type );
final AEColor col = ipb.getColor( type );
// boolean lit = ipb.isLumen( type );
if( pos.typeOfHit == MovingObjectType.ENTITY )
{
int id = pos.entityHit.getEntityId();
PlayerColor marker = new PlayerColor( id, col, 20 * 30 );
final int id = pos.entityHit.getEntityId();
final PlayerColor marker = new PlayerColor( id, col, 20 * 30 );
TickHandler.INSTANCE.getPlayerColors().put( id, marker );
if( pos.entityHit instanceof EntitySheep )
{
EntitySheep sh = (EntitySheep) pos.entityHit;
final EntitySheep sh = (EntitySheep) pos.entityHit;
sh.setFleeceColor( col.ordinal() );
}
@@ -290,27 +290,27 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
}
else if( pos.typeOfHit == MovingObjectType.BLOCK )
{
ForgeDirection side = ForgeDirection.getOrientation( pos.sideHit );
final ForgeDirection side = ForgeDirection.getOrientation( pos.sideHit );
int x = pos.blockX + side.offsetX;
int y = pos.blockY + side.offsetY;
int z = pos.blockZ + side.offsetZ;
final int x = pos.blockX + side.offsetX;
final int y = pos.blockY + side.offsetY;
final int z = pos.blockZ + side.offsetZ;
if( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
{
return;
}
Block whatsThere = w.getBlock( x, y, z );
final Block whatsThere = w.getBlock( x, y, z );
if( whatsThere.isReplaceable( w, x, y, z ) && w.isAirBlock( x, y, z ) )
{
for( Block paintBlock : AEApi.instance().definitions().blocks().paint().maybeBlock().asSet() )
for( final Block paintBlock : AEApi.instance().definitions().blocks().paint().maybeBlock().asSet() )
{
w.setBlock( x, y, z, paintBlock, 0, 3 );
}
}
TileEntity te = w.getTileEntity( x, y, z );
final TileEntity te = w.getTileEntity( x, y, z );
if( te instanceof TilePaint )
{
pos.hitVec.xCoord -= x;
@@ -322,22 +322,22 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
}
}
private void standardAmmo( float penetration, World w, EntityPlayer p, Vec3 vec3, Vec3 vec31, Vec3 direction, double d0, double d1, double d2 )
private void standardAmmo( float penetration, final World w, final EntityPlayer p, final Vec3 vec3, final Vec3 vec31, final Vec3 direction, final double d0, final double d1, final double d2 )
{
boolean hasDestroyed = true;
while( penetration > 0 && hasDestroyed )
{
hasDestroyed = false;
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ), Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );
final AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ), Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );
Entity entity = null;
List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
final List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
double closest = 9999999.0D;
for( int l = 0; l < list.size(); ++l )
{
Entity entity1 = (Entity) list.get( l );
final Entity entity1 = (Entity) list.get( l );
if( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
{
@@ -349,14 +349,14 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
continue;
}
float f1 = 0.3F;
final float f1 = 0.3F;
AxisAlignedBB boundingBox = entity1.boundingBox.expand( f1, f1, f1 );
MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );
final AxisAlignedBB boundingBox = entity1.boundingBox.expand( f1, f1, f1 );
final MovingObjectPosition movingObjectPosition = boundingBox.calculateIntercept( vec3, vec31 );
if( movingObjectPosition != null )
{
double nd = vec3.squareDistanceTo( movingObjectPosition.hitVec );
final double nd = vec3.squareDistanceTo( movingObjectPosition.hitVec );
if( nd < closest )
{
@@ -368,7 +368,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
}
}
Vec3 vec = Vec3.createVectorHelper( d0, d1, d2 );
final Vec3 vec = Vec3.createVectorHelper( d0, d1, d2 );
MovingObjectPosition pos = w.rayTraceBlocks( vec3, vec31, true );
if( entity != null && pos != null && pos.hitVec.squareDistanceTo( vec ) > closest )
{
@@ -383,22 +383,22 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
{
CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.xCoord, (float) direction.yCoord, (float) direction.zCoord, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
}
catch( Exception err )
catch( final Exception err )
{
AELog.error( err );
}
if( pos != null )
{
DamageSource dmgSrc = DamageSource.causePlayerDamage( p );
final DamageSource dmgSrc = DamageSource.causePlayerDamage( p );
dmgSrc.damageType = "masscannon";
if( pos.typeOfHit == MovingObjectType.ENTITY )
{
int dmg = (int) Math.ceil( penetration / 20.0f );
final int dmg = (int) Math.ceil( penetration / 20.0f );
if( pos.entityHit instanceof EntityLivingBase )
{
EntityLivingBase el = (EntityLivingBase) pos.entityHit;
final EntityLivingBase el = (EntityLivingBase) pos.entityHit;
penetration -= dmg;
el.knockBack( p, 0, -direction.xCoord, -direction.zCoord );
// el.knockBack( p, 0, vec3.xCoord,
@@ -427,11 +427,11 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
}
else
{
Block b = w.getBlock( pos.blockX, pos.blockY, pos.blockZ );
final Block b = w.getBlock( pos.blockX, pos.blockY, pos.blockZ );
// int meta = w.getBlockMetadata(
// pos.blockX, pos.blockY, pos.blockZ );
float hardness = b.getBlockHardness( w, pos.blockX, pos.blockY, pos.blockZ ) * 9.0f;
final float hardness = b.getBlockHardness( w, pos.blockX, pos.blockY, pos.blockZ ) * 9.0f;
if( hardness >= 0.0 )
{
if( penetration > hardness && Platform.hasPermissions( new DimensionalCoord( w, pos.blockX, pos.blockY, pos.blockZ ), p ) )
@@ -450,71 +450,71 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
}
@Override
public boolean isEditable( ItemStack is )
public boolean isEditable( final ItemStack is )
{
return true;
}
@Override
public IInventory getUpgradesInventory( ItemStack is )
public IInventory getUpgradesInventory( final ItemStack is )
{
return new CellUpgrades( is, 4 );
}
@Override
public IInventory getConfigInventory( ItemStack is )
public IInventory getConfigInventory( final ItemStack is )
{
return new CellConfig( is );
}
@Override
public FuzzyMode getFuzzyMode( ItemStack is )
public FuzzyMode getFuzzyMode( final ItemStack is )
{
String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
try
{
return FuzzyMode.valueOf( fz );
}
catch( Throwable t )
catch( final Throwable t )
{
return FuzzyMode.IGNORE_ALL;
}
}
@Override
public void setFuzzyMode( ItemStack is, FuzzyMode fzMode )
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
{
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
}
@Override
public int getBytes( ItemStack cellItem )
public int getBytes( final ItemStack cellItem )
{
return 512;
}
@Override
public int BytePerType( ItemStack cell )
public int BytePerType( final ItemStack cell )
{
return 8;
}
@Override
public int getBytesPerType( ItemStack cellItem )
public int getBytesPerType( final ItemStack cellItem )
{
return 8;
}
@Override
public int getTotalTypes( ItemStack cellItem )
public int getTotalTypes( final ItemStack cellItem )
{
return 1;
}
@Override
public boolean isBlackListed( ItemStack cellItem, IAEItemStack requestedAddition )
public boolean isBlackListed( final ItemStack cellItem, final IAEItemStack requestedAddition )
{
float pen = AEApi.instance().registries().matterCannon().getPenetration( requestedAddition.getItemStack() );
final float pen = AEApi.instance().registries().matterCannon().getPenetration( requestedAddition.getItemStack() );
if( pen > 0 )
{
return false;
@@ -535,7 +535,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
}
@Override
public boolean isStorageCell( ItemStack i )
public boolean isStorageCell( final ItemStack i )
{
return true;
}
@@ -66,7 +66,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
}
@Override
public ItemStack onItemRightClick( ItemStack item, World w, EntityPlayer player )
public ItemStack onItemRightClick( final ItemStack item, final World w, final EntityPlayer player )
{
Platform.openGUI( player, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_PORTABLE_CELL );
return item;
@@ -80,15 +80,15 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
{
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
final IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
if( cdi instanceof CellInventoryHandler )
{
ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
final ICellInventory cd = ( (ICellInventoryHandler) cdi ).getCellInv();
if( cd != null )
{
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + ' ' + cd.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal() );
@@ -98,31 +98,31 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
}
@Override
public int getBytes( ItemStack cellItem )
public int getBytes( final ItemStack cellItem )
{
return 512;
}
@Override
public int BytePerType( ItemStack cell )
public int BytePerType( final ItemStack cell )
{
return 8;
}
@Override
public int getBytesPerType( ItemStack cellItem )
public int getBytesPerType( final ItemStack cellItem )
{
return 8;
}
@Override
public int getTotalTypes( ItemStack cellItem )
public int getTotalTypes( final ItemStack cellItem )
{
return 27;
}
@Override
public boolean isBlackListed( ItemStack cellItem, IAEItemStack requestedAddition )
public boolean isBlackListed( final ItemStack cellItem, final IAEItemStack requestedAddition )
{
return false;
}
@@ -134,7 +134,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
}
@Override
public boolean isStorageCell( ItemStack i )
public boolean isStorageCell( final ItemStack i )
{
return true;
}
@@ -146,51 +146,51 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
}
@Override
public String getUnlocalizedGroupName( Set<ItemStack> others, ItemStack is )
public String getUnlocalizedGroupName( final Set<ItemStack> others, final ItemStack is )
{
return GuiText.StorageCells.getUnlocalized();
}
@Override
public boolean isEditable( ItemStack is )
public boolean isEditable( final ItemStack is )
{
return true;
}
@Override
public IInventory getUpgradesInventory( ItemStack is )
public IInventory getUpgradesInventory( final ItemStack is )
{
return new CellUpgrades( is, 2 );
}
@Override
public IInventory getConfigInventory( ItemStack is )
public IInventory getConfigInventory( final ItemStack is )
{
return new CellConfig( is );
}
@Override
public FuzzyMode getFuzzyMode( ItemStack is )
public FuzzyMode getFuzzyMode( final ItemStack is )
{
String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
final String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
try
{
return FuzzyMode.valueOf( fz );
}
catch( Throwable t )
catch( final Throwable t )
{
return FuzzyMode.IGNORE_ALL;
}
}
@Override
public void setFuzzyMode( ItemStack is, FuzzyMode fzMode )
public void setFuzzyMode( final ItemStack is, final FuzzyMode fzMode )
{
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
}
@Override
public IGuiItemObject getGuiObject( ItemStack is, World w, int x, int y, int z )
public IGuiItemObject getGuiObject( final ItemStack is, final World w, final int x, final int y, final int z )
{
return new PortableCellViewer( is, x );
}
@@ -59,7 +59,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
}
@Override
public ItemStack onItemRightClick( ItemStack item, World w, EntityPlayer player )
public ItemStack onItemRightClick( final ItemStack item, final World w, final EntityPlayer player )
{
AEApi.instance().registries().wireless().openWirelessTerminalGui( item, w, player );
return item;
@@ -73,16 +73,16 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
{
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
if( stack.hasTagCompound() )
{
NBTTagCompound tag = Platform.openNbtData( stack );
final NBTTagCompound tag = Platform.openNbtData( stack );
if( tag != null )
{
String encKey = tag.getString( "encryptionKey" );
final String encKey = tag.getString( "encryptionKey" );
if( encKey == null || encKey.isEmpty() )
{
@@ -101,19 +101,19 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
}
@Override
public boolean canHandle( ItemStack is )
public boolean canHandle( final ItemStack is )
{
return AEApi.instance().definitions().items().wirelessTerminal().isSameAs( is );
}
@Override
public boolean usePower( EntityPlayer player, double amount, ItemStack is )
public boolean usePower( final EntityPlayer player, final double amount, final ItemStack is )
{
return this.extractAEPower( is, amount ) >= amount - 0.5;
}
@Override
public boolean hasPower( EntityPlayer player, double amt, ItemStack is )
public boolean hasPower( final EntityPlayer player, final double amt, final ItemStack is )
{
return this.getAECurrentPower( is ) >= amt;
}
@@ -125,9 +125,9 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
{
@Override
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
NBTTagCompound data = Platform.openNbtData( target );
final NBTTagCompound data = Platform.openNbtData( target );
manager.writeToNBT( data );
}
} );
@@ -141,16 +141,16 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
}
@Override
public String getEncryptionKey( ItemStack item )
public String getEncryptionKey( final ItemStack item )
{
NBTTagCompound tag = Platform.openNbtData( item );
final NBTTagCompound tag = Platform.openNbtData( item );
return tag.getString( "encryptionKey" );
}
@Override
public void setEncryptionKey( ItemStack item, String encKey, String name )
public void setEncryptionKey( final ItemStack item, final String encKey, final String name )
{
NBTTagCompound tag = Platform.openNbtData( item );
final NBTTagCompound tag = Platform.openNbtData( item );
tag.setString( "encryptionKey", encKey );
tag.setString( "name", name );
}
@@ -24,7 +24,7 @@ import com.google.common.base.Optional;
public abstract class AEBasePoweredItem extends RedstoneFlux
{
public AEBasePoweredItem( double powerCapacity, Optional<String> subName )
public AEBasePoweredItem( final double powerCapacity, final Optional<String> subName )
{
super( powerCapacity, subName );
@@ -43,7 +43,7 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
private static final String POWER_NBT_KEY = "internalCurrentPower";
private final double powerCapacity;
public AERootPoweredItem( double powerCapacity, Optional<String> subName )
public AERootPoweredItem( final double powerCapacity, final Optional<String> subName )
{
super( subName );
this.setMaxDamage( 32 );
@@ -54,18 +54,18 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
}
@Override
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
{
NBTTagCompound tag = stack.getTagCompound();
final NBTTagCompound tag = stack.getTagCompound();
double internalCurrentPower = 0;
double internalMaxPower = this.getAEMaxPower( stack );
final double internalMaxPower = this.getAEMaxPower( stack );
if( tag != null )
{
internalCurrentPower = tag.getDouble( "internalCurrentPower" );
}
double percent = internalCurrentPower / internalMaxPower;
final 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 ) );
}
@@ -77,7 +77,7 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
}
@Override
protected void getCheckedSubItems( Item sameItem, CreativeTabs creativeTab, List<ItemStack> itemStacks )
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
{
super.getCheckedSubItems( sameItem, creativeTab, itemStacks );
@@ -96,29 +96,29 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
}
@Override
public double getDurabilityForDisplay( ItemStack is )
public double getDurabilityForDisplay( final ItemStack is )
{
return 1 - this.getAECurrentPower( is ) / this.getAEMaxPower( is );
}
@Override
public boolean isDamaged( ItemStack stack )
public boolean isDamaged( final ItemStack stack )
{
return true;
}
@Override
public void setDamage( ItemStack stack, int damage )
public void setDamage( final ItemStack stack, final int damage )
{
}
private double getInternalBattery( ItemStack is, batteryOperation op, double adjustment )
private double getInternalBattery( final ItemStack is, final batteryOperation op, final double adjustment )
{
NBTTagCompound data = Platform.openNbtData( is );
final NBTTagCompound data = Platform.openNbtData( is );
double currentStorage = data.getDouble( POWER_NBT_KEY );
double maxStorage = this.getAEMaxPower( is );
final double maxStorage = this.getAEMaxPower( is );
switch( op )
{
@@ -126,7 +126,7 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
currentStorage += adjustment;
if( currentStorage > maxStorage )
{
double diff = currentStorage - maxStorage;
final double diff = currentStorage - maxStorage;
data.setDouble( POWER_NBT_KEY, maxStorage );
return diff;
}
@@ -151,11 +151,11 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
/**
* inject external
*/
double injectExternalPower( PowerUnits input, ItemStack is, double amount, boolean simulate )
double injectExternalPower( final PowerUnits input, final ItemStack is, final double amount, final boolean simulate )
{
if( simulate )
{
int requiredEU = (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( is ) - this.getAECurrentPower( is ) );
final int requiredEU = (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( is ) - this.getAECurrentPower( is ) );
if( amount < requiredEU )
{
return 0;
@@ -164,37 +164,37 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
}
else
{
double powerRemainder = this.injectAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
final double powerRemainder = this.injectAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
return PowerUnits.AE.convertTo( PowerUnits.EU, powerRemainder );
}
}
@Override
public double injectAEPower( ItemStack is, double amt )
public double injectAEPower( final ItemStack is, final double amt )
{
return this.getInternalBattery( is, batteryOperation.INJECT, amt );
}
@Override
public double extractAEPower( ItemStack is, double amt )
public double extractAEPower( final ItemStack is, final double amt )
{
return this.getInternalBattery( is, batteryOperation.EXTRACT, amt );
}
@Override
public double getAEMaxPower( ItemStack is )
public double getAEMaxPower( final ItemStack is )
{
return this.powerCapacity;
}
@Override
public double getAECurrentPower( ItemStack is )
public double getAECurrentPower( final ItemStack is )
{
return this.getInternalBattery( is, batteryOperation.STORAGE, 0 );
}
@Override
public AccessRestriction getPowerFlow( ItemStack is )
public AccessRestriction getPowerFlow( final ItemStack is )
{
return AccessRestriction.WRITE;
}
@@ -38,16 +38,16 @@ import appeng.transformer.annotations.Integration.Method;
@InterfaceList( value = { @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = IntegrationType.IC2 ), @Interface( iface = "ic2.api.item.IElectricItemManager", iname = IntegrationType.IC2 ) } )
public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem
{
public IC2( double powerCapacity, Optional<String> subName )
public IC2( final double powerCapacity, final Optional<String> subName )
{
super( powerCapacity, subName );
}
@Override
public double charge( ItemStack is, double amount, int tier, boolean ignoreTransferLimit, boolean simulate )
public double charge( final ItemStack is, final double amount, final int tier, final boolean ignoreTransferLimit, final boolean simulate )
{
double addedAmt = amount;
double limit = this.getTransferLimit( is );
final double limit = this.getTransferLimit( is );
if( !ignoreTransferLimit && amount > limit )
{
@@ -58,25 +58,25 @@ public abstract class IC2 extends AERootPoweredItem implements IElectricItemMana
}
@Override
public double discharge( ItemStack itemStack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate )
public double discharge( final ItemStack itemStack, final double amount, final int tier, final boolean ignoreTransferLimit, final boolean externally, final boolean simulate )
{
return 0;
}
@Override
public double getCharge( ItemStack is )
public double getCharge( final ItemStack is )
{
return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) );
}
@Override
public boolean canUse( ItemStack is, double amount )
public boolean canUse( final ItemStack is, final double amount )
{
return this.getCharge( is ) > amount;
}
@Override
public boolean use( ItemStack is, double amount, EntityLivingBase entity )
public boolean use( final ItemStack is, final double amount, final EntityLivingBase entity )
{
if( this.canUse( is, amount ) )
{
@@ -88,56 +88,56 @@ public abstract class IC2 extends AERootPoweredItem implements IElectricItemMana
}
@Override
public void chargeFromArmor( ItemStack itemStack, EntityLivingBase entity )
public void chargeFromArmor( final ItemStack itemStack, final EntityLivingBase entity )
{
// wtf?
}
@Override
public String getToolTip( ItemStack itemStack )
public String getToolTip( final ItemStack itemStack )
{
return null;
}
@Override
public boolean canProvideEnergy( ItemStack itemStack )
public boolean canProvideEnergy( final ItemStack itemStack )
{
return false;
}
@Override
public Item getChargedItem( ItemStack itemStack )
public Item getChargedItem( final ItemStack itemStack )
{
return itemStack.getItem();
}
@Override
public Item getEmptyItem( ItemStack itemStack )
public Item getEmptyItem( final ItemStack itemStack )
{
return itemStack.getItem();
}
@Override
public double getMaxCharge( ItemStack itemStack )
public double getMaxCharge( final ItemStack itemStack )
{
return PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( itemStack ) );
}
@Override
public int getTier( ItemStack itemStack )
public int getTier( final ItemStack itemStack )
{
return 1;
}
@Override
public double getTransferLimit( ItemStack itemStack )
public double getTransferLimit( final ItemStack itemStack )
{
return Math.max( 32, this.getMaxCharge( itemStack ) / 200 );
}
@Override
@Method( iname = IntegrationType.IC2 )
public IElectricItemManager getManager( ItemStack itemStack )
public IElectricItemManager getManager( final ItemStack itemStack )
{
return this;
}
@@ -33,31 +33,31 @@ import appeng.transformer.annotations.Integration.Interface;
@Interface( iface = "cofh.api.energy.IEnergyContainerItem", iname = IntegrationType.RFItem )
public abstract class RedstoneFlux extends IC2 implements IEnergyContainerItem
{
public RedstoneFlux( double powerCapacity, Optional<String> subName )
public RedstoneFlux( final double powerCapacity, final Optional<String> subName )
{
super( powerCapacity, subName );
}
@Override
public int receiveEnergy( ItemStack is, int maxReceive, boolean simulate )
public int receiveEnergy( final ItemStack is, final int maxReceive, final boolean simulate )
{
return maxReceive - (int) this.injectExternalPower( PowerUnits.RF, is, maxReceive, simulate );
}
@Override
public int extractEnergy( ItemStack container, int maxExtract, boolean simulate )
public int extractEnergy( final ItemStack container, final int maxExtract, final boolean simulate )
{
return 0;
}
@Override
public int getEnergyStored( ItemStack is )
public int getEnergyStored( final ItemStack is )
{
return (int) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAECurrentPower( is ) );
}
@Override
public int getMaxEnergyStored( ItemStack is )
public int getMaxEnergyStored( final ItemStack is )
{
return (int) PowerUnits.AE.convertTo( PowerUnits.RF, this.getAEMaxPower( is ) );
}