When multiblenetworks of differing fluids/gasses merge, replace one, don't add up the total gas

This commit is contained in:
Aidan C. Brady 2015-03-30 00:21:42 -04:00
parent 0193e0b010
commit af48daf73b
3 changed files with 23 additions and 7 deletions

View file

@ -82,7 +82,10 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
gasStored = net.gasStored;
}
else {
gasStored.amount += net.gasStored.amount;
if(gasStored.isGasEqual(net.gasStored))
{
gasStored.amount += net.gasStored.amount;
}
}
net.gasStored = null;
@ -427,12 +430,16 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
network.gasStored = gasStored;
}
else {
network.gasStored.amount += gasStored.amount;
if(network.gasStored.isGasEqual(gasStored))
{
network.gasStored.amount += gasStored.amount;
}
}
}
network.gasScale = network.getScale();
network.updateCapacity();
return network;
}

View file

@ -81,7 +81,10 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
fluidStored = net.fluidStored;
}
else {
fluidStored.amount += net.fluidStored.amount;
if(fluidStored.isFluidEqual(net.fluidStored))
{
fluidStored.amount += net.fluidStored.amount;
}
}
net.fluidStored = null;
@ -418,7 +421,10 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
network.fluidStored = fluidStored;
}
else {
network.fluidStored.amount += fluidStored.amount;
if(network.fluidStored.isFluidEqual(fluidStored))
{
network.fluidStored.amount += fluidStored.amount;
}
}
}

View file

@ -118,11 +118,13 @@ public class PartHeatTransmitter extends PartTransmitter<HeatNetwork> implements
{
temperature += inverseHeatCapacity * heatToAbsorb;
heatToAbsorb = 0;
if(Math.abs(temperature - clientTemperature) > (temperature / 100))
{
clientTemperature = temperature;
sendTemp();
}
return temperature;
}
@ -138,11 +140,13 @@ public class PartHeatTransmitter extends PartTransmitter<HeatNetwork> implements
if(connectionMapContainsSide(getAllCurrentConnections(), side))
{
TileEntity adj = Coord4D.get(tile()).getFromSide(side).getTileEntity(world());
if(adj instanceof IHeatTransfer)
{
return (IHeatTransfer)adj;
}
}
return null;
}
@ -238,6 +242,7 @@ public class PartHeatTransmitter extends PartTransmitter<HeatNetwork> implements
public void writeDesc(MCDataOutput packet)
{
packet.writeBoolean(false);
super.writeDesc(packet);
}
@ -248,8 +253,7 @@ public class PartHeatTransmitter extends PartTransmitter<HeatNetwork> implements
{
temperature = packet.readDouble();
}
else
{
else {
super.readDesc(packet);
}
}
@ -258,5 +262,4 @@ public class PartHeatTransmitter extends PartTransmitter<HeatNetwork> implements
{
return baseColour;
}
}