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();
}
if (this.tank.getFluidAmount() > 0 && tryAddingEnergy(euTick)) {
if (this.tank.getFluidAmount() > 0) {
this.getRecipes().getRecipeForFluid(tank.getFluidType()).ifPresent(recipe -> {
final Integer euPerBucket = recipe.getEnergyPerMb() * 1000;
final float millibucketsPerTick = 16000f / (float) euPerBucket;
this.pendingWithdraw += millibucketsPerTick;
if(tryAddingEnergy(euTick))
{
final Integer euPerBucket = recipe.getEnergyPerMb() * 1000;
final float millibucketsPerTick = 16000f / (float) euPerBucket;
this.pendingWithdraw += millibucketsPerTick;
final int currentWithdraw = (int) this.pendingWithdraw; // float
// -->
// int
// conversion floors
// the float
this.pendingWithdraw -= currentWithdraw;
final int currentWithdraw = (int) this.pendingWithdraw;
this.pendingWithdraw -= currentWithdraw;
this.tank.drain(currentWithdraw, true);
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 TileDieselGenerator() {
super(EFluidGenerator.DIESEL, ConfigTechReborn.ThermalGeneratorTier, "TileDieselGenerator", 1000*10, ConfigTechReborn.ThermalGeneratorOutput);
super(EFluidGenerator.DIESEL, ConfigTechReborn.ThermalGeneratorTier, "TileDieselGenerator", 1000 * 10,
ConfigTechReborn.ThermalGeneratorOutput);
}
@Override

View file

@ -10,14 +10,14 @@ import techreborn.init.ModBlocks;
public class TileGasTurbine extends TileBaseFluidGenerator {
public TileGasTurbine() {
super(EFluidGenerator.GAS, ConfigTechReborn.ThermalGeneratorTier, "TileGasTurbine", 1000*10, 16);
super(EFluidGenerator.GAS, ConfigTechReborn.ThermalGeneratorTier, "TileGasTurbine", 1000 * 10, 16);
}
@Override
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
return new ItemStack(ModBlocks.gasTurbine, 1);
}
@Override
public EnumPowerTier getTier() {
return EnumPowerTier.MEDIUM;

View file

@ -10,9 +10,9 @@ import techreborn.init.ModBlocks;
public class TileSemifluidGenerator extends TileBaseFluidGenerator {
public TileSemifluidGenerator() {
super(EFluidGenerator.SEMIFLUID, ConfigTechReborn.ThermalGeneratorTier, "TileSemifluidGenerator", 1000*10, 8);
super(EFluidGenerator.SEMIFLUID, ConfigTechReborn.ThermalGeneratorTier, "TileSemifluidGenerator", 1000 * 10, 8);
}
@Override
public ItemStack getWrenchDrop(EntityPlayer arg0) {
return new ItemStack(ModBlocks.semiFluidGenerator, 1);
@ -22,7 +22,7 @@ public class TileSemifluidGenerator extends TileBaseFluidGenerator {
public EnumPowerTier getTier() {
return EnumPowerTier.LOW;
}
@Override
public double getMaxPower() {
return ConfigTechReborn.ThermalGeneratorCharge;