This closes #17 and closes #58, I tested and it worked using the script given

Also changes like all packages
inb4 "jared changes a package name in ModTweaker2 breaking compatability
with everything" drama tweet.
This commit is contained in:
jaredlll08 committed 2015-02-20 23:57:32 +02:00
1 parent 4fd2551072
commit ec562b62ea
187 files changed
+977 -991

No files matched your search

@@ -0,0 +1,74 @@
package modtweaker2.mods.botania.handlers;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import modtweaker2.util.BaseListAddition;
import modtweaker2.util.BaseListRemoval;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import static modtweaker2.helpers.InputHelper.*;
import static modtweaker2.helpers.StackHelper.*;
@ZenClass("mods.botania.Apothecary")
public class Apothecary {
@ZenMethod
public static void addRecipe(IItemStack output, IIngredient[] input) {
MineTweakerAPI.apply(new Add(new RecipePetals(toStack(output), toObjects(input))));
}
@ZenMethod
public static void addRecipe(String output, IIngredient[] input) {
MineTweakerAPI.apply(new Add(new RecipePetals(ItemBlockSpecialFlower.ofType(output), toObjects(input))));
}
private static class Add extends BaseListAddition {
public Add(RecipePetals recipe) {
super("Botania Petal Recipe", BotaniaAPI.petalRecipes, recipe);
}
@Override
public String getRecipeInfo() {
return ((RecipePetals) recipe).getOutput().getDisplayName();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output)));
}
@ZenMethod
public static void removeRecipe(String output) {
MineTweakerAPI.apply(new Remove(ItemBlockSpecialFlower.ofType(output)));
}
private static class Remove extends BaseListRemoval {
public Remove(ItemStack stack) {
super("Botania Petal recipe", BotaniaAPI.petalRecipes, stack);
}
@Override
public void apply() {
for (RecipePetals r : BotaniaAPI.petalRecipes) {
if (areEqual(r.getOutput(), stack)) {
recipe = r;
break;
}
}
BotaniaAPI.petalRecipes.remove(recipe);
}
@Override
public String getRecipeInfo() {
return stack.getDisplayName();
}
}
}