Merge Branch RemoveItemIDs

This commit is contained in:
Sn0wStorm
2014-06-06 02:15:18 +02:00
11 changed files with 303 additions and 129 deletions
+27 -6
View File
@@ -28,6 +28,7 @@ public class Brew {
private float wood;
private BRecipe currentRecipe;
private boolean unlabeled;
private boolean persistent;
public Brew(int uid, BIngredients ingredients) {
this.ingredients = ingredients;
@@ -43,7 +44,7 @@ public class Brew {
}
// loading from file
public Brew(int uid, BIngredients ingredients, int quality, int distillRuns, float ageTime, float wood, String recipe, Boolean unlabeled) {
public Brew(int uid, BIngredients ingredients, int quality, int distillRuns, float ageTime, float wood, String recipe, boolean unlabeled, boolean persistent) {
potions.put(uid, this);
this.ingredients = ingredients;
this.quality = quality;
@@ -51,6 +52,7 @@ public class Brew {
this.ageTime = ageTime;
this.wood = wood;
this.unlabeled = unlabeled;
this.persistent = persistent;
setRecipeFromString(recipe);
}
@@ -103,11 +105,6 @@ public class Brew {
return 0;
}
// remove potion from file (drinking, despawning, combusting, cmdDeleting, should be more!)
public static void remove(ItemStack item) {
potions.remove(getUID(item));
}
// generate an UID
public static int generateUID() {
int uid = -2;
@@ -169,6 +166,13 @@ public class Brew {
return brew;
}
// remove potion from file (drinking, despawning, combusting, cmdDeleting, should be more!)
public void remove(ItemStack item) {
if (!persistent) {
potions.remove(getUID(item));
}
}
// calculate alcohol from recipe
public int calcAlcohol() {
if (quality == 0) {
@@ -260,6 +264,20 @@ public class Brew {
unlabeled = true;
}
public boolean isPersistent() {
return persistent;
}
// Make a potion persistent to not delete it when drinking it
public void makePersistent() {
persistent = true;
}
// Remove the Persistence Flag from a brew, so it will be normally deleted when drinking it
public void removePersistence() {
persistent = false;
}
// Distilling section ---------------
// distill all custom potions in the brewer
@@ -573,6 +591,9 @@ public class Brew {
if (brew.unlabeled) {
idConfig.set("unlabeled", true);
}
if (brew.persistent) {
idConfig.set("persist", true);
}
// save the ingredients
idConfig.set("ingId", brew.ingredients.save(config.getParent()));
}