mirror of
https://github.com/exituser/Brewery.git
synced 2026-09-17 04:19:01 +00:00
Negative alc calc
This commit is contained in:
@@ -180,28 +180,20 @@ public class BPlayer {
|
|||||||
int quality = drinkEvent.getQuality();
|
int quality = drinkEvent.getQuality();
|
||||||
List<PotionEffect> effects = getBrewEffects(brew.getEffects(), quality);
|
List<PotionEffect> effects = getBrewEffects(brew.getEffects(), quality);
|
||||||
|
|
||||||
if (brewAlc == 0) {
|
applyEffects(effects, player, PlayerEffectEvent.EffectType.DRINK);
|
||||||
//no alcohol so we dont need to add a BPlayer
|
if (brewAlc < 0) {
|
||||||
applyEffects(effects, player, PlayerEffectEvent.EffectType.DRINK);
|
bPlayer.drainAndRemove(player, -brewAlc);
|
||||||
if (bPlayer.drunkeness <= 0) {
|
} else if (brewAlc > 0) {
|
||||||
bPlayer.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (brewAlc > 0) {
|
|
||||||
bPlayer.drunkeness += brewAlc;
|
bPlayer.drunkeness += brewAlc;
|
||||||
if (quality > 0) {
|
if (quality > 0) {
|
||||||
bPlayer.quality += quality * brewAlc;
|
bPlayer.quality += quality * brewAlc;
|
||||||
} else {
|
} else {
|
||||||
bPlayer.quality += brewAlc;
|
bPlayer.quality += brewAlc;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
bPlayer.drainAndRemove(player, -brewAlc);
|
applyEffects(getQualityEffects(quality, brewAlc), player, PlayerEffectEvent.EffectType.QUALITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
applyEffects(effects, player, PlayerEffectEvent.EffectType.DRINK);
|
|
||||||
applyEffects(getQualityEffects(quality, brewAlc), player, PlayerEffectEvent.EffectType.QUALITY);
|
|
||||||
|
|
||||||
if (bPlayer.drunkeness > 100) {
|
if (bPlayer.drunkeness > 100) {
|
||||||
bPlayer.drinkCap(player);
|
bPlayer.drinkCap(player);
|
||||||
}
|
}
|
||||||
@@ -210,6 +202,10 @@ public class BPlayer {
|
|||||||
if (BConfig.showStatusOnDrink) {
|
if (BConfig.showStatusOnDrink) {
|
||||||
bPlayer.showDrunkeness(player);
|
bPlayer.showDrunkeness(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bPlayer.drunkeness <= 0) {
|
||||||
|
bPlayer.remove();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -373,9 +373,7 @@ public class Brew implements Cloneable {
|
|||||||
// quality decides 10% - 100%
|
// quality decides 10% - 100%
|
||||||
alc *= ((float) quality / 10.0f);
|
alc *= ((float) quality / 10.0f);
|
||||||
}
|
}
|
||||||
if (alc > 0) {
|
return alc;
|
||||||
return alc;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -516,7 +514,10 @@ public class Brew implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getOrCalcAlc() {
|
public int getOrCalcAlc() {
|
||||||
return alc > 0 ? alc : (alc = calcAlcohol());
|
if (alc == 0) {
|
||||||
|
alc = calcAlcohol();
|
||||||
|
}
|
||||||
|
return alc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAlc(int alc) {
|
public void setAlc(int alc) {
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ public class BrewLore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateAlc(boolean inDistiller) {
|
public void updateAlc(boolean inDistiller) {
|
||||||
if (!brew.isUnlabeled() && (inDistiller || BConfig.alwaysShowAlc) && (!brew.hasRecipe() || brew.getCurrentRecipe().getAlcohol() > 0)) {
|
if (!brew.isUnlabeled() && (inDistiller || BConfig.alwaysShowAlc) && (!brew.hasRecipe() || brew.getCurrentRecipe().getAlcohol() != 0)) {
|
||||||
int alc = brew.getOrCalcAlc();
|
int alc = brew.getOrCalcAlc();
|
||||||
addOrReplaceLore(Type.ALC, "§8", P.p.languageReader.get("Brew_Alc", alc + ""));
|
addOrReplaceLore(Type.ALC, "§8", P.p.languageReader.get("Brew_Alc", alc + ""));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user