Improve Lighting cache.

This commit is contained in:
AlgorithmX2
2014-02-16 02:27:28 -06:00
parent 12d3d4e548
commit 0c24d0ef76
2 changed files with 21 additions and 8 deletions
+14
View File
@@ -134,6 +134,20 @@ public class BusRenderHelper implements IPartRenderHelper
bbc.started = false;
p.getBoxes( bbc );
if ( bbc.minX < 1 )
bbc.minX = 1;
if ( bbc.minY < 1 )
bbc.minY = 1;
if ( bbc.minZ < 1 )
bbc.minZ = 1;
if ( bbc.maxX > 15 )
bbc.maxX = 15;
if ( bbc.maxY > 15 )
bbc.maxY = 15;
if ( bbc.maxZ > 15 )
bbc.maxZ = 15;
setBounds( bbc.minX, bbc.minY, bbc.minZ, bbc.maxX, bbc.maxY, bbc.maxZ );
bbr.renderBlockBounds( rbw, minX, minY, minZ, maxX, maxY, maxZ, ax, ay, az );
+7 -8
View File
@@ -637,17 +637,16 @@ public class RenderBlocksWorkaround extends RenderBlocks
return ((LightingCache) sim).lightHash == lh;
}
int lightHashTmp[] = new int[7];
int lightHashTmp[] = new int[27];
private int getLightingHash(Block blk, IBlockAccess w, int x, int y, int z)
{
lightHashTmp[0] = blk.getMixedBrightnessForBlock( this.blockAccess, x, y, z );
lightHashTmp[1] = blk.getMixedBrightnessForBlock( this.blockAccess, x + 1, y, z );
lightHashTmp[2] = blk.getMixedBrightnessForBlock( this.blockAccess, x, y + 1, z );
lightHashTmp[3] = blk.getMixedBrightnessForBlock( this.blockAccess, x, y, z + 1 );
lightHashTmp[4] = blk.getMixedBrightnessForBlock( this.blockAccess, x - 1, y, z );
lightHashTmp[5] = blk.getMixedBrightnessForBlock( this.blockAccess, x, y - 1, z );
lightHashTmp[6] = blk.getMixedBrightnessForBlock( this.blockAccess, x, y, z - 1 );
int o = 0;
for (int i = -1; i <= 1; i++)
for (int j = -1; j <= 1; j++)
for (int k = -1; k <= 1; k++)
lightHashTmp[o++] = blk.getMixedBrightnessForBlock( this.blockAccess, x + i, y + j, z + k );
return Arrays.hashCode( lightHashTmp );
}