diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index 0761db7a..34247764 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -16,6 +16,7 @@ - #601 Capacitor bank overcharges with BC kinetic pipes - #602 SMP crash with MrCraysFurniture mod. - #605 Server Crashing - java.lang.IllegalArgumentException: Empty string not allowed/NBT +- #606 Fixed performance issue when EIO machines where full. - #607 LiquidConduit modifies FluidStack passed to fill 1.0.1 diff --git a/src/main/java/crazypants/enderio/machine/AbstractMachineEntity.java b/src/main/java/crazypants/enderio/machine/AbstractMachineEntity.java index 83a588f9..14e9c4db 100644 --- a/src/main/java/crazypants/enderio/machine/AbstractMachineEntity.java +++ b/src/main/java/crazypants/enderio/machine/AbstractMachineEntity.java @@ -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(); diff --git a/src/main/java/crazypants/enderio/machine/AbstractPoweredTaskEntity.java b/src/main/java/crazypants/enderio/machine/AbstractPoweredTaskEntity.java index d4b01c23..472182a4 100644 --- a/src/main/java/crazypants/enderio/machine/AbstractPoweredTaskEntity.java +++ b/src/main/java/crazypants/enderio/machine/AbstractPoweredTaskEntity.java @@ -17,6 +17,9 @@ public abstract class AbstractPoweredTaskEntity extends AbstractMachineEntity im protected final Random random = new Random(); + protected int ticksSinceCheckedRecipe = 0; + protected boolean startFailed = false; + public AbstractPoweredTaskEntity(SlotDefinition slotDefinition) { super(slotDefinition); } @@ -86,12 +89,25 @@ public abstract class AbstractPoweredTaskEntity extends AbstractMachineEntity im return requiresClientSync; } + if(startFailed) { + ticksSinceCheckedRecipe++; + if(ticksSinceCheckedRecipe < 20) { + return false; + } + } + ticksSinceCheckedRecipe = 0; + float chance = random.nextFloat(); // Then see if we need to start a new one IMachineRecipe nextRecipe = canStartNextTask(chance); if(nextRecipe != null) { - requiresClientSync |= startNextTask(nextRecipe, chance); + boolean started = startNextTask(nextRecipe, chance); + startFailed = !started; + requiresClientSync |= started; + } else { + startFailed = true; } + return requiresClientSync; }