Fix some null warnings

This commit is contained in:
mezz committed 2016-10-20 23:51:14 -07:00
1 parent c6783e573c
commit 3178aa890d
22 files changed
+114 -95

No files matched your search

@@ -6,8 +6,9 @@ import net.minecraft.potion.PotionEffect;
public class AlcoholEffect {
public static void makeDrunk(final EntityPlayer player, final float strength) {
final int existingStrength = player.isPotionActive(MobEffects.NAUSEA) ? player.getActivePotionEffect(MobEffects.NAUSEA).getAmplifier() : 0;
final int existingTime = player.isPotionActive(MobEffects.NAUSEA) ? player.getActivePotionEffect(MobEffects.NAUSEA).getDuration() : 0;
PotionEffect potionEffect = player.getActivePotionEffect(MobEffects.NAUSEA);
final int existingStrength = potionEffect != null ? potionEffect.getAmplifier() : 0;
final int existingTime = potionEffect != null ? potionEffect.getDuration() : 0;
int time = (int) (100.0 * Math.sqrt(strength)) + existingTime;
final float intensity = 0.1f * strength + existingStrength + existingTime / 500;
if (time < 5) {