diff --git a/common/mekanism/client/render/RenderPartTransmitter.java b/common/mekanism/client/render/RenderPartTransmitter.java index c6e3229a5..e880bf33e 100644 --- a/common/mekanism/client/render/RenderPartTransmitter.java +++ b/common/mekanism/client/render/RenderPartTransmitter.java @@ -125,7 +125,7 @@ public class RenderPartTransmitter implements IIconRegister public void renderContents(PartMechanicalPipe pipe, Vector3 pos) { Fluid fluid = pipe.getTransmitterNetwork().refFluid; - float scale = pipe.getTransmitterNetwork().fluidScale; + float scale = pipe.currentScale; if(scale > 0 && fluid != null) { @@ -359,7 +359,7 @@ public class RenderPartTransmitter implements IIconRegister public void renderGasSide(ForgeDirection side, PartPressurizedTube tube) { boolean connected = PartTransmitter.connectionMapContainsSide(tube.getAllCurrentConnections(), side); - renderTransparency(tube.getTransmitterNetwork().refGas.getIcon(), tube.getModelForSide(side, true), new ColourRGBA(1.0, 1.0, 1.0, tube.getTransmitterNetwork().gasScale)); + renderTransparency(tube.getTransmitterNetwork().refGas.getIcon(), tube.getModelForSide(side, true), new ColourRGBA(1.0, 1.0, 1.0, tube.currentScale)); } public void renderPart(Icon icon, CCModel cc, double x, double y, double z) diff --git a/common/mekanism/common/multipart/PartMechanicalPipe.java b/common/mekanism/common/multipart/PartMechanicalPipe.java index a89974fc3..4f3e157a8 100644 --- a/common/mekanism/common/multipart/PartMechanicalPipe.java +++ b/common/mekanism/common/multipart/PartMechanicalPipe.java @@ -3,6 +3,7 @@ package mekanism.common.multipart; import java.util.Arrays; import java.util.Set; +import mekanism.api.gas.Gas; import mekanism.api.transmitters.ITransmitter; import mekanism.api.transmitters.TransmissionType; import mekanism.client.render.PartTransmitterIcons; @@ -32,9 +33,61 @@ public class PartMechanicalPipe extends PartTransmitter implements public static PartTransmitterIcons pipeIcons; + public float currentScale; + public FluidStack cacheFluid; public FluidStack lastWrite; + @Override + public void update() + { + if(!world().isRemote) + { + if(cacheFluid != null) + { + if(getTransmitterNetwork().fluidStored == null) + { + getTransmitterNetwork().fluidStored = cacheFluid; + } + else { + getTransmitterNetwork().fluidStored.amount += cacheFluid.amount; + } + + cacheFluid = null; + } + + if(isActive) + { + IFluidHandler[] connectedAcceptors = PipeUtils.getConnectedAcceptors(tile()); + + for(IFluidHandler container : connectedAcceptors) + { + ForgeDirection side = ForgeDirection.getOrientation(Arrays.asList(connectedAcceptors).indexOf(container)); + + if(container != null) + { + FluidStack received = container.drain(side, 100, false); + + if(received != null && received.amount != 0) + { + container.drain(side.getOpposite(), getTransmitterNetwork().emit(received, true), true); + } + } + } + } + } + else { + float targetScale = getTransmitterNetwork().fluidScale; + + if(Math.abs(currentScale - targetScale) > 0.01) + { + currentScale = (9 * currentScale + targetScale) / 10; + } + } + + super.update(); + } + @Override public void onChunkUnload() { @@ -220,48 +273,6 @@ public class PartMechanicalPipe extends PartTransmitter implements { return new FluidTankInfo[] {dummyTank.getInfo()}; } - - @Override - public void update() - { - if(!world().isRemote) - { - if(cacheFluid != null) - { - if(getTransmitterNetwork().fluidStored == null) - { - getTransmitterNetwork().fluidStored = cacheFluid; - } - else { - getTransmitterNetwork().fluidStored.amount += cacheFluid.amount; - } - - cacheFluid = null; - } - - if(isActive) - { - IFluidHandler[] connectedAcceptors = PipeUtils.getConnectedAcceptors(tile()); - - for(IFluidHandler container : connectedAcceptors) - { - ForgeDirection side = ForgeDirection.getOrientation(Arrays.asList(connectedAcceptors).indexOf(container)); - - if(container != null) - { - FluidStack received = container.drain(side, 100, false); - - if(received != null && received.amount != 0) - { - container.drain(side.getOpposite(), getTransmitterNetwork().emit(received, true), true); - } - } - } - } - - super.update(); - } - } @Override public int getTransmitterNetworkSize() diff --git a/common/mekanism/common/multipart/PartPressurizedTube.java b/common/mekanism/common/multipart/PartPressurizedTube.java index eb19f84ea..4b4e8b333 100644 --- a/common/mekanism/common/multipart/PartPressurizedTube.java +++ b/common/mekanism/common/multipart/PartPressurizedTube.java @@ -23,14 +23,14 @@ public class PartPressurizedTube extends PartTransmitter { public static PartTransmitterIcons tubeIcons; + public float currentScale; + public GasStack cacheGas; public GasStack lastWrite; @Override public void update() - { - super.update(); - + { if(!world().isRemote) { if(cacheGas != null) @@ -46,6 +46,16 @@ public class PartPressurizedTube extends PartTransmitter cacheGas = null; } } + else { + float targetScale = getTransmitterNetwork().gasScale; + + if(Math.abs(currentScale - targetScale) > 0.01) + { + currentScale = (9 * currentScale + targetScale) / 10; + } + } + + super.update(); } @Override diff --git a/common/mekanism/common/network/PacketTransmitterUpdate.java b/common/mekanism/common/network/PacketTransmitterUpdate.java index c4d6d20dc..ebbe37104 100644 --- a/common/mekanism/common/network/PacketTransmitterUpdate.java +++ b/common/mekanism/common/network/PacketTransmitterUpdate.java @@ -104,7 +104,11 @@ public class PacketTransmitterUpdate implements IMekanismPacket if(tileEntity != null) { - ((ITransmitter)tileEntity).getTransmitterNetwork().refGas = gasType; + if(gasType != null) + { + ((ITransmitter)tileEntity).getTransmitterNetwork().refGas = gasType; + } + ((ITransmitter)tileEntity).getTransmitterNetwork().didTransfer = didGasTransfer; ((ITransmitter)tileEntity).getTransmitterNetwork().definedScale = scale; } @@ -120,7 +124,11 @@ public class PacketTransmitterUpdate implements IMekanismPacket if(tileEntity != null) { - ((ITransmitter)tileEntity).getTransmitterNetwork().refFluid = fluidType; + if(fluidType != null) + { + ((ITransmitter)tileEntity).getTransmitterNetwork().refFluid = fluidType; + } + ((ITransmitter)tileEntity).getTransmitterNetwork().didTransfer = didFluidTransfer; ((ITransmitter)tileEntity).getTransmitterNetwork().definedScale = scale; } diff --git a/common/mekanism/common/tileentity/TileEntityElectricPump.java b/common/mekanism/common/tileentity/TileEntityElectricPump.java index 7a7c73266..c1c22cf71 100644 --- a/common/mekanism/common/tileentity/TileEntityElectricPump.java +++ b/common/mekanism/common/tileentity/TileEntityElectricPump.java @@ -459,7 +459,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I return new FluidTankInfo[] {fluidTank.getInfo()}; } - return null; + return new FluidTankInfo[0]; } @Override