Fix FluidGenerators activation and energy production

This commit is contained in:
Ourten 2016-12-17 17:18:49 +01:00
parent 003d124667
commit 1d27182cc2
4 changed files with 20 additions and 17 deletions

View file

@ -64,21 +64,23 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
this.syncWithAll(); this.syncWithAll();
} }
if (this.tank.getFluidAmount() > 0 && tryAddingEnergy(euTick)) { if (this.tank.getFluidAmount() > 0) {
this.getRecipes().getRecipeForFluid(tank.getFluidType()).ifPresent(recipe -> { this.getRecipes().getRecipeForFluid(tank.getFluidType()).ifPresent(recipe -> {
final Integer euPerBucket = recipe.getEnergyPerMb() * 1000; if(tryAddingEnergy(euTick))
final float millibucketsPerTick = 16000f / (float) euPerBucket; {
this.pendingWithdraw += millibucketsPerTick; final Integer euPerBucket = recipe.getEnergyPerMb() * 1000;
final float millibucketsPerTick = 16000f / (float) euPerBucket;
this.pendingWithdraw += millibucketsPerTick;
final int currentWithdraw = (int) this.pendingWithdraw; // float final int currentWithdraw = (int) this.pendingWithdraw;
// -->
// int
// conversion floors
// the float
this.pendingWithdraw -= currentWithdraw;
this.tank.drain(currentWithdraw, true); this.pendingWithdraw -= currentWithdraw;
this.tank.drain(currentWithdraw, true);
this.lastOutput = this.world.getTotalWorldTime();
}
}); });
} }

View file

@ -10,7 +10,8 @@ import techreborn.init.ModBlocks;
public class TileDieselGenerator extends TileBaseFluidGenerator { public class TileDieselGenerator extends TileBaseFluidGenerator {
public TileDieselGenerator() { public TileDieselGenerator() {
super(EFluidGenerator.DIESEL, ConfigTechReborn.ThermalGeneratorTier, "TileDieselGenerator", 1000*10, ConfigTechReborn.ThermalGeneratorOutput); super(EFluidGenerator.DIESEL, ConfigTechReborn.ThermalGeneratorTier, "TileDieselGenerator", 1000 * 10,
ConfigTechReborn.ThermalGeneratorOutput);
} }
@Override @Override

View file

@ -10,7 +10,7 @@ import techreborn.init.ModBlocks;
public class TileGasTurbine extends TileBaseFluidGenerator { public class TileGasTurbine extends TileBaseFluidGenerator {
public TileGasTurbine() { public TileGasTurbine() {
super(EFluidGenerator.GAS, ConfigTechReborn.ThermalGeneratorTier, "TileGasTurbine", 1000*10, 16); super(EFluidGenerator.GAS, ConfigTechReborn.ThermalGeneratorTier, "TileGasTurbine", 1000 * 10, 16);
} }
@Override @Override

View file

@ -10,7 +10,7 @@ import techreborn.init.ModBlocks;
public class TileSemifluidGenerator extends TileBaseFluidGenerator { public class TileSemifluidGenerator extends TileBaseFluidGenerator {
public TileSemifluidGenerator() { public TileSemifluidGenerator() {
super(EFluidGenerator.SEMIFLUID, ConfigTechReborn.ThermalGeneratorTier, "TileSemifluidGenerator", 1000*10, 8); super(EFluidGenerator.SEMIFLUID, ConfigTechReborn.ThermalGeneratorTier, "TileSemifluidGenerator", 1000 * 10, 8);
} }
@Override @Override