Merge pull request #2001 from Dannerick/master
Fix for #1997 gasGenerators incorrectly limiting output
This commit is contained in:
commit
b885742690
1 changed files with 19 additions and 3 deletions
|
@ -74,7 +74,12 @@ public class TileEntityGasGenerator extends TileEntityGenerator implements IGasH
|
|||
if(gasType != null && FuelHandler.getFuel(gasType) != null)
|
||||
{
|
||||
GasStack removed = GasTransmission.removeGas(inventory[0], gasType, fuelTank.getNeeded());
|
||||
fuelTank.receive(removed, true);
|
||||
boolean isTankEmpty = (fuelTank.getGas() == null);
|
||||
int fuelReceived = fuelTank.receive(removed, true);
|
||||
if (fuelReceived > 0 && isTankEmpty)
|
||||
{
|
||||
output = FuelHandler.getFuel(fuelTank.getGas().getGas()).energyPerTick * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,6 +213,7 @@ public class TileEntityGasGenerator extends TileEntityGenerator implements IGasH
|
|||
}
|
||||
|
||||
generationRate = dataStream.readDouble();
|
||||
output = dataStream.readDouble();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -226,6 +232,7 @@ public class TileEntityGasGenerator extends TileEntityGenerator implements IGasH
|
|||
}
|
||||
|
||||
data.add(generationRate);
|
||||
data.add(output);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -233,9 +240,14 @@ public class TileEntityGasGenerator extends TileEntityGenerator implements IGasH
|
|||
@Override
|
||||
public int receiveGas(ForgeDirection side, GasStack stack)
|
||||
{
|
||||
if(fuelTank.getGas() == null || fuelTank.getGas().isGasEqual(stack))
|
||||
boolean isTankEmpty = (fuelTank.getGas() == null);
|
||||
if (isTankEmpty || fuelTank.getGas().isGasEqual(stack))
|
||||
{
|
||||
return fuelTank.receive(stack, true);
|
||||
int fuelReceived = fuelTank.receive(stack, true);
|
||||
if (isTankEmpty && fuelReceived > 0) {
|
||||
output = FuelHandler.getFuel(fuelTank.getGas().getGas()).energyPerTick * 2;
|
||||
}
|
||||
return fuelReceived;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -247,6 +259,10 @@ public class TileEntityGasGenerator extends TileEntityGenerator implements IGasH
|
|||
super.readFromNBT(nbtTags);
|
||||
|
||||
fuelTank.read(nbtTags.getCompoundTag("fuelTank"));
|
||||
FuelGas fuel = FuelHandler.getFuel(fuelTank.getGas().getGas());
|
||||
if (fuel != null) {
|
||||
output = fuel.energyPerTick * 2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue