mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-11-25 06:34:30 +00:00
Forestry support!
excluding Centrifuge
This commit is contained in:
1 parent
a977368b08
commit
df7c625652
15 files changed
+624
-115
No files matched your search
@@ -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 {
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user