fix: add liquid to Forestry Carpenters internal tank filter, so new liquids are accepted
this time via relfection and hopefully working modified: src/main/java/modtweaker/mods/forestry/ForestryHelper.java modified: src/main/java/modtweaker/mods/forestry/handlers/Carpenter.java
This commit is contained in:
parent
1433b93430
commit
3e070271b1
2 changed files with 31 additions and 5 deletions
|
@ -1,5 +1,29 @@
|
||||||
package modtweaker.mods.forestry;
|
package modtweaker.mods.forestry;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
|
||||||
public class ForestryHelper {
|
public class ForestryHelper {
|
||||||
|
|
||||||
|
@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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package modtweaker.mods.forestry.handlers;
|
||||||
import static modtweaker.helpers.InputHelper.toStack;
|
import static modtweaker.helpers.InputHelper.toStack;
|
||||||
import static modtweaker.helpers.InputHelper.toFluid;
|
import static modtweaker.helpers.InputHelper.toFluid;
|
||||||
import static modtweaker.helpers.InputHelper.toStacks;
|
import static modtweaker.helpers.InputHelper.toStacks;
|
||||||
import static modtweaker.helpers.LogHelper.print;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -13,7 +12,6 @@ import minetweaker.api.item.IItemStack;
|
||||||
import minetweaker.api.liquid.ILiquidStack;
|
import minetweaker.api.liquid.ILiquidStack;
|
||||||
import minetweaker.api.recipes.ShapedRecipe;
|
import minetweaker.api.recipes.ShapedRecipe;
|
||||||
import minetweaker.mc1710.recipes.RecipeConverter;
|
import minetweaker.mc1710.recipes.RecipeConverter;
|
||||||
import modtweaker.helpers.InputHelper;
|
|
||||||
import modtweaker.util.BaseListAddition;
|
import modtweaker.util.BaseListAddition;
|
||||||
import modtweaker.util.BaseListRemoval;
|
import modtweaker.util.BaseListRemoval;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
@ -21,13 +19,13 @@ import net.minecraft.item.ItemStack;
|
||||||
import stanhebben.zenscript.annotations.ZenClass;
|
import stanhebben.zenscript.annotations.ZenClass;
|
||||||
import stanhebben.zenscript.annotations.ZenMethod;
|
import stanhebben.zenscript.annotations.ZenMethod;
|
||||||
import forestry.api.recipes.RecipeManagers;
|
import forestry.api.recipes.RecipeManagers;
|
||||||
import forestry.apiculture.FlowerProviderCacti;
|
|
||||||
import forestry.core.utils.ShapedRecipeCustom;
|
import forestry.core.utils.ShapedRecipeCustom;
|
||||||
import forestry.factory.gadgets.MachineCarpenter;
|
import forestry.factory.gadgets.MachineCarpenter;
|
||||||
import forestry.factory.gadgets.MachineFermenter;
|
|
||||||
import forestry.factory.gadgets.MachineCarpenter.Recipe;
|
import forestry.factory.gadgets.MachineCarpenter.Recipe;
|
||||||
import forestry.factory.gadgets.MachineCarpenter.RecipeManager;
|
import forestry.factory.gadgets.MachineCarpenter.RecipeManager;
|
||||||
|
|
||||||
|
import modtweaker.mods.forestry.ForestryHelper;
|
||||||
|
|
||||||
@ZenClass("mods.forestry.Carpenter")
|
@ZenClass("mods.forestry.Carpenter")
|
||||||
public class Carpenter {
|
public class Carpenter {
|
||||||
|
|
||||||
|
@ -52,8 +50,13 @@ public class Carpenter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Add extends BaseListAddition {
|
private static class Add extends BaseListAddition {
|
||||||
|
|
||||||
public Add(Recipe recipe) {
|
public Add(Recipe recipe) {
|
||||||
super("Forestry Carpenter", MachineCarpenter.RecipeManager.recipes, 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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +81,6 @@ public class Carpenter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RecipeManager.recipes.remove(recipe);
|
RecipeManager.recipes.remove(recipe);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue