mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-18 19:39:14 +00:00
#606 Fixed performance issue when EIO machines where full.
This commit is contained in:
1 parent
7b02ea766b
commit
7c8382c067
3 files changed
+28
-3
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user