Added a central way of limiting the syncs.

Tiles auto sync every 30 seconds
they have a max so they can only sync 2 times a second
This commit is contained in:
modmuss50 2015-05-22 08:22:16 +01:00
parent cdf8f3e0a3
commit e930ea2a04
2 changed files with 14 additions and 7 deletions

View file

@ -97,7 +97,7 @@ public class RecipeCrafter {
}
if(canGiveInvAll){
currentRecipe = recipe;//Sets the current recipe then syncs
parentTile.syncWithAll();
parentTile.needsSync = true;
return;
}
}
@ -106,7 +106,7 @@ public class RecipeCrafter {
if(!hasAllInputs()){//If it doesn't have all the inputs reset
currentRecipe = null;
currentTickTime = 0;
parentTile.syncWithAll();
parentTile.needsSync = true;
return;
}
if (currentTickTime >= currentRecipe.tickTime()) {//If it has reached the recipe tick time
@ -127,7 +127,7 @@ public class RecipeCrafter {
useAllInputs();//this uses all the inputs
currentRecipe = null;//resets
currentTickTime = 0;
parentTile.syncWithAll();
parentTile.needsSync = true;
}
} else if (currentTickTime < currentRecipe.tickTime()) {
if (energy.canUseEnergy(currentRecipe.euPerTick())) {//This checks to see if it can use the power
@ -135,7 +135,7 @@ public class RecipeCrafter {
this.energy.setEnergyStored(this.energy.getEnergyStored() - currentRecipe.euPerTick());
}
currentTickTime++;//increase the ticktime
parentTile.syncWithAll();
parentTile.needsSync = true;
}
}
}