Remove redundant type casts

This commit is contained in:
thatsIch
2015-09-25 22:30:38 +02:00
parent bcba2329b7
commit 80e1a2863b
9 changed files with 96 additions and 117 deletions
@@ -108,8 +108,6 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
{
this.preRenderInWorld( block, world, x, y, z, renderer );
final BlockInscriber blk = (BlockInscriber) block;
final IOrientable te = this.getOrientable( block, world, x, y, z );
if( te == null )
{
@@ -124,25 +122,25 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
// sides...
this.renderBlockBounds( renderer, 3, 1, 0, 13, 15, 3, fdx, fdy, fdz );
boolean out = renderer.renderStandardBlock( blk, x, y, z );
boolean out = renderer.renderStandardBlock( block, x, y, z );
this.renderBlockBounds( renderer, 0, 1, 0, 3, 15, 16, fdx, fdy, fdz );
out = renderer.renderStandardBlock( blk, x, y, z );
out = renderer.renderStandardBlock( block, x, y, z );
this.renderBlockBounds( renderer, 13, 1, 0, 16, 15, 16, fdx, fdy, fdz );
out = renderer.renderStandardBlock( blk, x, y, z );
out = renderer.renderStandardBlock( block, x, y, z );
// top bottom..
this.renderBlockBounds( renderer, 1, 0, 1, 15, 4, 15, fdx, fdy, fdz );
out = renderer.renderStandardBlock( blk, x, y, z );
out = renderer.renderStandardBlock( block, x, y, z );
this.renderBlockBounds( renderer, 1, 12, 1, 15, 16, 15, fdx, fdy, fdz );
out = renderer.renderStandardBlock( blk, x, y, z );
out = renderer.renderStandardBlock( block, x, y, z );
blk.getRendererInstance().setTemporaryRenderIcon( null );
block.getRendererInstance().setTemporaryRenderIcon( null );
renderer.renderAllFaces = false;
blk.getRendererInstance().setTemporaryRenderIcon( null );
block.getRendererInstance().setTemporaryRenderIcon( null );
this.postRenderInWorld( renderer );
return out;
@@ -151,8 +149,6 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
@Override
public void renderTile( BlockInscriber block, TileInscriber tile, Tessellator tess, double x, double y, double z, float f, RenderBlocks renderer )
{
TileInscriber inv = (TileInscriber) tile;
GL11.glPushMatrix();
this.applyTESRRotation( x, y, z, tile.getForward(), tile.getUp() );
@@ -161,7 +157,7 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
GL11.glDisable( GL12.GL_RESCALE_NORMAL );
GL11.glCullFace( GL11.GL_FRONT );
Minecraft mc = Minecraft.getMinecraft();
final Minecraft mc = Minecraft.getMinecraft();
mc.renderEngine.bindTexture( TextureMap.locationBlocksTexture );
// << 20 | light << 4;
@@ -171,37 +167,34 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11, var12 );
final float TwoPx = 2.0f / 16.0f;
float middle = 0.5f;
float press = 0.2f;
final float base = 0.4f;
long absoluteProgress = 0;
if( inv.smash )
if( tile.smash )
{
long currentTime = System.currentTimeMillis();
absoluteProgress = currentTime - inv.clientStart;
final long currentTime = System.currentTimeMillis();
absoluteProgress = currentTime - tile.clientStart;
if( absoluteProgress > 800 )
{
inv.smash = false;
tile.smash = false;
}
}
float relativeProgress = absoluteProgress % 800 / 400.0f;
final float relativeProgress = absoluteProgress % 800 / 400.0f;
float progress = relativeProgress;
if( progress > 1.0f )
{
progress = 1.0f - ( progress - 1.0f );
}
float press = 0.2f;
press -= progress / 5.0f;
IIcon ic = ExtraBlockTextures.BlockInscriberInside.getIcon();
final IIcon ic = ExtraBlockTextures.BlockInscriberInside.getIcon();
tess.startDrawingQuads();
float middle = 0.5f;
middle += 0.02f;
final float TwoPx = 2.0f / 16.0f;
tess.addVertexWithUV( TwoPx, middle + press, TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 2 ) );
tess.addVertexWithUV( 1.0 - TwoPx, middle + press, TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 2 ) );
tess.addVertexWithUV( 1.0 - TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 13 ) );
@@ -209,6 +202,7 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
tess.addVertexWithUV( TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 ) );
tess.addVertexWithUV( 1.0 - TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 ) );
final float base = 0.4f;
tess.addVertexWithUV( 1.0 - TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU( 14 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) );
tess.addVertexWithUV( TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU( 2 ), ic.getInterpolatedV( 3 - 16 * ( press - base ) ) );
@@ -231,26 +225,26 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
GL11.glPopMatrix();
int items = 0;
if( inv.getStackInSlot( 0 ) != null )
if( tile.getStackInSlot( 0 ) != null )
{
items++;
}
if( inv.getStackInSlot( 1 ) != null )
if( tile.getStackInSlot( 1 ) != null )
{
items++;
}
if( inv.getStackInSlot( 2 ) != null )
if( tile.getStackInSlot( 2 ) != null )
{
items++;
}
if( relativeProgress > 1.0f || items == 0 )
{
ItemStack is = inv.getStackInSlot( 3 );
ItemStack is = tile.getStackInSlot( 3 );
if( is == null )
{
IInscriberRecipe ir = inv.getTask();
final IInscriberRecipe ir = tile.getTask();
if( ir != null )
{
is = ir.getOutput().copy();
@@ -261,9 +255,9 @@ public class RenderBlockInscriber extends BaseBlockRender<BlockInscriber, TileIn
}
else
{
this.renderItem( inv.getStackInSlot( 0 ), press, block, tile, tess, x, y, z, f, renderer );
this.renderItem( inv.getStackInSlot( 1 ), -press, block, tile, tess, x, y, z, f, renderer );
this.renderItem( inv.getStackInSlot( 2 ), 0.0f, block, tile, tess, x, y, z, f, renderer );
this.renderItem( tile.getStackInSlot( 0 ), press, block, tile, tess, x, y, z, f, renderer );
this.renderItem( tile.getStackInSlot( 1 ), -press, block, tile, tess, x, y, z, f, renderer );
this.renderItem( tile.getStackInSlot( 2 ), 0.0f, block, tile, tess, x, y, z, f, renderer );
}
}