From d7d99c5e7e31441837a36e92e58d4d6be9fe97a7 Mon Sep 17 00:00:00 2001 From: yueh Date: Tue, 1 Nov 2016 11:22:35 +0100 Subject: [PATCH] Fixes #2551: Prevent chunk rebuilds when drive is unchanged. --- src/main/java/appeng/tile/storage/TileDrive.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/appeng/tile/storage/TileDrive.java b/src/main/java/appeng/tile/storage/TileDrive.java index 4c2ee7d8..5a9f0af8 100644 --- a/src/main/java/appeng/tile/storage/TileDrive.java +++ b/src/main/java/appeng/tile/storage/TileDrive.java @@ -206,15 +206,16 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior private void recalculateDisplay() { - final boolean currentActive = this.getProxy().isActive(); + int newState = this.state; + if( currentActive ) { - this.state |= 0x80000000; + newState |= 0x80000000; } else { - this.state &= ~0x80000000; + newState &= ~0x80000000; } if( this.wasActive != currentActive ) @@ -232,12 +233,12 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior for( int x = 0; x < this.getCellCount(); x++ ) { - this.state |= ( this.getCellStatus( x ) << ( 3 * x ) ); + newState |= ( this.getCellStatus( x ) << ( 3 * x ) ); } - final int oldState = 0; - if( oldState != this.state ) + if( newState != this.state ) { + this.state = newState; this.markForUpdate(); } }