Prevent Osmium Compressor and Combiner from using secondary energy upgrades.

Also make them deterministic again to prevent them getting stuck
This commit is contained in:
Ben Spiers 2015-02-19 16:36:16 +00:00
parent 0819c0ad5f
commit 17f9f88b34
4 changed files with 50 additions and 13 deletions

View file

@ -99,7 +99,21 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
boolean changed = false;
if(canOperate() && MekanismUtils.canFunction(this) && getEnergy() >= MekanismUtils.getEnergyPerTick(this, ENERGY_PER_TICK) && gasTank.getStored() >= (int)MekanismUtils.getSecondaryEnergyPerTick(this, SECONDARY_ENERGY_PER_TICK))
double secondaryToUse = SECONDARY_ENERGY_PER_TICK;
if(upgradeableSecondaryEfficiency())
{
secondaryToUse = MekanismUtils.getSecondaryEnergyPerTickMean(this, SECONDARY_ENERGY_PER_TICK);
}
int actualSecondaryToUse = (int)Math.ceil(secondaryToUse);
if(useStatisticalMechanics())
{
actualSecondaryToUse = StatUtils.inversePoisson(secondaryToUse);
}
if(canOperate() && MekanismUtils.canFunction(this) && getEnergy() >= MekanismUtils.getEnergyPerTick(this, ENERGY_PER_TICK) && gasTank.getStored() >= actualSecondaryToUse)
{
setActive(true);
@ -112,7 +126,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
operatingTicks = 0;
}
gasTank.draw(StatUtils.inversePoisson(MekanismUtils.getSecondaryEnergyPerTickMean(this, SECONDARY_ENERGY_PER_TICK)), true);
gasTank.draw(actualSecondaryToUse, true);
electricityStored -= MekanismUtils.getEnergyPerTick(this, ENERGY_PER_TICK);
}
else {
@ -178,6 +192,16 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
}
}
public boolean upgradeableSecondaryEfficiency()
{
return false;
}
public boolean useStatisticalMechanics()
{
return false;
}
@Override
public boolean isItemValidForSlot(int slotID, ItemStack itemstack)
{

View file

@ -89,4 +89,16 @@ public class TileEntityChemicalInjectionChamber extends TileEntityAdvancedElectr
{
return gas == GasRegistry.getGas("sulfuricAcid") || gas == GasRegistry.getGas("water") || gas == GasRegistry.getGas("hydrogenChloride");
}
@Override
public boolean upgradeableSecondaryEfficiency()
{
return true;
}
@Override
public boolean useStatisticalMechanics()
{
return true;
}
}

View file

@ -82,4 +82,16 @@ public class TileEntityPurificationChamber extends TileEntityAdvancedElectricMac
{
return gas == GasRegistry.getGas("oxygen");
}
@Override
public boolean upgradeableSecondaryEfficiency()
{
return true;
}
@Override
public boolean useStatisticalMechanics()
{
return true;
}
}

View file

@ -626,17 +626,6 @@ 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(IUpgradeManagement mgmt, int def)
{
return (int)getSecondaryEnergyPerTickMean(mgmt, def);
}
/**
* Gets the secondary energy required per tick for a machine via upgrades.
* @param mgmt - tile containing upgrades