From beec0136258e74b0899e731603a209af7d3aa93f Mon Sep 17 00:00:00 2001 From: pahimar Date: Mon, 16 Dec 2013 23:08:46 -0500 Subject: [PATCH] Playing around with a smarter RecipesVanilla --- .../ee3/item/crafting/RecipesVanilla.java | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/pahimar/ee3/item/crafting/RecipesVanilla.java b/src/main/java/com/pahimar/ee3/item/crafting/RecipesVanilla.java index 6282aba6..342149fa 100644 --- a/src/main/java/com/pahimar/ee3/item/crafting/RecipesVanilla.java +++ b/src/main/java/com/pahimar/ee3/item/crafting/RecipesVanilla.java @@ -2,6 +2,7 @@ package com.pahimar.ee3.item.crafting; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; +import com.pahimar.ee3.core.helper.ItemHelper; import com.pahimar.ee3.core.helper.LogHelper; import com.pahimar.ee3.core.helper.RecipeHelper; import com.pahimar.ee3.item.WrappedStack; @@ -9,7 +10,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public class RecipesVanilla @@ -39,8 +44,7 @@ public class RecipesVanilla { // TODO Handle different IRecipe types here - LogHelper.debug(recipeObject.getClass().getCanonicalName()); - + experimentalHandleIC2AdvRecipe((IRecipe) recipeObject); IRecipe recipe = (IRecipe) recipeObject; ItemStack recipeOutput = recipe.getRecipeOutput(); @@ -58,4 +62,28 @@ public class RecipesVanilla } } } + + private static void experimentalHandleIC2AdvRecipe(IRecipe recipeObject) + { + if (recipeObject.getClass().getCanonicalName().equalsIgnoreCase("ic2.core.AdvRecipe")) + { + try + { + Object object = Class.forName("ic2.core.AdvRecipe").getDeclaredField("output").get(recipeObject); + LogHelper.debug(object); + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + catch (NoSuchFieldException e) + { + e.printStackTrace(); + } + catch (ClassNotFoundException e) + { + e.printStackTrace(); + } + } + } }