Reduce scope of variables

This commit is contained in:
thatsIch
2015-09-25 22:52:41 +02:00
parent f4ff28d2a6
commit 0387d30d1c
78 changed files with 174 additions and 218 deletions
@@ -415,15 +415,13 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
public void preRenderInWorld( B block, IBlockAccess world, int x, int y, int z, RenderBlocks renderer )
{
ForgeDirection forward = ForgeDirection.SOUTH;
ForgeDirection up = ForgeDirection.UP;
BlockRenderInfo info = block.getRendererInstance();
IOrientable te = this.getOrientable( block, world, x, y, z );
if( te != null )
{
forward = te.getForward();
up = te.getUp();
ForgeDirection forward = te.getForward();
ForgeDirection up = te.getUp();
renderer.uvRotateBottom = info.getTexture( ForgeDirection.DOWN ).setFlip( getOrientation( ForgeDirection.DOWN, forward, up ) );
renderer.uvRotateTop = info.getTexture( ForgeDirection.UP ).setFlip( getOrientation( ForgeDirection.UP, forward, up ) );
@@ -510,9 +508,7 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
double offsetY = 0.0;
double offsetZ = 0.0;
double layerAX = 0.0;
double layerAY = 0.0;
double layerAZ = 0.0;
double layerBX = 0.0;
double layerBY = 0.0;
double layerBZ = 0.0;
@@ -569,6 +565,8 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
offsetY += y;
offsetZ += z;
double layerBX = 0.0;
double layerAY = 0.0;
this.renderFace( tess, offsetX, offsetY, offsetZ, layerAX, layerAY, layerAZ, layerBX, layerBY, layerBZ,
// u -> u
0, 1.0,
@@ -681,11 +679,11 @@ public class BaseBlockRender<B extends AEBaseBlock, T extends AEBaseTile>
public void renderTile( B block, T tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
{
ForgeDirection forward = ForgeDirection.SOUTH;
ForgeDirection up = ForgeDirection.UP;
renderer.uvRotateBottom = renderer.uvRotateTop = renderer.uvRotateEast = renderer.uvRotateWest = renderer.uvRotateNorth = renderer.uvRotateSouth = 0;
ForgeDirection up = ForgeDirection.UP;
ForgeDirection forward = ForgeDirection.SOUTH;
this.applyTESRRotation( x, y, z, forward, up );
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.locationBlocksTexture );
@@ -396,7 +396,6 @@ public final class BusRenderHelper implements IPartRenderHelper
{
ForgeDirection forward = this.az;
ForgeDirection up = this.ay;
ForgeDirection west = ForgeDirection.UNKNOWN;
if( forward == null || up == null )
{
@@ -407,6 +406,7 @@ public final class BusRenderHelper implements IPartRenderHelper
int west_y = forward.offsetZ * up.offsetX - forward.offsetX * up.offsetZ;
int west_z = forward.offsetX * up.offsetY - forward.offsetY * up.offsetX;
ForgeDirection west = ForgeDirection.UNKNOWN;
for( ForgeDirection dx : ForgeDirection.VALID_DIRECTIONS )
{
if( dx.offsetX == west_x && dx.offsetY == west_y && dx.offsetZ == west_z )
@@ -122,9 +122,9 @@ public class CableRenderHelper
IFacadePart fPart = iFacadeContainer.getFacade( s );
if( fPart != null )
{
AxisAlignedBB b = null;
fPart.setThinFacades( useThinFacades );
AxisAlignedBB pb = fPart.getPrimaryBox();
AxisAlignedBB b = null;
for( AxisAlignedBB bb : boxes )
{
if( bb.intersectsWith( pb ) )
@@ -57,7 +57,6 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
@Override
public boolean renderInWorld( B blk, IBlockAccess w, int x, int y, int z, RenderBlocks renderer )
{
IIcon theIcon = null;
boolean formed = false;
boolean emitsLight = false;
@@ -70,7 +69,7 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
int meta = w.getBlockMetadata( x, y, z ) & 3;
boolean isMonitor = blk.getClass() == BlockCraftingMonitor.class;
theIcon = blk.getIcon( ForgeDirection.SOUTH.ordinal(), meta | ( formed ? 8 : 0 ) );
IIcon theIcon = blk.getIcon( ForgeDirection.SOUTH.ordinal(), meta | ( formed ? 8 : 0 ) );
IIcon nonForward = theIcon;
if( isMonitor )
@@ -301,10 +300,9 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
i.setTexture( ExtraBlockTextures.BlockCraftingUnitRingLong.getIcon() );
}
double width = 3.0 / 16.0;
if( !( i.getBound( a ) < 0.001 || i.getBound( a ) > 15.999 ) )
{
double width = 3.0 / 16.0;
switch( a )
{
case DOWN:
@@ -63,11 +63,8 @@ public class RenderBlockPaint extends BaseBlockRender<BlockPaint, TilePaint>
Tessellator tess = Tessellator.instance;
int lumen = 14 << 20 | 14 << 4;
int brightness = imb.getMixedBrightnessForBlock( world, x, y, z );
double offsetConstant = 0.001;
EnumSet<ForgeDirection> validSides = EnumSet.noneOf( ForgeDirection.class );
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
@@ -78,6 +75,8 @@ public class RenderBlockPaint extends BaseBlockRender<BlockPaint, TilePaint>
}
}
double offsetConstant = 0.001;
int lumen = 14 << 20 | 14 << 4;
for( Splotch s : tp.getDots() )
{
if( !validSides.contains( s.side ) )
@@ -61,12 +61,11 @@ public class RenderBlockSkyChest extends BaseBlockRender<BlockSkyChest, TileSkyC
Minecraft.getMinecraft().getTextureManager().bindTexture( loc );
final float lidAngle = 0.0f;
GL11.glScalef( 1.0F, -1F, -1F );
GL11.glTranslatef( -0.0F, -1.0F, -1.0F );
this.model.chestLid.offsetY = -( 0.9f / 16.0f );
final float lidAngle = 0.0f;
this.model.chestLid.rotateAngleX = -( ( lidAngle * 3.141593F ) / 2.0F );
this.model.renderAll();
@@ -85,7 +85,6 @@ public class RenderMEChest extends BaseBlockRender<BlockChest, TileChest>
this.selectFace( renderer, west, up, forward, 5, 16 - 5, 9, 12 );
int offsetU = -4;
int offsetV = 8;
if( stat == 0 )
{
@@ -96,6 +95,7 @@ public class RenderMEChest extends BaseBlockRender<BlockChest, TileChest>
Tessellator.instance.setBrightness( b );
Tessellator.instance.setColorOpaque_I( 0xffffff );
int offsetU = -4;
FlippableIcon flippableIcon = new FlippableIcon( new OffsetIcon( ExtraBlockTextures.MEStorageCellTextures.getIcon(), offsetU, offsetV ) );
if( forward == ForgeDirection.EAST && ( up == ForgeDirection.NORTH || up == ForgeDirection.SOUTH ) )
{
@@ -118,8 +118,8 @@ public class RenderQNB extends BaseBlockRender<BlockQuantumBase, TileQuantumBrid
renderMax = 12.1f / 16.0f;
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
int bn = 15;
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
int bn = 15;
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
{
@@ -146,8 +146,8 @@ public class RenderQNB extends BaseBlockRender<BlockQuantumBase, TileQuantumBrid
renderMax = 16.01f / 16.0f;
renderer.setRenderBounds( renderMin, renderMin, renderMin, renderMax, renderMax, renderMax );
int bn = 15;
Tessellator.instance.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
int bn = 15;
Tessellator.instance.setBrightness( bn << 20 | bn << 4 );
for( ForgeDirection side : ForgeDirection.VALID_DIRECTIONS )
{
@@ -49,18 +49,12 @@ public class RenderQuartzTorch extends BaseBlockRender<AEBaseBlock, AEBaseTile>
{
Tessellator tess = Tessellator.instance;
float Point2 = 6.0f / 16.0f;
float Point3 = 7.0f / 16.0f;
float Point13 = 10.0f / 16.0f;
float Point12 = 9.0f / 16.0f;
float singlePixel = 1.0f / 16.0f;
float renderBottom = 5.0f / 16.0f;
float renderTop = 10.0f / 16.0f;
float bottom = 7.0f / 16.0f;
float top = 8.0f / 16.0f;
float xOff = 0.0f;
float yOff = 0.0f;
float zOff = 0.0f;
@@ -68,6 +62,7 @@ public class RenderQuartzTorch extends BaseBlockRender<AEBaseBlock, AEBaseTile>
renderer.setRenderBounds( Point3 + xOff, renderBottom + yOff, Point3 + zOff, Point12 + xOff, renderTop + yOff, Point12 + zOff );
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
float singlePixel = 1.0f / 16.0f;
renderer.setRenderBounds( Point3 + xOff, renderTop + yOff, Point3 + zOff, Point3 + singlePixel + xOff, renderTop + singlePixel + yOff, Point3 + singlePixel + zOff );
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
@@ -78,6 +73,10 @@ public class RenderQuartzTorch extends BaseBlockRender<AEBaseBlock, AEBaseTile>
blk.getRendererInstance().setTemporaryRenderIcon( Blocks.hopper.getIcon( 0, 0 ) );
renderer.renderAllFaces = true;
float top = 8.0f / 16.0f;
float bottom = 7.0f / 16.0f;
float Point13 = 10.0f / 16.0f;
float Point2 = 6.0f / 16.0f;
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point2 + zOff, Point13 + xOff, top + yOff, Point3 + zOff );
this.renderInvBlock( EnumSet.allOf( ForgeDirection.class ), blk, is, tess, 0xffffff, renderer );
@@ -100,23 +99,10 @@ public class RenderQuartzTorch extends BaseBlockRender<AEBaseBlock, AEBaseTile>
{
IOrientable te = ( (IOrientableBlock) block ).getOrientable( world, x, y, z );
float Point2 = 6.0f / 16.0f;
float Point3 = 7.0f / 16.0f;
float Point13 = 10.0f / 16.0f;
float Point12 = 9.0f / 16.0f;
float singlePixel = 1.0f / 16.0f;
float renderBottom = 5.0f / 16.0f;
float renderTop = 10.0f / 16.0f;
float bottom = 7.0f / 16.0f;
float top = 8.0f / 16.0f;
float xOff = 0.0f;
float yOff = 0.0f;
float zOff = 0.0f;
renderer.renderAllFaces = true;
float zOff = 0.0f;
float yOff = 0.0f;
float xOff = 0.0f;
if( te != null )
{
ForgeDirection forward = te.getUp();
@@ -125,10 +111,15 @@ public class RenderQuartzTorch extends BaseBlockRender<AEBaseBlock, AEBaseTile>
zOff = forward.offsetZ * -( 4.0f / 16.0f );
}
float renderTop = 10.0f / 16.0f;
float renderBottom = 5.0f / 16.0f;
float Point12 = 9.0f / 16.0f;
float Point3 = 7.0f / 16.0f;
renderer.setRenderBounds( Point3 + xOff, renderBottom + yOff, Point3 + zOff, Point12 + xOff, renderTop + yOff, Point12 + zOff );
super.renderInWorld( block, world, x, y, z, renderer );
int r = ( x + y + z ) % 2;
float singlePixel = 1.0f / 16.0f;
if( r == 0 )
{
renderer.setRenderBounds( Point3 + xOff, renderTop + yOff, Point3 + zOff, Point3 + singlePixel + xOff, renderTop + singlePixel + yOff, Point3 + singlePixel + zOff );
@@ -148,6 +139,10 @@ public class RenderQuartzTorch extends BaseBlockRender<AEBaseBlock, AEBaseTile>
block.getRendererInstance().setTemporaryRenderIcon( Blocks.hopper.getIcon( 0, 0 ) );
float top = 8.0f / 16.0f;
float bottom = 7.0f / 16.0f;
float Point13 = 10.0f / 16.0f;
float Point2 = 6.0f / 16.0f;
renderer.setRenderBounds( Point2 + xOff, bottom + yOff, Point2 + zOff, Point13 + xOff, top + yOff, Point3 + zOff );
boolean out = renderer.renderStandardBlock( block, x, y, z );
@@ -59,10 +59,10 @@ public class RenderSpatialPylon extends BaseBlockRender<BlockSpatialPylon, TileS
TileSpatialPylon sp = imb.getTileEntity( world, x, y, z );
int displayBits = ( sp == null ) ? 0 : sp.getDisplayBits();
ForgeDirection ori = ForgeDirection.UNKNOWN;
if( displayBits != 0 )
{
ForgeDirection ori = ForgeDirection.UNKNOWN;
if( ( displayBits & TileSpatialPylon.DISPLAY_Z ) == TileSpatialPylon.DISPLAY_X )
{
ori = ForgeDirection.EAST;
@@ -85,7 +85,6 @@ public class CraftingFx extends EntityBreakingFX
float offX = (float) ( this.prevPosX + ( this.posX - this.prevPosX ) * partialTick );
float offY = (float) ( this.prevPosY + ( this.posY - this.prevPosY ) * partialTick );
float offZ = (float) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * partialTick );
float f14 = 1.0F;
int blkX = MathHelper.floor_double( offX );
int blkY = MathHelper.floor_double( offY );
@@ -97,6 +96,7 @@ public class CraftingFx extends EntityBreakingFX
offZ -= interpPosZ;
// AELog.info( "" + partialTick );
float f14 = 1.0F;
par1Tessellator.setColorRGBA_F( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha );
par1Tessellator.addVertexWithUV( offX - x * scale - rx * scale, offY - y * scale, offZ - z * scale - rz * scale, f7, f9 );
par1Tessellator.addVertexWithUV( offX - x * scale + rx * scale, offY + y * scale, offZ - z * scale + rz * scale, f7, f8 );
@@ -79,7 +79,6 @@ public class EnergyFx extends EntityBreakingFX
float f11 = (float) ( this.prevPosX + ( this.posX - this.prevPosX ) * par2 - interpPosX );
float f12 = (float) ( this.prevPosY + ( this.posY - this.prevPosY ) * par2 - interpPosY );
float f13 = (float) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * par2 - interpPosZ );
float f14 = 1.0F;
int blkX = MathHelper.floor_double( this.posX );
int blkY = MathHelper.floor_double( this.posY );
@@ -87,6 +86,7 @@ public class EnergyFx extends EntityBreakingFX
if( blkX == this.startBlkX && blkY == this.startBlkY && blkZ == this.startBlkZ )
{
float f14 = 1.0F;
par1Tessellator.setColorRGBA_F( this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha );
par1Tessellator.addVertexWithUV( f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10, f7, f9 );
par1Tessellator.addVertexWithUV( f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10, f7, f8 );
@@ -60,7 +60,6 @@ public class PaintBallRender implements IItemRenderer
float f5 = par2Icon.getMaxU();
float f6 = par2Icon.getMinV();
float f7 = par2Icon.getMaxV();
float f12 = 0.0625F;
ItemPaintBall ipb = (ItemPaintBall) item.getItem();
@@ -75,11 +74,10 @@ public class PaintBallRender implements IItemRenderer
int g = ( colorValue >> 8 ) & 0xff;
int b = ( colorValue ) & 0xff;
int full = (int) ( 255 * 0.3 );
float fail = 0.7f;
if( item.getItemDamage() >= 20 )
{
float fail = 0.7f;
int full = (int) ( 255 * 0.3 );
GL11.glColor4ub( (byte) ( full + r * fail ), (byte) ( full + g * fail ), (byte) ( full + b * fail ), (byte) 255 );
}
else
@@ -112,6 +110,7 @@ public class PaintBallRender implements IItemRenderer
{
GL11.glTranslatef( -0.5F, -0.3F, 0.01F );
}
float f12 = 0.0625F;
ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, par2Icon.getIconWidth(), par2Icon.getIconHeight(), f12 );
GL11.glDisable( GL11.GL_CULL_FACE );
@@ -58,7 +58,6 @@ public class ToolBiometricCardRender implements IItemRenderer
float f5 = par2Icon.getMaxU();
float f6 = par2Icon.getMinV();
float f7 = par2Icon.getMaxV();
float f12 = 0.0625F;
Tessellator tessellator = Tessellator.instance;
GL11.glPushMatrix();
@@ -83,6 +82,7 @@ public class ToolBiometricCardRender implements IItemRenderer
else
{
GL11.glTranslatef( -0.5F, -0.3F, 0.01F );
float f12 = 0.0625F;
ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, par2Icon.getIconWidth(), par2Icon.getIconHeight(), f12 );
GL11.glDisable( GL11.GL_CULL_FACE );
@@ -111,7 +111,6 @@ public class ToolBiometricCardRender implements IItemRenderer
GL11.glDisable( GL11.GL_LIGHTING );
tessellator.startDrawingQuads();
float z = 0;
AEColor col = AEColor.values()[Math.abs( 3 + hash ) % AEColor.values().length];
if( hash == 0 )
@@ -119,12 +118,12 @@ public class ToolBiometricCardRender implements IItemRenderer
col = AEColor.Black;
}
float z = 0;
for( int x = 0; x < 8; x++ )// 8
{
for( int y = 0; y < 6; y++ )// 6
{
boolean isLit = false;
float scale = 0.3f / 255.0f;
if( x == 0 || y == 0 || x == 7 || y == 5 )
{
@@ -141,6 +140,7 @@ public class ToolBiometricCardRender implements IItemRenderer
}
else
{
float scale = 0.3f / 255.0f;
tessellator.setColorOpaque_F( ( ( col.blackVariant >> 16 ) & 0xff ) * scale, ( ( col.blackVariant >> 8 ) & 0xff ) * scale, ( col.blackVariant & 0xff ) * scale );
}
@@ -56,7 +56,6 @@ public class ToolColorApplicatorRender implements IItemRenderer
float f5 = par2Icon.getMaxU();
float f6 = par2Icon.getMinV();
float f7 = par2Icon.getMaxV();
float f12 = 0.0625F;
Tessellator tessellator = Tessellator.instance;
GL11.glPushMatrix();
@@ -92,6 +91,7 @@ public class ToolColorApplicatorRender implements IItemRenderer
{
GL11.glTranslatef( -0.5F, -0.3F, 0.01F );
}
float f12 = 0.0625F;
ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, par2Icon.getIconWidth(), par2Icon.getIconHeight(), f12 );
GL11.glDisable( GL11.GL_CULL_FACE );
@@ -112,9 +112,7 @@ public class ToolColorApplicatorRender implements IItemRenderer
}
GL11.glDisable( GL11.GL_LIGHTING );
AEColor col = null;
col = ( (ToolColorApplicator) item.getItem() ).getActiveColor( item );
AEColor col = ( (ToolColorApplicator) item.getItem() ).getActiveColor( item );
if( col != null )
{