TESR should use less CPU when no-op.

onInventoryChange for FZ.
Networks without batteries can store up to 1000 AE.
Fixed a bug that cause energy to spiral out of control and go infinite.
Fixed a crash with storage buses and fluids.
This commit is contained in:
AlgorithmX2
2014-02-05 22:36:10 -06:00
parent e79e866417
commit f295669e6e
14 changed files with 121 additions and 51 deletions
+28 -24
View File
@@ -28,39 +28,43 @@ public class TESRWrapper extends TileEntitySpecialRenderer
@Override
final public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f)
{
if ( Math.abs( x ) > MAX_DISTANCE || Math.abs( y ) > MAX_DISTANCE || Math.abs( z ) > MAX_DISTANCE )
return;
try
if ( te instanceof AEBaseTile )
{
Block b = te.getBlockType();
Tessellator tess = Tessellator.instance;
if ( tess.isDrawing )
return;
if ( b instanceof AEBaseBlock && te instanceof AEBaseTile )
if ( b instanceof AEBaseBlock && ((AEBaseTile) te).requiresTESR() )
{
if ( Math.abs( x ) > MAX_DISTANCE || Math.abs( y ) > MAX_DISTANCE || Math.abs( z ) > MAX_DISTANCE )
return;
GL11.glPushMatrix();
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
rbinstance.blockAccess = te.worldObj;
blkRender.renderTile( (AEBaseBlock) b, (AEBaseTile) te, tess, x, y, z, f, rbinstance );
Tessellator tess = Tessellator.instance;
if ( tess.isDrawing )
throw new RuntimeException( "Error durring rendering." );
return;
try
{
GL11.glPushMatrix();
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
rbinstance.blockAccess = te.worldObj;
blkRender.renderTile( (AEBaseBlock) b, (AEBaseTile) te, tess, x, y, z, f, rbinstance );
if ( tess.isDrawing )
throw new RuntimeException( "Error durring rendering." );
GL11.glPopAttrib();
GL11.glPopMatrix();
}
catch (Throwable t)
{
FMLLog.severe( "Hi, Looks like there was a crash while rendering something..." );
t.printStackTrace();
FMLLog.severe( "MC will now crash ( probobly )!" );
throw new RuntimeException( t );
}
GL11.glPopAttrib();
GL11.glPopMatrix();
}
}
catch (Throwable t)
{
FMLLog.severe( "Hi, Looks like there was a crash while rendering something..." );
t.printStackTrace();
FMLLog.severe( "MC will now crash ( probobly )!" );
throw new RuntimeException( t );
}
}
}