From 49a23792fbd36f6610fd120087e277e09c33f9a3 Mon Sep 17 00:00:00 2001 From: eggdropsoap Date: Thu, 16 Apr 2020 20:13:15 -0700 Subject: [PATCH] Minimally fix makedrunk() to apply potion effects for a reasonable amount of time based on passed ABV. Also fix slowIntense check to apply slowness effect. --- core/src/main/java/binnie/core/liquid/AlcoholEffect.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/binnie/core/liquid/AlcoholEffect.java b/core/src/main/java/binnie/core/liquid/AlcoholEffect.java index 1d43c2488..3a546dd9c 100644 --- a/core/src/main/java/binnie/core/liquid/AlcoholEffect.java +++ b/core/src/main/java/binnie/core/liquid/AlcoholEffect.java @@ -5,10 +5,11 @@ import net.minecraft.potion.PotionEffect; public class AlcoholEffect { - public static void makeDrunk(final EntityPlayer player, final float strength) { + public static void makeDrunk(final EntityPlayer player, final float abv) { PotionEffect potionEffect = player.getActivePotionEffect(MobEffects.NAUSEA); final int existingStrength = potionEffect != null ? potionEffect.getAmplifier() : 0; final int existingTime = potionEffect != null ? potionEffect.getDuration() : 0; + final float strength = 100 * abv; int time = (int) (100.0 * Math.sqrt(strength)) + existingTime; final float intensity = 0.1f * strength + existingStrength + existingTime / 500; if (time < 5) { @@ -25,7 +26,7 @@ public static void makeDrunk(final EntityPlayer player, final float strength) { } player.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, time, (int) intensity, false, true)); if (slowIntense > 0.0f) { - player.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, time, (int) slowIntense, false, true)); + player.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, time, (int) slowIntense, false, true)); } if (blindIntense > 0.0f) { player.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, time, (int) blindIntense, false, true));