Merge pull request #218 from thatsIch/localvars

Remove redundant local variables
This commit is contained in:
Chris 2014-10-01 20:23:56 -07:00
commit c2fba2de55
21 changed files with 58 additions and 88 deletions

View file

@ -98,15 +98,13 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
@Override
public double getAEMaxPower(ItemStack is)
{
double internalMaxPower = getMax( is );
return internalMaxPower;
return getMax( is );
}
@Override
public double getAECurrentPower(ItemStack is)
{
double internalCurrentPower = getInternal( is );
return internalCurrentPower;
return getInternal( is );
}
@Override

View file

@ -131,8 +131,7 @@ public class RenderBlockCharger extends BaseBlockRender
GL11.glRotatef( 30.0f, 0.0f, 1.0f, 0.0f );
}
int light = tile.getWorldObj().getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 );
int br = light;// << 20 | light << 4;
int br = tile.getWorldObj().getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 );// << 20 | light << 4;
int var11 = br % 65536;
int var12 = br / 65536;
OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11, var12 );

View file

@ -115,9 +115,8 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
double a = 0.0 / 16.0;
double o = 16.0 / 16.0;
renderer.setRenderBounds( a, a, a, o, o, o );
boolean out = renderer.renderStandardBlock( blk, x, y, z );
return out;
return renderer.renderStandardBlock( blk, x, y, z );
}
}

View file

@ -79,44 +79,43 @@ public class RenderBlockCraftingCPUMonitor extends RenderBlockCraftingCPU
}
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
ForgeDirection d = side;
GL11.glTranslated( d.offsetX * 0.69, d.offsetY * 0.69, d.offsetZ * 0.69 );
GL11.glTranslated( side.offsetX * 0.69, side.offsetY * 0.69, side.offsetZ * 0.69 );
float scale = 0.7f;
GL11.glScalef( scale, scale, scale );
if ( d == ForgeDirection.UP )
if ( side == ForgeDirection.UP )
{
GL11.glScalef( 1.0f, -1.0f, 1.0f );
GL11.glRotatef( 90.0f, 1.0f, 0.0f, 0.0f );
GL11.glRotatef( spin * 90.0F, 0, 0, 1 );
}
if ( d == ForgeDirection.DOWN )
if ( side == ForgeDirection.DOWN )
{
GL11.glScalef( 1.0f, -1.0f, 1.0f );
GL11.glRotatef( -90.0f, 1.0f, 0.0f, 0.0f );
GL11.glRotatef( spin * -90.0F, 0, 0, 1 );
}
if ( d == ForgeDirection.EAST )
if ( side == ForgeDirection.EAST )
{
GL11.glScalef( -1.0f, -1.0f, -1.0f );
GL11.glRotatef( -90.0f, 0.0f, 1.0f, 0.0f );
}
if ( d == ForgeDirection.WEST )
if ( side == ForgeDirection.WEST )
{
GL11.glScalef( -1.0f, -1.0f, -1.0f );
GL11.glRotatef( 90.0f, 0.0f, 1.0f, 0.0f );
}
if ( d == ForgeDirection.NORTH )
if ( side == ForgeDirection.NORTH )
{
GL11.glScalef( -1.0f, -1.0f, -1.0f );
}
if ( d == ForgeDirection.SOUTH )
if ( side == ForgeDirection.SOUTH )
{
GL11.glScalef( -1.0f, -1.0f, -1.0f );
GL11.glRotatef( 180.0f, 0.0f, 1.0f, 0.0f );

View file

@ -132,8 +132,7 @@ public class RenderBlockInscriber extends BaseBlockRender
Minecraft mc = Minecraft.getMinecraft();
mc.renderEngine.bindTexture( TextureMap.locationBlocksTexture );
int light = tile.getWorldObj().getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 );
int br = light;// << 20 | light << 4;
int br = tile.getWorldObj().getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 );// << 20 | light << 4;
int var11 = br % 65536;
int var12 = br / 65536;
OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11, var12 );
@ -244,8 +243,7 @@ public class RenderBlockInscriber extends BaseBlockRender
GL11.glRotatef( 90.0f, 1, 0, 0 );
int light = tile.getWorldObj().getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 );
int br = light;// << 20 | light << 4;
int br = tile.getWorldObj().getLightBrightnessForSkyBlocks( tile.xCoord, tile.yCoord, tile.zCoord, 0 );// << 20 | light << 4;
int var11 = br % 65536;
int var12 = br / 65536;
OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11, var12 );

