Fix secondary energy consumption with speed upgrades.
Might make them less efficient with speed upgrades and add a secondary energy upgrade that mitigates this, like the current energy upgrade.
This commit is contained in:
parent
6714034771
commit
40c06f1004
3 changed files with 14 additions and 3 deletions
|
@ -96,7 +96,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
|
|||
|
||||
boolean changed = false;
|
||||
|
||||
if(canOperate() && MekanismUtils.canFunction(this) && getEnergy() >= MekanismUtils.getEnergyPerTick(this, ENERGY_PER_TICK) && gasTank.getStored() >= SECONDARY_ENERGY_PER_TICK)
|
||||
if(canOperate() && MekanismUtils.canFunction(this) && getEnergy() >= MekanismUtils.getEnergyPerTick(this, ENERGY_PER_TICK) && gasTank.getStored() >= (int)MekanismUtils.getSecondaryEnergyPerTick(this, SECONDARY_ENERGY_PER_TICK))
|
||||
{
|
||||
setActive(true);
|
||||
|
||||
|
@ -109,7 +109,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
|
|||
operatingTicks = 0;
|
||||
}
|
||||
|
||||
gasTank.draw(SECONDARY_ENERGY_PER_TICK, true);
|
||||
gasTank.draw(MekanismUtils.getSecondaryEnergyPerTick(this, SECONDARY_ENERGY_PER_TICK), true);
|
||||
electricityStored -= MekanismUtils.getEnergyPerTick(this, ENERGY_PER_TICK);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -348,7 +348,7 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip
|
|||
|
||||
public int getSecondaryEnergyPerTick()
|
||||
{
|
||||
return RecipeType.values()[recipeType].getSecondaryEnergyPerTick();
|
||||
return MekanismUtils.getSecondaryEnergyPerTick(this, RecipeType.values()[recipeType].getSecondaryEnergyPerTick());
|
||||
}
|
||||
|
||||
public void handleSecondaryFuel()
|
||||
|
|
|
@ -620,6 +620,17 @@ public final class MekanismUtils
|
|||
return def * Math.pow(Mekanism.maxUpgradeMultiplier, (2*mgmt.getSpeedMultiplier()-mgmt.getEnergyMultiplier())/8.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the secondary energy required per tick for a machine via upgrades.
|
||||
* @param mgmt - tile containing upgrades
|
||||
* @param def - the original, default secondary energy required
|
||||
* @return max secondary energy per tick
|
||||
*/
|
||||
public static int getSecondaryEnergyPerTick(IUpgradeTile mgmt, int def)
|
||||
{
|
||||
return def * (int)Math.pow(general.maxUpgradeMultiplier, mgmt.getComponent().getUpgrades(Upgrade.SPEED)/(float)Upgrade.SPEED.getMax());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the maximum energy for a machine via it's upgrades.
|
||||
* @param energyUpgrade - number of energy upgrades
|
||||
|
|
Loading…
Reference in a new issue