diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-03-04 18:26:33 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-03-04 18:26:33 +0000 |
commit | af27ff015c4197bb5a6ddb7dd38769f8950a4ac9 (patch) | |
tree | d2b7eb3a05e2aec4f124cc054a535508a6141aae /src/Java/gtPlusPlus/xmod/thaumcraft/util | |
parent | 8ead0095f30769b0c12d558953323d45a2790d6e (diff) | |
download | GT5-Unofficial-af27ff015c4197bb5a6ddb7dd38769f8950a4ac9.tar.gz GT5-Unofficial-af27ff015c4197bb5a6ddb7dd38769f8950a4ac9.tar.bz2 GT5-Unofficial-af27ff015c4197bb5a6ddb7dd38769f8950a4ac9.zip |
+ Added more TC wrappers.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/thaumcraft/util')
-rw-r--r-- | src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java | 73 |
1 files changed, 42 insertions, 31 deletions
diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java index 6e275e9b67..c60a140819 100644 --- a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java +++ b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java @@ -5,34 +5,35 @@ import static gtPlusPlus.xmod.thaumcraft.HANDLER_Thaumcraft.sItemsToGetAspects; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.world.World; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.TC_Aspects; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Utility; - import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.thaumcraft.HANDLER_Thaumcraft; import gtPlusPlus.xmod.thaumcraft.aspect.GTPP_AspectStack; -import gtPlusPlus.xmod.thaumcraft.aspect.TC_Aspect_Wrapper; import gtPlusPlus.xmod.thaumcraft.aspect.TC_AspectList_Wrapper; +import gtPlusPlus.xmod.thaumcraft.aspect.TC_Aspect_Wrapper; import gtPlusPlus.xmod.thaumcraft.aspect.TC_ResearchCategories_Wrapper; import gtPlusPlus.xmod.thaumcraft.aspect.TC_ResearchCategoryList_Wrapper; import gtPlusPlus.xmod.thaumcraft.aspect.TC_ResearchItem_Wrapper; import gtPlusPlus.xmod.thaumcraft.aspect.TC_ResearchNoteData_Wrapper; import gtPlusPlus.xmod.thaumcraft.aspect.TC_ResearchPage_Wrapper; +import gtPlusPlus.xmod.thaumcraft.objects.wrapper.recipe.TC_CrucibleRecipe_Wrapper; +import gtPlusPlus.xmod.thaumcraft.objects.wrapper.recipe.TC_IArcaneRecipe_Wrapper; +import gtPlusPlus.xmod.thaumcraft.objects.wrapper.recipe.TC_InfusionEnchantmentRecipe_Wrapper; +import gtPlusPlus.xmod.thaumcraft.objects.wrapper.recipe.TC_InfusionRecipe_Wrapper; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.world.World; public class ThaumcraftUtils { @@ -40,10 +41,6 @@ public class ThaumcraftUtils { private static Class mClass_Aspect; private static Field mField_Aspects; - /*public static boolean addAspectToItem(ItemStack item, Aspect[] aspects, int amount) { - return addAspectToItem(item, getEnumAspect(aspect.getName()), amount); - }*/ - public static boolean addAspectToItem(ItemStack item, TC_Aspect_Wrapper aspect, int amount) { return addAspectToItem(item, new TC_Aspect_Wrapper[] {aspect}, new Integer[] {amount}); @@ -105,15 +102,15 @@ public class ThaumcraftUtils { } else if ((tPage instanceof IRecipe)) { tPages.add(new TC_ResearchPage_Wrapper((IRecipe) tPage)); } - /*else if ((tPage instanceof IArcaneRecipe)) { - tPages.add(new TC_ResearchPage_Wrapper((IArcaneRecipe) tPage)); - } else if ((tPage instanceof CrucibleRecipe)) { - tPages.add(new TC_ResearchPage_Wrapper((CrucibleRecipe) tPage)); - } else if ((tPage instanceof InfusionRecipe)) { - tPages.add(new TC_ResearchPage_Wrapper((InfusionRecipe) tPage)); - } else if ((tPage instanceof InfusionEnchantmentRecipe)) { - tPages.add(new TC_ResearchPage_Wrapper((InfusionEnchantmentRecipe) tPage)); - }*/ + else if ((tPage instanceof TC_IArcaneRecipe_Wrapper)) { + tPages.add(new TC_ResearchPage_Wrapper((TC_IArcaneRecipe_Wrapper) tPage)); + } else if ((tPage instanceof TC_CrucibleRecipe_Wrapper)) { + tPages.add(new TC_ResearchPage_Wrapper((TC_CrucibleRecipe_Wrapper) tPage)); + } else if ((tPage instanceof TC_InfusionRecipe_Wrapper)) { + tPages.add(new TC_ResearchPage_Wrapper((TC_InfusionRecipe_Wrapper) tPage)); + } else if ((tPage instanceof TC_InfusionEnchantmentRecipe_Wrapper)) { + tPages.add(new TC_ResearchPage_Wrapper((TC_InfusionEnchantmentRecipe_Wrapper) tPage)); + } } if ((aType & 0x40) != 0) { rResearch.setAutoUnlock(); @@ -226,6 +223,7 @@ public class ThaumcraftUtils { private static final Method mMethod_addCrucibleRecipe; private static final Method mMethod_getObjectAspects; private static final Method mMethod_updateData; + private static final Method mMethod_getData; private static final Field mField_PortholeBlacklist; static { @@ -255,8 +253,12 @@ public class ThaumcraftUtils { mMethod_addCrucibleRecipe = ReflectionUtils.getMethod(mClass_ThaumcraftApi, "addCrucibleRecipe", String.class, ItemStack.class, Object.class, mClass_AspectList); - mMethod_getObjectAspects = ReflectionUtils.getMethod(mClass_ThaumcraftApi, "getObjectAspects", ItemStack.class); + + mMethod_getObjectAspects = ReflectionUtils.getMethod(mClass_ThaumcraftApiHelper, "getObjectAspects", ItemStack.class); + + mMethod_updateData = ReflectionUtils.getMethod(mClass_ResearchManager, "updateData", ItemStack.class, ReflectionUtils.getClass("thaumcraft.common.lib.research.ResearchNoteData")); + mMethod_getData = ReflectionUtils.getMethod(mClass_ResearchManager, "getData", ItemStack.class); /* * Fields @@ -359,8 +361,17 @@ public class ThaumcraftUtils { mMethod_updateData.invoke(a, b.getResearchNoteData()); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); - } - + } + } + + public static Object getResearchNoteData(ItemStack a) { + //getData(a); + try { + return mMethod_getData.invoke(a); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + e.printStackTrace(); + } + return null; } public static boolean isItemResearchNotes(ItemStack aStack) { @@ -380,13 +391,13 @@ public class ThaumcraftUtils { public static TC_ResearchNoteData_Wrapper gatherResults(ItemStack note) { TC_ResearchNoteData_Wrapper research = null; if (isItemResearchNotes(note)) { - research = new TC_ResearchNoteData_Wrapper(ResearchManager.getData(note)); + research = new TC_ResearchNoteData_Wrapper(getResearchNoteData(note)); } return research; } - public static void placeAspectIntoResearchNote(ItemStack note, World aWorld, final int q, final int r, final Aspect aspect) { - TC_ResearchNoteData_Wrapper data = gatherResults(note); + public static void placeAspectIntoResearchNote(ItemStack note, World aWorld, final int q, final int r, final TC_Aspect_Wrapper aspect) { + /*TC_ResearchNoteData_Wrapper data = gatherResults(note); String mGTPP = CORE.gameProfile.getName(); EntityPlayer player = CORE.getFakePlayer(aWorld); @@ -416,7 +427,7 @@ public class ThaumcraftUtils { if (!aWorld.isRemote && ResearchManager.checkResearchCompletion(note, data, player.getCommandSenderName())) { note.setItemDamage(64); } - } + }*/ } public static void completeResearchNote(World aWorld, ItemStack aStack) { |