Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Java by Chris ( 15 years ago )
public void updateLighting( boolean around ) {
        // Pass One
        for ( int i = 0; i < SIZE_ARRAY; i++ ) {
            int bx = Manager.getX( i );
            int by = Manager.getY( i );
            int bz = Manager.getZ( i );

            float lxp = Manager.getBlockLight( this, bx + 1, by, bz );
            float lyp = Manager.getBlockLight( this, bx, by + 1, bz );
            float lzp = Manager.getBlockLight( this, bx, by, bz + 1 );
            float lxn = Manager.getBlockLight( this, bx - 1, by, bz );
            float lyn = Manager.getBlockLight( this, bx, by - 1, bz );
            float lzn = Manager.getBlockLight( this, bx, by, bz - 1 );

            if ( getBlock( i ) == BlockManager.AIR_BLOCK ) {
                setBlockIllum( i, MathF.max( lxp, lyp, lzp, lxn, lyn, lzn ) * 0.92F );
            }
        }

        // Pass Two
        for ( int i = SIZE_ARRAY - 1; i >= 0; i-- ) {
            int bx = Manager.getX( i );
            int by = Manager.getY( i );
            int bz = Manager.getZ( i );

            float lxp = Manager.getBlockLight( this, bx + 1, by, bz );
            float lyp = Manager.getBlockLight( this, bx, by + 1, bz );
            float lzp = Manager.getBlockLight( this, bx, by, bz + 1 );
            float lxn = Manager.getBlockLight( this, bx - 1, by, bz );
            float lyn = Manager.getBlockLight( this, bx, by - 1, bz );
            float lzn = Manager.getBlockLight( this, bx, by, bz - 1 );

            if ( getBlock( i ) == BlockManager.AIR_BLOCK ) {
                setBlockIllum( i, MathF.max( lxp, lyp, lzp, lxn, lyn, lzn ) * 0.92F );
            }
        }

        if ( around ) {
            // Axis

            Chunk chunk = World.Manager.getChunk( x + 1, y );
            if ( chunk != null ) {
                chunk.updateLighting( false );
            }

            chunk = World.Manager.getChunk( x - 1, y );
            if ( chunk != null ) {
                chunk.updateLighting( false );
            }

            chunk = World.Manager.getChunk( x, y + 1 );
            if ( chunk != null ) {
                chunk.updateLighting( false );
            }

            chunk = World.Manager.getChunk( x, y - 1 );
            if ( chunk != null ) {
                chunk.updateLighting( false );
            }

            // Diagnol

            chunk = World.Manager.getChunk( x - 1, y - 1 );
            if ( chunk != null ) {
                chunk.updateLighting( false );
            }

            chunk = World.Manager.getChunk( x + 1, y - 1 );
            if ( chunk != null ) {
                chunk.updateLighting( false );
            }

            chunk = World.Manager.getChunk( x + 1, y + 1 );
            if ( chunk != null ) {
                chunk.updateLighting( false );
            }

            chunk = World.Manager.getChunk( x - 1, y + 1 );
            if ( chunk != null ) {
                chunk.updateLighting( false );
            }
        }
}

 

Revise this Paste

Your Name: Code Language: