Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions core/src/main/java/binnie/core/liquid/AlcoholEffect.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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));
Expand Down