mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-11-20 20:32:18 +00:00
Also changes like all packages inb4 "jared changes a package name in ModTweaker2 breaking compatability with everything" drama tweet.
This commit is contained in:
1 parent
4fd2551072
commit
ec562b62ea
187 files changed
+977
-991
No files matched your search
@@ -0,0 +1,22 @@
|
||||
package modtweaker2.mods.forestry;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker2.mods.forestry.handlers.Carpenter;
|
||||
import modtweaker2.mods.forestry.handlers.Centrifuge;
|
||||
import modtweaker2.mods.forestry.handlers.Fermenter;
|
||||
import modtweaker2.mods.forestry.handlers.Moistener;
|
||||
import modtweaker2.mods.forestry.handlers.Squeezer;
|
||||
import modtweaker2.mods.forestry.handlers.Still;
|
||||
import modtweaker2.mods.forestry.handlers.ThermionicFabricator;
|
||||
|
||||
public class Forestry {
|
||||
public Forestry() {
|
||||
MineTweakerAPI.registerClass(Fermenter.class);
|
||||
MineTweakerAPI.registerClass(Still.class);
|
||||
MineTweakerAPI.registerClass(Moistener.class);
|
||||
MineTweakerAPI.registerClass(Carpenter.class);
|
||||
MineTweakerAPI.registerClass(Squeezer.class);
|
||||
MineTweakerAPI.registerClass(Centrifuge.class);
|
||||
MineTweakerAPI.registerClass(ThermionicFabricator.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package modtweaker2.mods.forestry;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public class ForestryHelper {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void addCarpenterRecipeBox(ItemStack box) {
|
||||
Class clazz;
|
||||
try {
|
||||
clazz = Class.forName("forestry.factory.gadgets.MachineCarpenter$RecipeManager");
|
||||
Field field_box = clazz.getDeclaredField("boxes");
|
||||
field_box.setAccessible(true);
|
||||
|
||||
ArrayList<ItemStack> recipeBoxes = (ArrayList<ItemStack>) field_box.get(clazz);
|
||||
recipeBoxes.add(box);
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void addCarpenterRecipeFluids(Fluid newFluid) {
|
||||
Class clazz;
|
||||
try {
|
||||
clazz = Class.forName("forestry.factory.gadgets.MachineCarpenter$RecipeManager");
|
||||
Field field_recipeFluids = clazz.getDeclaredField("recipeFluids");
|
||||
field_recipeFluids.setAccessible(true);
|
||||
|
||||
HashSet<Fluid> recipeFluids = (HashSet<Fluid>) field_recipeFluids.get(clazz);
|
||||
recipeFluids.add(newFluid);
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package modtweaker2.mods.forestry.handlers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import modtweaker2.mods.forestry.ForestryHelper;
|
||||
import modtweaker2.util.BaseListAddition;
|
||||
import modtweaker2.util.BaseListRemoval;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
import forestry.factory.gadgets.MachineCarpenter;
|
||||
import forestry.factory.gadgets.MachineCarpenter.Recipe;
|
||||
import forestry.factory.gadgets.MachineCarpenter.RecipeManager;
|
||||
import static modtweaker2.helpers.InputHelper.*;
|
||||
import static modtweaker2.helpers.StackHelper.*;
|
||||
|
||||
@ZenClass("mods.forestry.Carpenter")
|
||||
public class Carpenter {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(int packagingTime, ILiquidStack liquid, IItemStack[] ingredients, IItemStack ingredient, IItemStack product) {
|
||||
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
for (ItemStack stack : toStacks(ingredients)) {
|
||||
if (stack != null) {
|
||||
stacks.add(stack);
|
||||
}
|
||||
if (stack == null) {
|
||||
stacks.add(new ItemStack(Blocks.air));
|
||||
}
|
||||
|
||||
}
|
||||
MineTweakerAPI.apply(new Add(new Recipe(packagingTime, toFluid(liquid), toStack(ingredient), new ShapedRecipeCustom(3, 3, toStacks(ingredients), toStack(product)))));
|
||||
}
|
||||
|
||||
public ShapedRecipeCustom convertToRecipeCustom() {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition {
|
||||
|
||||
public Add(Recipe recipe) {
|
||||
super("Forestry Carpenter", MachineCarpenter.RecipeManager.recipes, recipe);
|
||||
|
||||
// The Carpenter has a list of valid Fluids, access them via
|
||||
// Relfection because of private
|
||||
if (recipe.getLiquid() != null)
|
||||
ForestryHelper.addCarpenterRecipeFluids(recipe.getLiquid().getFluid());
|
||||
|
||||
if(!RecipeManager.isBox(recipe.getBox())){
|
||||
ForestryHelper.addCarpenterRecipeBox(recipe.getBox());
|
||||
}
|
||||
}
|
||||
|
||||
public void apply() {
|
||||
Recipe r = (MachineCarpenter.Recipe)recipe;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(MachineCarpenter.RecipeManager.recipes, toStack(output)));
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval {
|
||||
|
||||
public Remove(List list, ItemStack stack) {
|
||||
super("Forestry Carpenter", list, stack);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (Recipe r : RecipeManager.recipes) {
|
||||
if (r.getCraftingResult() != null && r.getCraftingResult().isItemEqual(stack)) {
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
RecipeManager.recipes.remove(recipe);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package modtweaker2.mods.forestry.handlers;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
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 forestry.factory.gadgets.MachineCentrifuge.Recipe;
|
||||
import forestry.factory.gadgets.MachineCentrifuge.RecipeManager;
|
||||
import static modtweaker2.helpers.InputHelper.*;
|
||||
import static modtweaker2.helpers.StackHelper.*;
|
||||
|
||||
|
||||
@ZenClass("mods.forestry.Centrifuge")
|
||||
public class Centrifuge {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(int timePerItem, IItemStack itemInput, IItemStack[] output, int[] chances) {
|
||||
HashMap<ItemStack, Integer> products = new HashMap<ItemStack, Integer>();
|
||||
// products.put(toStack(output[0]), chances[0]);
|
||||
int i = 0;
|
||||
for (IItemStack product : output) {
|
||||
products.put(toStack(product), chances[i]);
|
||||
i++;
|
||||
}
|
||||
MineTweakerAPI.apply(new Add(new Recipe(timePerItem, toStack(itemInput), products)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack itemInput) {
|
||||
MineTweakerAPI.apply(new Remove(RecipeManager.recipes, toStack(itemInput)));
|
||||
}
|
||||
|
||||
/*
|
||||
Implements the actions to add the recipe
|
||||
*/
|
||||
private static class Add extends BaseListAddition {
|
||||
|
||||
public Add(Recipe recipe) {
|
||||
super("Forestry Centrifuge", RecipeManager.recipes, recipe);
|
||||
}
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return " Input:" + ((Recipe) recipe).resource.getDisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Implements the actions to remove the recipe
|
||||
*/
|
||||
private static class Remove extends BaseListRemoval {
|
||||
|
||||
public Remove(List list, ItemStack input) {
|
||||
super("Forestry Centrifuge", RecipeManager.recipes, input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (Recipe r : RecipeManager.recipes) {
|
||||
if (r.matches(stack)) {
|
||||
recipe = r;
|
||||
RecipeManager.recipes.remove(r);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return " Input:" + stack.getDisplayName();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package modtweaker2.mods.forestry.handlers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import modtweaker2.util.BaseListAddition;
|
||||
import modtweaker2.util.BaseListRemoval;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.factory.gadgets.MachineFermenter;
|
||||
import forestry.factory.gadgets.MachineFermenter.Recipe;
|
||||
import forestry.factory.gadgets.MachineFermenter.RecipeManager;
|
||||
import static modtweaker2.helpers.InputHelper.*;
|
||||
import static modtweaker2.helpers.StackHelper.*;
|
||||
|
||||
@ZenClass("mods.forestry.Fermenter")
|
||||
public class Fermenter {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack resource, ILiquidStack liquid, int fermentationValue, float modifier, ILiquidStack output) {
|
||||
MineTweakerAPI.apply(new Add(new Recipe(toStack(resource), fermentationValue, modifier, toFluid(output), toFluid(liquid))));
|
||||
MachineFermenter.RecipeManager.recipeFluidInputs.add(getFluid(liquid));
|
||||
MachineFermenter.RecipeManager.recipeFluidOutputs.add(getFluid(output));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition {
|
||||
public Add(Recipe recipe) {
|
||||
super("Forestry Fermenter", MachineFermenter.RecipeManager.recipes, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return ((Recipe) recipe).output.getLocalizedName();
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack input) {
|
||||
MineTweakerAPI.apply(new Remove(MachineFermenter.RecipeManager.recipes, toStack(input)));
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval {
|
||||
|
||||
public Remove(List list, ItemStack stack) {
|
||||
super(list, stack);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
ArrayList<Recipe> recipes = new ArrayList<Recipe>();
|
||||
for (Recipe r : RecipeManager.recipes) {
|
||||
if (r != null && r.resource != null && r.resource.isItemEqual(stack)) {
|
||||
recipes.add(r);
|
||||
|
||||
}
|
||||
}
|
||||
for (Recipe r : recipes) {
|
||||
RecipeManager.recipes.remove(r);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package modtweaker2.mods.forestry.handlers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
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 forestry.factory.gadgets.MachineMoistener;
|
||||
import forestry.factory.gadgets.MachineMoistener.Recipe;
|
||||
import forestry.factory.gadgets.MachineMoistener.RecipeManager;
|
||||
import static modtweaker2.helpers.InputHelper.*;
|
||||
import static modtweaker2.helpers.StackHelper.*;
|
||||
|
||||
@ZenClass("mods.forestry.Moistener")
|
||||
public class Moistener {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(int timePerItem, IItemStack resource, IItemStack product) {
|
||||
MineTweakerAPI.apply(new Add(new Recipe(toStack(resource), toStack(product), timePerItem)));
|
||||
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition {
|
||||
public Add(Recipe recipe) {
|
||||
super("Forestry Moistener", MachineMoistener.RecipeManager.recipes, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return ((Recipe) recipe).product.getDisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(MachineMoistener.RecipeManager.recipes, toStack(output)));
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval {
|
||||
|
||||
public Remove(List list, ItemStack stack) {
|
||||
super(list, stack);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (Recipe r : RecipeManager.recipes) {
|
||||
if (r.product != null && r.product.isItemEqual(stack)) {
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
RecipeManager.recipes.remove(recipe);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package modtweaker2.mods.forestry.handlers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import modtweaker2.util.BaseListAddition;
|
||||
import modtweaker2.util.BaseListRemoval;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.factory.gadgets.MachineSqueezer;
|
||||
import forestry.factory.gadgets.MachineSqueezer.Recipe;
|
||||
import forestry.factory.gadgets.MachineSqueezer.RecipeManager;
|
||||
import static modtweaker2.helpers.InputHelper.*;
|
||||
import static modtweaker2.helpers.StackHelper.*;
|
||||
|
||||
@ZenClass("mods.forestry.Squeezer")
|
||||
public class Squeezer {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(int timePerItem, IItemStack[] resources, ILiquidStack liquid, IItemStack remnants, int chance) {
|
||||
MineTweakerAPI.apply(new Add(new Recipe(timePerItem, toStacks(resources), toFluid(liquid), toStack(remnants), chance)));
|
||||
MachineSqueezer.RecipeManager.recipeFluids.add(getFluid(liquid));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition {
|
||||
public Add(Recipe recipe) {
|
||||
super("Forestry Squeezer", MachineSqueezer.RecipeManager.recipes, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return ((Recipe) recipe).liquid.getLocalizedName();
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(ILiquidStack liquid) {
|
||||
MineTweakerAPI.apply(new Remove(MachineSqueezer.RecipeManager.recipes, toFluid(liquid)));
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval {
|
||||
|
||||
public Remove(List list, FluidStack liquid) {
|
||||
super(list, liquid);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (Recipe r : RecipeManager.recipes) {
|
||||
if (r.liquid != null && r.liquid.isFluidEqual(fluid)) {
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
RecipeManager.recipes.remove(recipe);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package modtweaker2.mods.forestry.handlers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import modtweaker2.util.BaseListAddition;
|
||||
import modtweaker2.util.BaseListRemoval;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.factory.gadgets.MachineStill;
|
||||
import forestry.factory.gadgets.MachineStill.Recipe;
|
||||
import forestry.factory.gadgets.MachineStill.RecipeManager;
|
||||
import static modtweaker2.helpers.InputHelper.*;
|
||||
import static modtweaker2.helpers.StackHelper.*;
|
||||
|
||||
@ZenClass("mods.forestry.Still")
|
||||
public class Still {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(int timePerUnit, ILiquidStack input, ILiquidStack output) {
|
||||
output.amount(output.getAmount() / 100);
|
||||
input.amount(input.getAmount() / 100);
|
||||
|
||||
MineTweakerAPI.apply(new Add(new Recipe(timePerUnit, toFluid(input), toFluid(output))));
|
||||
MachineStill.RecipeManager.recipeFluidInputs.add(getFluid(input));
|
||||
MachineStill.RecipeManager.recipeFluidOutputs.add(getFluid(output));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition {
|
||||
public Add(Recipe recipe) {
|
||||
super("Forestry Still", MachineStill.RecipeManager.recipes, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return ((Recipe) recipe).output.getLocalizedName();
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(ILiquidStack output, ILiquidStack input) {
|
||||
MineTweakerAPI.apply(new Remove(MachineStill.RecipeManager.recipes, toFluid(input)));
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval {
|
||||
|
||||
public Remove(List list, FluidStack input) {
|
||||
super(list, input);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (Recipe r : RecipeManager.recipes) {
|
||||
if (r.output != null && r.output.isFluidEqual(fluid)) {
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
RecipeManager.recipes.remove(recipe);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package modtweaker2.mods.forestry.handlers;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import modtweaker2.util.BaseListAddition;
|
||||
import modtweaker2.util.BaseListRemoval;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
import forestry.factory.gadgets.MachineFabricator.Recipe;
|
||||
import forestry.factory.gadgets.MachineFabricator.RecipeManager;
|
||||
import forestry.factory.gadgets.MachineFabricator.Smelting;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.*;
|
||||
import static modtweaker2.helpers.StackHelper.*;
|
||||
|
||||
@ZenClass("mods.forestry.ThermionicFabricator")
|
||||
public class ThermionicFabricator {
|
||||
|
||||
//first production step: smelting item into liquid
|
||||
@ZenMethod
|
||||
public static void addSmelting(IItemStack itemInput, int meltingPoint, int fluidOutput) {
|
||||
//The machines internal tank accept only liquid glass, therefor this function only accept the amount and hardcode the fluid to glass
|
||||
MineTweakerAPI.apply(new Add(new Smelting(toStack(itemInput), FluidRegistry.getFluidStack("glass", fluidOutput), meltingPoint)));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeSmelting(IItemStack itemInput) {
|
||||
MineTweakerAPI.apply(new RemoveSmelting(toStack(itemInput)));
|
||||
}
|
||||
|
||||
//second step: casting liquid + objetcs + plan into result
|
||||
@ZenMethod
|
||||
public static void addCast(ILiquidStack fluidInput, IItemStack[][] ingredients, IItemStack plan, IItemStack product) {
|
||||
ItemStack[] flatList = new ItemStack[9];
|
||||
for ( int i = 0; i < 3; i++) {
|
||||
for ( int j = 0; j < 3; j++) {
|
||||
flatList[i*3 + j] = toStack(ingredients[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(new Recipe(toStack(plan), toFluid(fluidInput), new ShapedRecipeCustom(3, 3, flatList, toStack(product)))));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeCasts(IItemStack product) {
|
||||
MineTweakerAPI.apply(new RemoveCastings(toStack(product)));
|
||||
}
|
||||
|
||||
/*
|
||||
Implements the actions to add a recipe
|
||||
Since the machine has two crafting Steps, this is a constructors for both
|
||||
*/
|
||||
private static class Add extends BaseListAddition {
|
||||
|
||||
public Add(Smelting recipe) {
|
||||
super("Forestry Thermionic Fabricator (Smelting)", RecipeManager.smeltings, recipe);
|
||||
}
|
||||
|
||||
public Add(Recipe recipe) {
|
||||
super("Forestry Thermionic Fabricator (Casting)", RecipeManager.recipes, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
if (recipe instanceof Smelting)
|
||||
return " Input:" + ((Smelting) recipe).getResource().getDisplayName();
|
||||
else
|
||||
return "Output: " + ((Recipe) recipe).asIRecipe().getRecipeOutput().getDisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Implements the actions to remove a smelting recipe
|
||||
*/
|
||||
private static class RemoveSmelting extends BaseListRemoval {
|
||||
|
||||
public RemoveSmelting(ItemStack input) {
|
||||
super("Forestry Thermionic Fabricator (Smelting)", RecipeManager.smeltings, input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (Smelting r : RecipeManager.smeltings) {
|
||||
if (r.getResource() != null && r.getResource().isItemEqual(stack)) {
|
||||
RecipeManager.smeltings.remove(r);
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return " Input:" + stack.getDisplayName(); // + " -- Output:" + ((Smelting) recipe).getProduct().getLocalizedName();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Implements the actions to remove a casting recipe
|
||||
*/
|
||||
private static class RemoveCastings extends BaseListRemoval {
|
||||
|
||||
public RemoveCastings(ItemStack output) {
|
||||
super("Forestry Thermionic Fabricator (Casting)", RecipeManager.recipes, output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (Recipe r : RecipeManager.recipes) {
|
||||
if (r.asIRecipe().getRecipeOutput() != null && r.asIRecipe().getRecipeOutput().isItemEqual(stack)) {
|
||||
RecipeManager.recipes.remove(r);
|
||||
recipe = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return " Output:" + stack.getDisplayName(); // + " -- Output:" + ((Recipe) recipe).asIRecipe().getIngredients()[0].getDisplayName();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user