Effects, Hangover, Fixes

This commit is contained in:
Sn0wStorm
2013-05-28 16:25:06 +02:00
parent 5c82b08028
commit 84e37ec676
11 changed files with 553 additions and 235 deletions
+14 -5
View File
@@ -48,8 +48,7 @@ public class BIngredients {
ItemStack potion = new ItemStack(Material.POTION);
PotionMeta potionMeta = (PotionMeta) potion.getItemMeta();
// cookedTime is always time in minutes, state may differ with number of
// ticks
// cookedTime is always time in minutes, state may differ with number of ticks
cookedTime = state;
String cookedName = null;
BRecipe cookRecipe = getCookRecipe();
@@ -60,7 +59,7 @@ public class BIngredients {
// Potion is best with cooking only, can still be destilled, etc.
int quality = (int) Math.round((getIngredientQuality(cookRecipe) + getCookingQuality(cookRecipe)) / 2.0);
P.p.log("cooked potion has Quality: " + quality);
new Brew(uid, quality, cookRecipe.getAlcohol(), new BIngredients(ingredients, cookedTime));
new Brew(uid, quality, cookRecipe, new BIngredients(ingredients, cookedTime));
cookedName = cookRecipe.getName(quality);
potion.setDurability(Brew.PotionColor.valueOf(cookRecipe.getColor()).getColorId(false));
@@ -69,7 +68,7 @@ public class BIngredients {
// new base potion
new Brew(uid, new BIngredients(ingredients, cookedTime));
if (state == 0) {// TESTING sonst 1
if (state == 0) {// TODO sonst 1
cookedName = "Schlammiger Sud";
potion.setDurability(Brew.PotionColor.BLUE.getColorId(false));
} else {
@@ -107,6 +106,16 @@ public class BIngredients {
return count;
}
//returns the recipe with the given name
public static BRecipe getRecipeByName(String name) {
for (BRecipe recipe : recipes) {
if (recipe.getName(5).equalsIgnoreCase(name)) {
return recipe;
}
}
return null;
}
// best recipe for current state of potion, STILL not always returns the
// correct one...
public BRecipe getBestRecipe(byte wood, float time) {
@@ -169,7 +178,7 @@ public class BIngredients {
// Check if best recipe needs to be destilled
if (bestRecipe != null) {
if (bestRecipe.getDistillRuns() != 0) {
if (bestRecipe.needsDistilling()) {
return bestRecipe;
}
}