Fix a crash casting null to float
This commit is contained in:
parent
5dcd9abd0f
commit
cf4df0941b
1 changed files with 2 additions and 1 deletions
|
@ -642,7 +642,8 @@ public final class MekanismUtils
|
|||
public static double getMaxEnergy(ItemStack itemStack, double def)
|
||||
{
|
||||
Map<Upgrade, Integer> upgrades = Upgrade.buildMap(itemStack.stackTagCompound);
|
||||
return def * Math.pow(Mekanism.maxUpgradeMultiplier, (float)upgrades.get(Upgrade.ENERGY)/(float)Upgrade.ENERGY.getMax());
|
||||
float numUpgrades = upgrades.get(Upgrade.ENERGY) == null ? 0 : (float)upgrades.get(Upgrade.ENERGY);
|
||||
return def * Math.pow(Mekanism.maxUpgradeMultiplier, numUpgrades/(float)Upgrade.ENERGY.getMax());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue