mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 12:59:41 +00:00
Fix a crash casting null to float
This commit is contained in:
1 parent
5dcd9abd0f
commit
cf4df0941b
1 file changed
+2
-1
@@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user