View file

@ -34,9 +34,8 @@ public class ContainerCondenser extends AEBaseContainer implements IProgressProv
{
double maxStorage = this.condenser.getStorage();
double requiredEnergy = this.condenser.getRequiredPower();
int maxDisplay = requiredEnergy == 0 ? (int) maxStorage : (int) Math.min( requiredEnergy, maxStorage );
this.requiredEnergy = maxDisplay;
this.requiredEnergy = requiredEnergy == 0 ? (int) maxStorage : (int) Math.min( requiredEnergy, maxStorage );
this.storedPower = (int) this.condenser.storedPower;
this.output = (CondenserOutput) this.condenser.getConfigManager().getSetting( Settings.CONDENSER_OUTPUT );
}

View file

@ -52,8 +52,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
if ( te instanceof IPart )
{
IUpgradeableHost myTile = te;
TileEntity mk = myTile.getTile();
TileEntity mk = te.getTile();
w = mk.getWorldObj();
xCoord = mk.xCoord;
yCoord = mk.yCoord;

View file

@ -198,8 +198,7 @@ public class SlotRestrictedInput extends AppEngSlot
case WORKBENCH_CELL:
return i.getItem() instanceof ICellWorkbenchItem && ((ICellWorkbenchItem) i.getItem()).isEditable( i );
case STORAGE_COMPONENT:
boolean isComp = i.getItem() instanceof IStorageComponent && ((IStorageComponent) i.getItem()).isStorageComponent( i );
return isComp;
return i.getItem() instanceof IStorageComponent && ((IStorageComponent) i.getItem()).isStorageComponent( i );
case TRASH:
if ( AEApi.instance().registries().cell().isCellHandled( i ) )
return false;

View file

@ -65,8 +65,7 @@ public class NEICraftingHandler implements IOverlayHandler
{
if ( slot instanceof SlotCraftingMatrix || slot instanceof SlotFakeCraftingMatrix )
{
Slot ctSlot = slot;
if ( ctSlot.getSlotIndex() == col + row * 3 )
if ( slot.getSlotIndex() == col + row * 3 )
{
NBTTagList tags = new NBTTagList();
List<ItemStack> list = new LinkedList<ItemStack>();
@ -91,7 +90,7 @@ public class NEICraftingHandler implements IOverlayHandler
tags.appendTag( tag );
}
recipe.setTag( "#" + ctSlot.getSlotIndex(), tags );
recipe.setTag( "#" + slot.getSlotIndex(), tags );
break;
}
}

View file

@ -136,8 +136,7 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
public String getGuiTexture()
{
ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/guis/grinder.png" );
String f = loc.toString();
return f;
return loc.toString();
}
@Override

View file

@ -108,8 +108,7 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
public String getGuiTexture()
{
ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/guis/inscriber.png" );
String f = loc.toString();
return f;
return loc.toString();
}
@Override

View file

@ -122,13 +122,11 @@ public class Waila extends BaseModule implements IWailaDataProvider, IWailaFMPPr
SelectedPart sp = ((IPartHost) te).selectPart( Pos );
if ( sp.facade != null )
{
IFacadePart fp = sp.facade;
ThingOfInterest = fp;
ThingOfInterest = sp.facade;
}
else if ( sp.part != null )
{
IPart part = sp.part;
ThingOfInterest = part;
ThingOfInterest = sp.part;
}
}
@ -136,10 +134,9 @@ public class Waila extends BaseModule implements IWailaDataProvider, IWailaFMPPr
{
if ( ThingOfInterest instanceof PartCableSmart || ThingOfInterest instanceof PartDenseCable )
{
NBTTagCompound c = nbt;
if ( c != null && c.hasKey( "extra:6" ) )
if ( nbt != null && nbt.hasKey( "extra:6" ) )
{
NBTTagCompound ic = c.getCompoundTag( "extra:6" );
NBTTagCompound ic = nbt.getCompoundTag( "extra:6" );
if ( ic != null && ic.hasKey( "usedChannels" ) )
{
int channels = ic.getByte( "usedChannels" );
@ -151,11 +148,10 @@ public class Waila extends BaseModule implements IWailaDataProvider, IWailaFMPPr
if ( ThingOfInterest instanceof TileEnergyCell )
{
NBTTagCompound c = nbt;
if ( c != null && c.hasKey( "internalCurrentPower" ) )
if ( nbt != null && nbt.hasKey( "internalCurrentPower" ) )
{
TileEnergyCell tec = (TileEnergyCell) ThingOfInterest;
long power = (long) (100 * c.getDouble( "internalCurrentPower" ));
long power = (long) (100 * nbt.getDouble( "internalCurrentPower" ));
currentToolTip.add( WailaText.Contains + ": " + Platform.formatPowerLong( power, false ) + " / "
+ Platform.formatPowerLong( (long) (100 * tec.getAEMaxPower()), false ) );
}

View file

@ -135,8 +135,7 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
@Override
public IIcon getIconFromDamage(int dmg)
{
IIcon ico = dmgToPart.get( dmg ).ico;
return ico;
return this.dmgToPart.get( dmg ).ico;
}
@Override

View file

@ -63,7 +63,7 @@ public abstract class MBCalculator
return isValidTile( w.getTileEntity( x, y, z ) );
}
public void calculateMultiblock(World worldObj, WorldCoord loc)
public void calculateMultiblock(World world, WorldCoord loc)
{
if ( Platform.isClient() )
return;
@ -73,31 +73,29 @@ public abstract class MBCalculator
WorldCoord min = loc.copy();
WorldCoord max = loc.copy();
World w = worldObj;
// find size of MB structure...
while (isValidTileAt( w, min.x - 1, min.y, min.z ))
while (isValidTileAt( world, min.x - 1, min.y, min.z ))
min.x--;
while (isValidTileAt( w, min.x, min.y - 1, min.z ))
while (isValidTileAt( world, min.x, min.y - 1, min.z ))
min.y--;
while (isValidTileAt( w, min.x, min.y, min.z - 1 ))
while (isValidTileAt( world, min.x, min.y, min.z - 1 ))
min.z--;
while (isValidTileAt( w, max.x + 1, max.y, max.z ))
while (isValidTileAt( world, max.x + 1, max.y, max.z ))
max.x++;
while (isValidTileAt( w, max.x, max.y + 1, max.z ))
while (isValidTileAt( world, max.x, max.y + 1, max.z ))
max.y++;
while (isValidTileAt( w, max.x, max.y, max.z + 1 ))
while (isValidTileAt( world, max.x, max.y, max.z + 1 ))
max.z++;
if ( checkMultiblockScale( min, max ) )
{
if ( verifyUnownedRegion( w, min, max ) )
if ( verifyUnownedRegion( world, min, max ) )
{
IAECluster c = createCluster( w, min, max );
IAECluster c = createCluster( world, min, max );
try
{
if ( !verifyInternalStructure( worldObj, min, max ) )
if ( !verifyInternalStructure( world, min, max ) )
{
disconnect();
return;
@ -113,7 +111,7 @@ public abstract class MBCalculator
IAECluster cluster = target.getCluster();
if ( cluster == null )
{
updateTiles( c, w, min, max );
updateTiles( c, world, min, max );
updateGrid = true;
}

View file

@ -350,11 +350,9 @@ public class PartPlacement
{
if ( pass == PlaceType.INTERACT_FIRST_PASS || pass == PlaceType.PLACE_ITEM )
{
ForgeDirection offset = side;
te_x = x + offset.offsetX;
te_y = y + offset.offsetY;
te_z = z + offset.offsetZ;
te_x = x + side.offsetX;
te_y = y + side.offsetY;
te_z = z + side.offsetZ;
Block blkID = world.getBlock( te_x, te_y, te_z );
tile = world.getTileEntity( te_x, te_y, te_z );
@ -362,7 +360,7 @@ public class PartPlacement
if ( tile != null && AppEng.instance.isIntegrationEnabled( IntegrationType.FMP ) )
host = ((IFMP) AppEng.instance.getIntegration( IntegrationType.FMP )).getOrCreateHost( tile );
if ( (blkID == null || blkID.isReplaceable( world, te_x, te_y, te_z ) || host != null) && offset != ForgeDirection.UNKNOWN )
if ( (blkID == null || blkID.isReplaceable( world, te_x, te_y, te_z ) || host != null) && side != ForgeDirection.UNKNOWN )
return place( held, te_x, te_y, te_z, side.getOpposite().ordinal(), player, world,
pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS : PlaceType.PLACE_ITEM, depth + 1 );
}

View file

@ -22,8 +22,7 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
if ( w.getChunkProvider().chunkExists( x >> 4, z >> 4 ) )
{
TileEntity te = w.getTileEntity( x, y, z );
return te;
return w.getTileEntity( x, y, z );
}
return null;

View file

@ -80,12 +80,10 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
{
boolean inRecipe = false;
for (Object aRequired : required)
for (Object next : required)
{
boolean match = false;
Object next = aRequired;
if ( next instanceof IIngredient )
{
try

View file

@ -39,19 +39,18 @@ public class HCCrusher implements ICraftHandler, IWebsiteSerializer
@Override
public void register() throws RegistrationError, MissingIngredientError
{
for (ItemStack is : pro_input.getItemStackSet())
for (ItemStack beginStack : pro_input.getItemStackSet())
{
try
{
NBTTagCompound toRegister = new NBTTagCompound();
ItemStack beginStack = is;
ItemStack endStack = pro_output[0].getItemStack();
NBTTagCompound itemFrom = new NBTTagCompound();
NBTTagCompound itemTo = new NBTTagCompound();
beginStack.writeToNBT(itemFrom);
beginStack.writeToNBT( itemFrom );
endStack.writeToNBT(itemTo);
toRegister.setTag("itemFrom", itemFrom);

View file

@ -824,11 +824,10 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
{
try
{
IMEInventoryHandler ih = this.getHandler( StorageChannel.ITEMS );
if ( ch != null && ih != null )
IMEInventoryHandler invHandler = this.getHandler( StorageChannel.ITEMS );
if ( ch != null && invHandler != null )
{
IMEInventoryHandler mine = ih;
ch.openChestGui( p, this, ch, mine, cell, StorageChannel.ITEMS );
ch.openChestGui( p, this, ch, invHandler, cell, StorageChannel.ITEMS );
return true;
}
@ -840,11 +839,10 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
try
{
IMEInventoryHandler fh = this.getHandler( StorageChannel.FLUIDS );
if ( ch != null && fh != null )
IMEInventoryHandler invHandler = this.getHandler( StorageChannel.FLUIDS );
if ( ch != null && invHandler != null )
{
IMEInventoryHandler mine = fh;
ch.openChestGui( p, this, ch, mine, cell, StorageChannel.FLUIDS );
ch.openChestGui( p, this, ch, invHandler, cell, StorageChannel.FLUIDS );
return true;
}
}

View file

@ -105,8 +105,7 @@ public class WrapperInvSlot
public IInventory getWrapper(int slot)
{
InternalInterfaceWrapper wrapper = new InternalInterfaceWrapper( inv, slot );
return wrapper;
return new InternalInterfaceWrapper( inv, slot );
}
protected boolean isItemValid(ItemStack itemstack)

View file

@ -454,7 +454,6 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
if ( def.item.isDamageable() )
{
ItemStack a = getItemStack();
ItemStack b = o;
try
{
@ -464,12 +463,12 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
else if ( Mode == FuzzyMode.PERCENT_99 )
{
return (a.getItemDamageForDisplay() > 1) == (b.getItemDamageForDisplay() > 1);
return (a.getItemDamageForDisplay() > 1) == (o.getItemDamageForDisplay() > 1);
}
else
{
float APercentDamaged = 1.0f - (float) a.getItemDamageForDisplay() / (float) a.getMaxDamage();
float BPercentDamaged = 1.0f - (float) b.getItemDamageForDisplay() / (float) b.getMaxDamage();
float BPercentDamaged = 1.0f - (float) o.getItemDamageForDisplay() / (float) o.getMaxDamage();
return (APercentDamaged > Mode.breakPoint) == (BPercentDamaged > Mode.breakPoint);
}
@ -482,12 +481,12 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
else if ( Mode == FuzzyMode.PERCENT_99 )
{
return (a.getItemDamage() > 1) == (b.getItemDamage() > 1);
return (a.getItemDamage() > 1) == (o.getItemDamage() > 1);
}
else
{
float APercentDamaged = (float) a.getItemDamage() / (float) a.getMaxDamage();
float BPercentDamaged = (float) b.getItemDamage() / (float) b.getMaxDamage();
float BPercentDamaged = (float) o.getItemDamage() / (float) o.getMaxDamage();
return (APercentDamaged > Mode.breakPoint) == (BPercentDamaged > Mode.breakPoint);
}