#606 Fixed performance issue when EIO machines where full.

This commit is contained in:
CrazyPants committed 2014-04-29 13:31:26 +08:00
1 parent 7b02ea766b
commit 7c8382c067
3 files changed
+28 -3

No files matched your search

@@ -38,6 +38,7 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
protected int ticksSinceSync = -1;
protected boolean forceClientUpdate = true;
protected boolean lastActive;
protected int ticksSinceActiveChanged = 0;
protected float lastSyncPowerStored = -1;
// Power
@@ -289,15 +290,22 @@ public abstract class AbstractMachineEntity extends TileEntityEio implements ISi
if(worldObj.isRemote) {
// check if the block on the client needs to update its texture
if(isActive() != lastActive) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
ticksSinceActiveChanged++;
if(ticksSinceActiveChanged > 20 || isActive()) {
ticksSinceActiveChanged = 0;
lastActive = isActive();
forceClientUpdate = false;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
lastActive = isActive();
if(forceClientUpdate) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
forceClientUpdate = false;
}
return;
} // else is server, do all logic only on the server
updateStoredEnergyFromPowerHandler();