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

View file

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