Reduce scope of variables

This commit is contained in:
thatsIch
2015-09-30 14:22:21 +02:00
parent dca09fe0a6
commit 059523f543
70 changed files with 151 additions and 199 deletions
+8 -15
View File
@@ -575,7 +575,6 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
final EnumFacing forward = ori.getForward();
final EnumFacing up = ori.getUp();
EnumFacing west = null;
if( forward == null || up == null )
{
@@ -586,6 +585,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
EnumFacing west = null;
for( EnumFacing dx : EnumFacing.VALUES )
{
if( dx.getFrontOffsetX() == west_x && dx.getFrontOffsetY() == west_y && dx.getFrontOffsetZ() == west_z )
@@ -633,22 +633,15 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
String name )
{
final BlockRenderInfo info = this.getRendererInstance();
final FlippableIcon blockIcon;
final FlippableIcon topIcon;
final FlippableIcon bottomIcon;
final FlippableIcon sideIcon;
final FlippableIcon eastIcon;
final FlippableIcon westIcon;
final FlippableIcon southIcon;
final FlippableIcon northIcon;
blockIcon = topIcon = this.optionalIcon( clientHelper, this.getTextureName(), null );
bottomIcon = this.optionalIcon( clientHelper, this.getTextureName() + "Bottom", topIcon );
sideIcon = this.optionalIcon( clientHelper, this.getTextureName() + "Side", topIcon );
eastIcon = this.optionalIcon( clientHelper, this.getTextureName() + "East", sideIcon );
westIcon = this.optionalIcon( clientHelper, this.getTextureName() + "West", sideIcon );
southIcon = this.optionalIcon( clientHelper, this.getTextureName() + "Front", sideIcon );
northIcon = this.optionalIcon( clientHelper, this.getTextureName() + "Back", sideIcon );
final FlippableIcon blockIcon = topIcon = this.optionalIcon( clientHelper, this.getTextureName(), null );
final FlippableIcon bottomIcon = this.optionalIcon( clientHelper, this.getTextureName() + "Bottom", topIcon );
final FlippableIcon sideIcon = this.optionalIcon( clientHelper, this.getTextureName() + "Side", topIcon );
final FlippableIcon eastIcon = this.optionalIcon( clientHelper, this.getTextureName() + "East", sideIcon );
final FlippableIcon westIcon = this.optionalIcon( clientHelper, this.getTextureName() + "West", sideIcon );
final FlippableIcon southIcon = this.optionalIcon( clientHelper, this.getTextureName() + "Front", sideIcon );
final FlippableIcon northIcon = this.optionalIcon( clientHelper, this.getTextureName() + "Back", sideIcon );
info.updateIcons( bottomIcon, topIcon, northIcon, southIcon, eastIcon, westIcon );
}
@@ -104,8 +104,6 @@ public class AEBaseItemBlock extends ItemBlock
EnumFacing up = null;
EnumFacing forward = null;
IOrientable ori = null;
if( this.blockType instanceof AEBaseTileBlock )
{
if( this.blockType instanceof BlockLightDetector )
@@ -168,6 +166,7 @@ public class AEBaseItemBlock extends ItemBlock
}
}
IOrientable ori = null;
if( this.blockType instanceof IOrientableBlock )
{
ori = ( (IOrientableBlock) this.blockType ).getOrientable( w, pos );
@@ -23,6 +23,8 @@ import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import com.google.common.base.Optional;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@@ -30,6 +32,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.client.render.BaseBlockRender;
@@ -40,8 +43,6 @@ import appeng.helpers.ICustomCollision;
import appeng.tile.storage.TileSkyChest;
import appeng.util.Platform;
import com.google.common.base.Optional;
public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
{
@@ -98,7 +99,6 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
boolean b )
{
TileSkyChest sk = this.getTileEntity( w, pos );
double sc = 0.06;
EnumFacing o = EnumFacing.UP;
if( sk != null )
@@ -110,6 +110,7 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
double offsetY = o.getFrontOffsetY() == 0 ? 0.06 : 0.0;
double offsetZ = o.getFrontOffsetZ() == 0 ? 0.06 : 0.0;
double sc = 0.06;
return Collections.singletonList( AxisAlignedBB.fromBounds( Math.max( 0.0, offsetX - o.getFrontOffsetX() * sc ), Math.max( 0.0, offsetY - o.getFrontOffsetY() * sc ), Math.max( 0.0, offsetZ - o.getFrontOffsetZ() * sc ), Math.min( 1.0, ( 1.0 - offsetX ) - o.getFrontOffsetX() * sc ), Math.min( 1.0, ( 1.0 - offsetY ) - o.getFrontOffsetY() * sc ), Math.min( 1.0, ( 1.0 - offsetZ ) - o.getFrontOffsetZ() * sc ) ) );
}