diff --git a/common/mekanism/api/gas/GasNetwork.java b/common/mekanism/api/gas/GasNetwork.java index c01ee8f3f..9df4b1841 100644 --- a/common/mekanism/api/gas/GasNetwork.java +++ b/common/mekanism/api/gas/GasNetwork.java @@ -54,25 +54,32 @@ public class GasNetwork extends DynamicNetwork { if(net != null) { - if(net.refGas != null && net.gasScale > gasScale) + if(FMLCommonHandler.instance().getEffectiveSide().isClient()) { - gasScale = net.gasScale; - refGas = net.refGas; - net.gasScale = 0; - net.refGas = null; - } - - if(net.gasStored != null) - { - if(gasStored == null) + if(net.refGas != null && net.gasScale > gasScale) { + gasScale = net.gasScale; + refGas = net.refGas; gasStored = net.gasStored; + + net.gasScale = 0; + net.refGas = null; + net.gasStored = null; } - else { - gasStored.amount += net.gasStored.amount; + } + else { + if(net.gasStored != null) + { + if(gasStored == null) + { + gasStored = net.gasStored; + } + else { + gasStored.amount += net.gasStored.amount; + } + + net.gasStored = null; } - - net.gasStored = null; } addAllTransmitters(net.transmitters); @@ -80,6 +87,8 @@ public class GasNetwork extends DynamicNetwork } } + gasScale = getScale(); + refresh(); register(); } @@ -87,7 +96,7 @@ public class GasNetwork extends DynamicNetwork @Override public void onNetworksCreated(List networks) { - if(gasStored != null) + if(gasStored != null && FMLCommonHandler.instance().getEffectiveSide().isServer()) { int[] caps = new int[networks.size()]; int cap = 0; @@ -385,7 +394,6 @@ public class GasNetwork extends DynamicNetwork protected GasNetwork create(ITransmitter... varTransmitters) { GasNetwork network = new GasNetwork(varTransmitters); - network.gasScale = gasScale; network.refGas = refGas; if(gasStored != null) @@ -399,6 +407,7 @@ public class GasNetwork extends DynamicNetwork } } + network.gasScale = network.getScale(); gasScale = 0; refGas = null; gasStored = null; @@ -410,7 +419,6 @@ public class GasNetwork extends DynamicNetwork protected GasNetwork create(Collection> collection) { GasNetwork network = new GasNetwork(collection); - network.gasScale = gasScale; network.refGas = refGas; if(gasStored != null) @@ -424,6 +432,8 @@ public class GasNetwork extends DynamicNetwork } } + network.gasScale = network.getScale(); + return network; } diff --git a/common/mekanism/client/render/RenderPartTransmitter.java b/common/mekanism/client/render/RenderPartTransmitter.java index 0c153062a..818d13ac5 100644 --- a/common/mekanism/client/render/RenderPartTransmitter.java +++ b/common/mekanism/client/render/RenderPartTransmitter.java @@ -136,6 +136,9 @@ public class RenderPartTransmitter implements IIconRegister { pipe.currentScale = (9 * pipe.currentScale + targetScale) / 10; } + else { + pipe.currentScale = targetScale; + } Fluid fluid = pipe.getTransmitterNetwork().refFluid; float scale = pipe.currentScale; diff --git a/common/mekanism/common/FluidNetwork.java b/common/mekanism/common/FluidNetwork.java index f6a3582f6..29f7eced8 100644 --- a/common/mekanism/common/FluidNetwork.java +++ b/common/mekanism/common/FluidNetwork.java @@ -56,24 +56,32 @@ public class FluidNetwork extends DynamicNetwork { if(net != null) { - if(net.refFluid != null && net.fluidScale > fluidScale) + if(FMLCommonHandler.instance().getEffectiveSide().isClient()) { - refFluid = net.refFluid; - net.fluidScale = 0; - net.refFluid = null; - } - - if(net.fluidStored != null) - { - if(fluidStored == null) + if(net.refFluid != null && net.fluidScale > fluidScale) { + refFluid = net.refFluid; + fluidScale = net.fluidScale; fluidStored = net.fluidStored; + + net.fluidScale = 0; + net.refFluid = null; + net.fluidStored = null; } - else { - fluidStored.amount += net.fluidStored.amount; + } + else { + if(net.fluidStored != null) + { + if(fluidStored == null) + { + fluidStored = net.fluidStored; + } + else { + fluidStored.amount += net.fluidStored.amount; + } + + net.fluidStored = null; } - - net.fluidStored = null; } addAllTransmitters(net.transmitters); @@ -81,11 +89,6 @@ public class FluidNetwork extends DynamicNetwork } } - if(FMLCommonHandler.instance().getEffectiveSide().isClient()) - { - System.out.println("hi"); - } - fluidScale = getScale(); refresh(); @@ -95,13 +98,8 @@ public class FluidNetwork extends DynamicNetwork @Override public void onNetworksCreated(List networks) { - if(fluidStored != null) + if(fluidStored != null && FMLCommonHandler.instance().getEffectiveSide().isServer()) { - if(FMLCommonHandler.instance().getEffectiveSide().isClient()) - { - System.out.println("hi"); - } - int[] caps = new int[networks.size()]; int cap = 0; @@ -128,9 +126,9 @@ public class FluidNetwork extends DynamicNetwork } } + fluidScale = 0; fluidStored = null; refFluid = null; - fluidScale = 0; } public synchronized int getFluidNeeded() @@ -220,8 +218,6 @@ public class FluidNetwork extends DynamicNetwork int stored = fluidStored != null ? fluidStored.amount : 0; - System.out.println("SERVER " + getScale() + " " + stored); - if(stored != prevStored) { needsUpdate = true; @@ -254,8 +250,6 @@ public class FluidNetwork extends DynamicNetwork { super.clientTick(); - System.out.println("CLIENT " + getScale() + " " + getFlow()); - fluidScale = Math.max(fluidScale, getScale()); if(didTransfer && fluidScale < 1) @@ -392,6 +386,7 @@ public class FluidNetwork extends DynamicNetwork } network.fluidScale = network.getScale(); + fluidScale = 0; refFluid = null; fluidStored = null; @@ -405,7 +400,7 @@ public class FluidNetwork extends DynamicNetwork FluidNetwork network = new FluidNetwork(collection); network.refFluid = refFluid; - if(fluidStored != null && FMLCommonHandler.instance().getEffectiveSide().isServer()) + if(fluidStored != null) { if(network.fluidStored == null) { diff --git a/common/mekanism/common/network/PacketTransmitterUpdate.java b/common/mekanism/common/network/PacketTransmitterUpdate.java index 2f9d393f7..11d4a0fc6 100644 --- a/common/mekanism/common/network/PacketTransmitterUpdate.java +++ b/common/mekanism/common/network/PacketTransmitterUpdate.java @@ -107,13 +107,15 @@ public class PacketTransmitterUpdate implements IMekanismPacket if(tileEntity != null) { + GasNetwork net = ((ITransmitter)tileEntity).getTransmitterNetwork(); + if(gasType != null) { - ((ITransmitter)tileEntity).getTransmitterNetwork().refGas = gasType; + net.refGas = gasType; } - ((ITransmitter)tileEntity).getTransmitterNetwork().gasStored = stack; - ((ITransmitter)tileEntity).getTransmitterNetwork().didTransfer = didGasTransfer; + net.gasStored = stack; + net.didTransfer = didGasTransfer; } } else if(transmitterType == 3) @@ -133,13 +135,17 @@ public class PacketTransmitterUpdate implements IMekanismPacket if(tileEntity != null) { + System.out.println(type + " " + amount + " " + didFluidTransfer); + FluidNetwork net = ((ITransmitter)tileEntity).getTransmitterNetwork(); + if(fluidType != null) { - ((ITransmitter)tileEntity).getTransmitterNetwork().refFluid = fluidType; + net.refFluid = fluidType; } - ((ITransmitter)tileEntity).getTransmitterNetwork().fluidStored = stack; - ((ITransmitter)tileEntity).getTransmitterNetwork().didTransfer = didFluidTransfer; + net.fluidStored = stack; + net.didTransfer = didFluidTransfer; + net.fluidScale = net.getScale(); } } }