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

@ -12,13 +12,20 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class TileMachineBase extends TileEntity {
private int facing;
public boolean needsSync = false;
public int ticksSinceLastSync = 0;
@Override
public void updateEntity() {
super.updateEntity();
// TODO make this happen less
// syncWithAll();
//Force a sync evey 30 seconds
if(needsSync && ticksSinceLastSync >= 10 || ticksSinceLastSync == 600){
syncWithAll();
needsSync = false;
ticksSinceLastSync = 0;
}
ticksSinceLastSync ++;
}
@SideOnly(Side.CLIENT)