diff --git a/common/buildcraft/BuildCraftCore.java b/common/buildcraft/BuildCraftCore.java index c9c42b1a..f263d18c 100644 --- a/common/buildcraft/BuildCraftCore.java +++ b/common/buildcraft/BuildCraftCore.java @@ -91,6 +91,8 @@ public class BuildCraftCore { public static int itemLifespan = 1200; public static int updateFactor = 10; + + public static long longUpdateFactor = 40; public static BuildCraftConfiguration mainConfiguration; @@ -188,6 +190,10 @@ public class BuildCraftCore { Property factor = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"network.updateFactor", 10); factor.comment = "increasing this number will decrease network update frequency, useful for overloaded servers"; updateFactor = factor.getInt(10); + + Property longFactor = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"network.stateRefreshPeriod", 40); + longFactor.comment = "delay between full client sync packets, increasing it saves bandwidth, decreasing makes for better client syncronization."; + longUpdateFactor = longFactor.getInt(40); String powerFrameworkClassName = "buildcraft.energy.PneumaticPowerFramework"; if (!forcePneumaticPower) diff --git a/common/buildcraft/transport/PipeTransportLiquids.java b/common/buildcraft/transport/PipeTransportLiquids.java index e4614714..71a92cdf 100644 --- a/common/buildcraft/transport/PipeTransportLiquids.java +++ b/common/buildcraft/transport/PipeTransportLiquids.java @@ -152,6 +152,7 @@ public class PipeTransportLiquids extends PipeTransport implements ITankContaine private final short[] outputCooldown = new short[] {0, 0, 0, 0, 0, 0 }; private final SafeTimeTracker tracker = new SafeTimeTracker(); + private int clientSyncCounter = 0; public PipeTransportLiquids() { @@ -196,7 +197,12 @@ public class PipeTransportLiquids extends PipeTransport implements ITankContaine if (tracker.markTimeIfDelay(worldObj, BuildCraftCore.updateFactor)) { - PacketLiquidUpdate packet = computeLiquidUpdate(false, true); + boolean init = false; + if(++clientSyncCounter > BuildCraftCore.longUpdateFactor){ + clientSyncCounter = 0; + init = true; + } + PacketLiquidUpdate packet = computeLiquidUpdate(init, true); if(packet != null){ CoreProxy.proxy.sendToPlayers(packet.getPacket(), worldObj, xCoord, yCoord, zCoord, DefaultProps.PIPE_CONTENTS_RENDER_DIST); } @@ -297,10 +303,6 @@ public class PipeTransportLiquids extends PipeTransport implements ITankContaine public void sendDescriptionPacket() { super.sendDescriptionPacket(); - PacketLiquidUpdate packet = computeLiquidUpdate(true, false); - if(packet != null){ - CoreProxy.proxy.sendToPlayers(packet.getPacket(), worldObj, xCoord, yCoord, zCoord, DefaultProps.PIPE_CONTENTS_RENDER_DIST); - } initClient = 6; }