Forestry support!
excluding Centrifuge
This commit is contained in:
parent
a977368b08
commit
df7c625652
Binary file not shown.
BIN
libs/forestry_1.7.10-3.3.0.6-dev.jar
Normal file
BIN
libs/forestry_1.7.10-3.3.0.6-dev.jar
Normal file
Binary file not shown.
|
@ -10,7 +10,9 @@ import modtweaker.mods.botania.Botania;
|
|||
import modtweaker.mods.exnihilo.ExNihilo;
|
||||
import modtweaker.mods.extendedworkbench.ExtendedWorkbench;
|
||||
import modtweaker.mods.factorization.Factorization;
|
||||
import modtweaker.mods.forestry.Forestry;
|
||||
import modtweaker.mods.fsp.Steamcraft;
|
||||
import modtweaker.mods.hee.HardcoreEnderExpansion;
|
||||
import modtweaker.mods.mariculture.Mariculture;
|
||||
import modtweaker.mods.mekanism.Mekanism;
|
||||
import modtweaker.mods.mekanism.gas.GasLogger;
|
||||
|
@ -41,7 +43,7 @@ public class ModTweaker {
|
|||
TweakerPlugin.register("exnihilo", ExNihilo.class);
|
||||
TweakerPlugin.register("extendedWorkbench", ExtendedWorkbench.class);
|
||||
TweakerPlugin.register("factorization", Factorization.class);
|
||||
// TweakerPlugin.register("HardcoreEnderExpansion", HardcoreEnderExpansion.class);
|
||||
TweakerPlugin.register("HardcoreEnderExpansion", HardcoreEnderExpansion.class);
|
||||
TweakerPlugin.register("Mariculture", Mariculture.class);
|
||||
TweakerPlugin.register("Mekanism", Mekanism.class);
|
||||
TweakerPlugin.register("Metallurgy", Metallurgy.class);
|
||||
|
@ -51,6 +53,7 @@ public class ModTweaker {
|
|||
TweakerPlugin.register("TConstruct", TConstruct.class);
|
||||
TweakerPlugin.register("Thaumcraft", Thaumcraft.class);
|
||||
TweakerPlugin.register("ThermalExpansion", ThermalExpansion.class);
|
||||
TweakerPlugin.register("Forestry", Forestry.class);
|
||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
MinecraftForge.EVENT_BUS.register(new ClientEvents());
|
||||
}
|
||||
|
|
|
@ -9,110 +9,128 @@ import minetweaker.api.liquid.ILiquidStack;
|
|||
import minetweaker.api.oredict.IOreDictEntry;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class InputHelper {
|
||||
public static boolean isABlock(IItemStack block) {
|
||||
if (!(isABlock(toStack(block)))) {
|
||||
MineTweakerAPI.getLogger().logError("Item must be a block, or you must specify a block to render as when adding a TConstruct Melting recipe");
|
||||
return false;
|
||||
} else return true;
|
||||
}
|
||||
public static boolean isABlock(IItemStack block) {
|
||||
if (!(isABlock(toStack(block)))) {
|
||||
MineTweakerAPI.getLogger().logError("Item must be a block, or you must specify a block to render as when adding a TConstruct Melting recipe");
|
||||
return false;
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isABlock(ItemStack block) {
|
||||
return block.getItem() instanceof ItemBlock;
|
||||
}
|
||||
public static boolean isABlock(ItemStack block) {
|
||||
return block.getItem() instanceof ItemBlock;
|
||||
}
|
||||
|
||||
public static ItemStack toStack(IItemStack iStack) {
|
||||
if (iStack == null) return null;
|
||||
else {
|
||||
Object internal = iStack.getInternal();
|
||||
if (internal == null || !(internal instanceof ItemStack)) {
|
||||
MineTweakerAPI.getLogger().logError("Not a valid item stack: " + iStack);
|
||||
}
|
||||
public static ItemStack toStack(IItemStack iStack) {
|
||||
if (iStack == null)
|
||||
return null;
|
||||
else {
|
||||
Object internal = iStack.getInternal();
|
||||
if (internal == null || !(internal instanceof ItemStack)) {
|
||||
MineTweakerAPI.getLogger().logError("Not a valid item stack: " + iStack);
|
||||
}
|
||||
|
||||
return (ItemStack) internal;
|
||||
}
|
||||
}
|
||||
return (ItemStack) internal;
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack[] toStacks(IItemStack[] iStack) {
|
||||
if (iStack == null) return null;
|
||||
else {
|
||||
ItemStack[] output = new ItemStack[iStack.length];
|
||||
for (int i = 0; i < iStack.length; i++) {
|
||||
output[i] = toStack(iStack[i]);
|
||||
}
|
||||
public static ItemStack[] toStacks(IItemStack[] iStack) {
|
||||
if (iStack == null)
|
||||
return null;
|
||||
else {
|
||||
ItemStack[] output = new ItemStack[iStack.length];
|
||||
for (int i = 0; i < iStack.length; i++) {
|
||||
output[i] = toStack(iStack[i]);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object toObject(IIngredient iStack) {
|
||||
if (iStack == null) return null;
|
||||
else {
|
||||
if (iStack instanceof IOreDictEntry) {
|
||||
return toString((IOreDictEntry) iStack);
|
||||
} else if (iStack instanceof IItemStack) {
|
||||
return toStack((IItemStack) iStack);
|
||||
} else return null;
|
||||
}
|
||||
}
|
||||
public static Object toObject(IIngredient iStack) {
|
||||
if (iStack == null)
|
||||
return null;
|
||||
else {
|
||||
if (iStack instanceof IOreDictEntry) {
|
||||
return toString((IOreDictEntry) iStack);
|
||||
} else if (iStack instanceof IItemStack) {
|
||||
return toStack((IItemStack) iStack);
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object[] toObjects(IIngredient[] ingredient) {
|
||||
if (ingredient == null) return null;
|
||||
else {
|
||||
Object[] output = new Object[ingredient.length];
|
||||
for (int i = 0; i < ingredient.length; i++) {
|
||||
if (ingredient[i] != null) {
|
||||
output[i] = toObject(ingredient[i]);
|
||||
} else output[i] = "";
|
||||
}
|
||||
public static Object[] toObjects(IIngredient[] ingredient) {
|
||||
if (ingredient == null)
|
||||
return null;
|
||||
else {
|
||||
Object[] output = new Object[ingredient.length];
|
||||
for (int i = 0; i < ingredient.length; i++) {
|
||||
if (ingredient[i] != null) {
|
||||
output[i] = toObject(ingredient[i]);
|
||||
} else
|
||||
output[i] = "";
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
public static Object[] toShapedObjects(IIngredient[][] ingredients) {
|
||||
if (ingredients == null) return null;
|
||||
else {
|
||||
ArrayList prep = new ArrayList();
|
||||
prep.add("abc");
|
||||
prep.add("def");
|
||||
prep.add("ghi");
|
||||
char[][] map = new char[][] { { 'a', 'b', 'c' }, { 'd', 'e', 'f' }, { 'g', 'h', 'i' } };
|
||||
for (int x = 0; x < ingredients.length; x++) {
|
||||
if (ingredients[x] != null) {
|
||||
for (int y = 0; y < ingredients[x].length; y++) {
|
||||
if (ingredients[x][y] != null && x < map.length && y < map[x].length) {
|
||||
prep.add(map[x][y]);
|
||||
prep.add(toObject(ingredients[x][y]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return prep.toArray();
|
||||
}
|
||||
}
|
||||
public static Object[] toShapedObjects(IIngredient[][] ingredients) {
|
||||
if (ingredients == null)
|
||||
return null;
|
||||
else {
|
||||
ArrayList prep = new ArrayList();
|
||||
prep.add("abc");
|
||||
prep.add("def");
|
||||
prep.add("ghi");
|
||||
char[][] map = new char[][] { { 'a', 'b', 'c' }, { 'd', 'e', 'f' }, { 'g', 'h', 'i' } };
|
||||
for (int x = 0; x < ingredients.length; x++) {
|
||||
if (ingredients[x] != null) {
|
||||
for (int y = 0; y < ingredients[x].length; y++) {
|
||||
if (ingredients[x][y] != null && x < map.length && y < map[x].length) {
|
||||
prep.add(map[x][y]);
|
||||
prep.add(toObject(ingredients[x][y]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return prep.toArray();
|
||||
}
|
||||
}
|
||||
|
||||
public static String toString(IOreDictEntry entry) {
|
||||
return ((IOreDictEntry) entry).getName();
|
||||
}
|
||||
public static String toString(IOreDictEntry entry) {
|
||||
return ((IOreDictEntry) entry).getName();
|
||||
}
|
||||
|
||||
public static FluidStack toFluid(ILiquidStack iStack) {
|
||||
if (iStack == null) {
|
||||
return null;
|
||||
} else return FluidRegistry.getFluidStack(iStack.getName(), iStack.getAmount());
|
||||
}
|
||||
public static FluidStack toFluid(ILiquidStack iStack) {
|
||||
if (iStack == null) {
|
||||
return null;
|
||||
} else
|
||||
return FluidRegistry.getFluidStack(iStack.getName(), iStack.getAmount());
|
||||
}
|
||||
|
||||
public static FluidStack[] toFluids(IIngredient[] input) {
|
||||
return toFluids((IItemStack[]) input);
|
||||
}
|
||||
public static Fluid getFluid(ILiquidStack iStack) {
|
||||
if (iStack == null) {
|
||||
return null;
|
||||
} else
|
||||
return FluidRegistry.getFluid(iStack.getName());
|
||||
|
||||
public static FluidStack[] toFluids(ILiquidStack[] iStack) {
|
||||
FluidStack[] stack = new FluidStack[iStack.length];
|
||||
for (int i = 0; i < stack.length; i++)
|
||||
stack[i] = toFluid(iStack[i]);
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
public static FluidStack[] toFluids(IIngredient[] input) {
|
||||
return toFluids((IItemStack[]) input);
|
||||
}
|
||||
|
||||
public static FluidStack[] toFluids(ILiquidStack[] iStack) {
|
||||
FluidStack[] stack = new FluidStack[iStack.length];
|
||||
for (int i = 0; i < stack.length; i++)
|
||||
stack[i] = toFluid(iStack[i]);
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
|
22
src/main/java/modtweaker/mods/forestry/Forestry.java
Normal file
22
src/main/java/modtweaker/mods/forestry/Forestry.java
Normal file
|
@ -0,0 +1,22 @@
|
|||
package modtweaker.mods.forestry;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import modtweaker.mods.forestry.handlers.Bees;
|
||||
import modtweaker.mods.forestry.handlers.Carpenter;
|
||||
import modtweaker.mods.forestry.handlers.Fermenter;
|
||||
import modtweaker.mods.forestry.handlers.Moistener;
|
||||
import modtweaker.mods.forestry.handlers.Squeezer;
|
||||
import modtweaker.mods.forestry.handlers.Still;
|
||||
|
||||
public class Forestry {
|
||||
public Forestry() {
|
||||
MineTweakerAPI.registerClass(Fermenter.class);
|
||||
MineTweakerAPI.registerClass(Bees.class);
|
||||
MineTweakerAPI.registerClass(Still.class);
|
||||
MineTweakerAPI.registerClass(Moistener.class);
|
||||
MineTweakerAPI.registerClass(Carpenter.class);
|
||||
MineTweakerAPI.registerClass(Squeezer.class);
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package modtweaker.mods.forestry;
|
||||
|
||||
public class ForestryHelper {
|
||||
|
||||
}
|
83
src/main/java/modtweaker/mods/forestry/handlers/Bees.java
Normal file
83
src/main/java/modtweaker/mods/forestry/handlers/Bees.java
Normal file
|
@ -0,0 +1,83 @@
|
|||
package modtweaker.mods.forestry.handlers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker.helpers.InputHelper;
|
||||
import modtweaker.util.BaseListAddition;
|
||||
import modtweaker.util.BaseListRemoval;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.apiculture.genetics.BeeMutation;
|
||||
import forestry.factory.gadgets.MachineFermenter.Recipe;
|
||||
import forestry.factory.gadgets.MachineFermenter.RecipeManager;
|
||||
|
||||
@ZenClass("mods.forestry.Bees")
|
||||
public class Bees {
|
||||
|
||||
@ZenMethod
|
||||
public static void addFlower(IItemStack stack) {
|
||||
MineTweakerAPI.apply(new Add(InputHelper.toStack(stack)));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition {
|
||||
public Add(ItemStack recipe) {
|
||||
super("Forestry Bees Flowers", FlowerManager.plainFlowers, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return ((Recipe) recipe).output.getLocalizedName();
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeFlower(IItemStack stack) {
|
||||
MineTweakerAPI.apply(new Remove(FlowerManager.plainFlowers, InputHelper.toStack(stack)));
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval {
|
||||
|
||||
public Remove(List list, ItemStack stack) {
|
||||
super(list, stack);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (ItemStack r : FlowerManager.plainFlowers) {
|
||||
if (r != null && r.isItemEqual(stack)) {
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
FlowerManager.plainFlowers.remove(recipe);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void clearFlowerList() {
|
||||
MineTweakerAPI.apply(new Clear());
|
||||
}
|
||||
|
||||
private static class Clear extends BaseListRemoval {
|
||||
|
||||
public Clear() {
|
||||
super(FlowerManager.plainFlowers, new ItemStack(Blocks.air));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
FlowerManager.plainFlowers.clear();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
package modtweaker.mods.forestry.handlers;
|
||||
|
||||
import static modtweaker.helpers.InputHelper.toStack;
|
||||
import static modtweaker.helpers.InputHelper.toFluid;
|
||||
import static modtweaker.helpers.InputHelper.toStacks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import minetweaker.api.recipes.ShapedRecipe;
|
||||
import minetweaker.mc1710.recipes.RecipeConverter;
|
||||
import modtweaker.helpers.InputHelper;
|
||||
import modtweaker.util.BaseListAddition;
|
||||
import modtweaker.util.BaseListRemoval;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
import forestry.factory.gadgets.MachineCarpenter;
|
||||
import forestry.factory.gadgets.MachineCarpenter.Recipe;
|
||||
import forestry.factory.gadgets.MachineCarpenter.RecipeManager;
|
||||
|
||||
@ZenClass("mods.forestry.Carpenter")
|
||||
public class Carpenter {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(int packagingTime, ILiquidStack liquid, IItemStack box, IItemStack[] ingredients, 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(box), 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return ((Recipe) recipe).getCraftingResult().getDisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
@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(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,5 @@
|
|||
package modtweaker.mods.forestry.handlers;
|
||||
|
||||
public class Entity {
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package modtweaker.mods.forestry.handlers;
|
||||
|
||||
import static modtweaker.helpers.InputHelper.toStack;
|
||||
import static modtweaker.helpers.InputHelper.toFluid;
|
||||
import static modtweaker.helpers.InputHelper.getFluid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import modtweaker.helpers.InputHelper;
|
||||
import modtweaker.util.BaseListAddition;
|
||||
import modtweaker.util.BaseListRemoval;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.Forestry;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.factory.gadgets.MachineFermenter;
|
||||
import forestry.factory.gadgets.MachineFermenter.Recipe;
|
||||
import forestry.factory.gadgets.MachineFermenter.RecipeManager;
|
||||
|
||||
@ZenClass("mods.forestry.Fermenter")
|
||||
public class Fermenter {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack resource, int fermentationValue, float modifier, ILiquidStack output, ILiquidStack liquid) {
|
||||
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(ILiquidStack output) {
|
||||
MineTweakerAPI.apply(new Remove(MachineFermenter.RecipeManager.recipes, toFluid(output)));
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval {
|
||||
|
||||
public Remove(List list, FluidStack stack) {
|
||||
super(list, stack);
|
||||
|
||||
}
|
||||
|
||||
@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,63 @@
|
|||
package modtweaker.mods.forestry.handlers;
|
||||
|
||||
import static modtweaker.helpers.InputHelper.toStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker.util.BaseListAddition;
|
||||
import modtweaker.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;
|
||||
|
||||
@ZenClass("mods.forestry.Moistener")
|
||||
public class Moistener {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack resource, IItemStack product, int timePerItem) {
|
||||
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,67 @@
|
|||
package modtweaker.mods.forestry.handlers;
|
||||
|
||||
import static modtweaker.helpers.InputHelper.getFluid;
|
||||
import static modtweaker.helpers.InputHelper.toFluid;
|
||||
import static modtweaker.helpers.InputHelper.toStack;
|
||||
import static modtweaker.helpers.InputHelper.toStacks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import modtweaker.util.BaseListAddition;
|
||||
import modtweaker.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;
|
||||
|
||||
@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 output) {
|
||||
MineTweakerAPI.apply(new Remove(MachineSqueezer.RecipeManager.recipes, toFluid(output)));
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval {
|
||||
|
||||
public Remove(List list, FluidStack stack) {
|
||||
super(list, stack);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (Recipe r : RecipeManager.recipes) {
|
||||
if (r.liquid != null && r.liquid.isFluidEqual(fluid)) {
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
RecipeManager.recipes.remove(recipe);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
73
src/main/java/modtweaker/mods/forestry/handlers/Still.java
Normal file
73
src/main/java/modtweaker/mods/forestry/handlers/Still.java
Normal file
|
@ -0,0 +1,73 @@
|
|||
package modtweaker.mods.forestry.handlers;
|
||||
|
||||
import static modtweaker.helpers.InputHelper.toStack;
|
||||
import static modtweaker.helpers.InputHelper.toFluid;
|
||||
import static modtweaker.helpers.InputHelper.getFluid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
import modtweaker.helpers.InputHelper;
|
||||
import modtweaker.util.BaseListAddition;
|
||||
import modtweaker.util.BaseListRemoval;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
import forestry.Forestry;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.factory.gadgets.MachineSqueezer;
|
||||
import forestry.factory.gadgets.MachineStill;
|
||||
import forestry.factory.gadgets.MachineStill.Recipe;
|
||||
import forestry.factory.gadgets.MachineStill.RecipeManager;
|
||||
|
||||
@ZenClass("mods.forestry.Still")
|
||||
public class Still {
|
||||
|
||||
@ZenMethod
|
||||
public static void addRecipe(int timePerUnit, ILiquidStack input, ILiquidStack output) {
|
||||
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) {
|
||||
MineTweakerAPI.apply(new Remove(MachineStill.RecipeManager.recipes, toFluid(output)));
|
||||
}
|
||||
|
||||
private static class Remove extends BaseListRemoval {
|
||||
|
||||
public Remove(List list, FluidStack stack) {
|
||||
super(list, stack);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
for (Recipe r : RecipeManager.recipes) {
|
||||
if (r.output != null && r.output.isFluidEqual(fluid)) {
|
||||
recipe = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
RecipeManager.recipes.remove(recipe);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -12,33 +12,40 @@ import com.teammetallurgy.metallurgy.recipes.AlloyerRecipes.AlloyRecipe;
|
|||
import com.teammetallurgy.metallurgy.recipes.CrusherRecipes;
|
||||
|
||||
public class MetallurgyHelper {
|
||||
public static ArrayList<AlloyRecipe> alloyerRecipes = null;
|
||||
public static HashMap<String, ItemStack> crusherMetaList = null;
|
||||
public static HashMap<String, ItemStack[]> crusherInputList = null;
|
||||
public static ArrayList<AlloyRecipe> alloyerRecipes = null;
|
||||
public static HashMap<String, ItemStack> crusherMetaList = null;
|
||||
public static HashMap<String, ItemStack[]> crusherInputList = null;
|
||||
|
||||
static {
|
||||
try {
|
||||
alloyerRecipes = ReflectionHelper.getFinalObject(AlloyerRecipes.getInstance(), "recipes");
|
||||
crusherMetaList = ReflectionHelper.getFinalObject(CrusherRecipes.getInstance(), "metaList");
|
||||
crusherInputList = ReflectionHelper.getFinalObject(CrusherRecipes.getInstance(), "inputList");
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
static {
|
||||
try {
|
||||
alloyerRecipes = ReflectionHelper.getFinalObject(AlloyerRecipes.getInstance(), "recipes");
|
||||
crusherMetaList = ReflectionHelper.getFinalObject(CrusherRecipes.getInstance(), "metaList");
|
||||
crusherInputList = ReflectionHelper.getFinalObject(CrusherRecipes.getInstance(), "inputList");
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
private MetallurgyHelper() {}
|
||||
private MetallurgyHelper() {
|
||||
}
|
||||
|
||||
public static String getCrusherKey(ItemStack input) {
|
||||
return input.getUnlocalizedName();
|
||||
}
|
||||
public static String getCrusherKey(ItemStack input) {
|
||||
return input.getUnlocalizedName();
|
||||
}
|
||||
|
||||
//Returns a Drying Recipe, using reflection as the constructor is not visible
|
||||
public static AlloyRecipe getAlloyRecipe(ItemStack first, ItemStack base, ItemStack result) {
|
||||
try {
|
||||
Constructor constructor = AlloyRecipe.class.getDeclaredConstructor(ItemStack.class, ItemStack.class, ItemStack.class);
|
||||
constructor.setAccessible(true);
|
||||
return (AlloyRecipe) constructor.newInstance(first, base, result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new NullPointerException("Failed to instantiate AlloyRecipe");
|
||||
}
|
||||
}
|
||||
// Returns a Drying Recipe, using reflection as the constructor is not
|
||||
// visible
|
||||
public static AlloyRecipe getAlloyRecipe(ItemStack first, ItemStack base, ItemStack result) {
|
||||
try {
|
||||
// Constructor constructor =
|
||||
// AlloyRecipe.class.getDeclaredConstructor(ItemStack.class,
|
||||
// ItemStack.class, ItemStack.class);
|
||||
// constructor.setAccessible(true);
|
||||
// return (AlloyRecipe) constructor.newInstance(first, base,
|
||||
// result);
|
||||
return AlloyerRecipes.getInstance().new AlloyRecipe(first, base, result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new NullPointerException("Failed to instantiate AlloyRecipe");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
3
src/main/resources/IMC Todo
Normal file
3
src/main/resources/IMC Todo
Normal file
|
@ -0,0 +1,3 @@
|
|||
Tinkers construct
|
||||
EnderIO
|
||||
Forestry
|
Loading…
Reference in a new issue