From e5a15e44d4bf7b24b304ee3af2a3d094ad648435 Mon Sep 17 00:00:00 2001 From: Technus Date: Fri, 23 Sep 2016 19:26:36 +0200 Subject: [PATCH] Revert "Fix missing code block (Muramasa)" This reverts commit b7bde9ca14ada8bacff82f2cc7ae440584ff03f1. --- .../java/gregtech/api/util/GT_ModHandler.java | 74 ++++++------------- 1 file changed, 23 insertions(+), 51 deletions(-) diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index b4a44753..00d63739 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -37,7 +37,6 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; -import java.lang.reflect.Method; import java.util.*; import java.util.Map.Entry; @@ -556,7 +555,7 @@ public class GT_ModHandler { if (GregTech_API.sRecipeFile.get(ConfigCategories.Machines.maceration, aInput, true)) { GT_Utility.addSimpleIC2MachineRecipe(aInput, getMaceratorRecipeList(), null, aOutput1); } - addMagneticraftRecipe(aInput, aOutput1, aOutput2, aChance2, aOutput3, aChance3); + RA.addPulveriserRecipe(aInput, new ItemStack[]{aOutput1, aOutput2, aOutput3}, new int[]{10000, aChance2 <= 0 ? 1000 : 100 * aChance2, aChance3 <= 0 ? 1000 : 100 * aChance3}, 400, 2); if (!OrePrefixes.log.contains(aInput)) { @@ -592,31 +591,6 @@ public class GT_ModHandler { return true; } - static Class tClass; - static Method tMethod1; - static Method tMethod2; - - public static boolean addMagneticraftRecipe(ItemStack aInput, ItemStack aOutput1, ItemStack aOutput2, int aChance2, ItemStack aOutput3, int aChance3){ - if(GT_Mod.gregtechproxy.mMagneticraftRecipes && Loader.isModLoaded("Magneticraft")){ - try { - if(tClass==null)tClass = Class.forName("com.cout970.magneticraft.api.access.MgRecipeRegister"); - if(tMethod1==null)tMethod1 = tClass.getMethod("registerCrusherRecipe", ItemStack.class, ItemStack.class,ItemStack.class, float.class, ItemStack.class, float.class); - if(tMethod2==null)tMethod2 = tClass.getMethod("registerGrinderRecipe", ItemStack.class, ItemStack.class,ItemStack.class, float.class, ItemStack.class, float.class); - - ItemData tData = GT_OreDictUnificator.getAssociation(aInput); - if(tData!=null&&tData.mPrefix!=null){ - if(tData.mPrefix==OrePrefixes.ore||tData.mPrefix==OrePrefixes.oreBlackgranite||tData.mPrefix==OrePrefixes.oreEndstone||tData.mPrefix==OrePrefixes.oreNetherrack||tData.mPrefix==OrePrefixes.oreRedgranite){ - tMethod1.invoke(null, aInput, aOutput1, aOutput2,(float)((float)aChance2/GT_Mod.gregtechproxy.mMagneticraftBonusOutputPercent), aOutput3,(float)((float)aChance3/GT_Mod.gregtechproxy.mMagneticraftBonusOutputPercent)); - }else if(tData.mPrefix==OrePrefixes.crushed||tData.mPrefix==OrePrefixes.crushedCentrifuged||tData.mPrefix==OrePrefixes.crushedPurified){ - tMethod2.invoke(null, aInput, aOutput1, aOutput2,(float)((float)aChance2/GT_Mod.gregtechproxy.mMagneticraftBonusOutputPercent), aOutput3,(float)((float)aChance3/GT_Mod.gregtechproxy.mMagneticraftBonusOutputPercent)); - } - } - - } catch (Exception e) {e.printStackTrace();} - } - return true; - } - /** * Adds a Recipe to the Sawmills of GregTech and ThermalCraft */ @@ -1183,7 +1157,7 @@ public class GT_ModHandler { if (rReturn != null) tList.remove(i--); tList_sS=tList.size(); } } - }} catch (Throwable e) {e.printStackTrace(GT_Log.err);} + }} catch (Throwable e) {e.printStackTrace(GT_Log.err);} return rReturn; } @@ -1318,21 +1292,21 @@ public class GT_ModHandler { ArrayList tList = (ArrayList) CraftingManager.getInstance().getRecipeList(); int tList_sS=tList.size(); try { - for (int i = 0; i < tList_sS; i++) { - temp = false; - temp = tList.get(i).matches(aCrafting, DW); - if (temp) { - ItemStack tOutput = aUncopiedStack ? tList.get(i).getRecipeOutput() : tList.get(i).getCraftingResult(aCrafting); - if (tOutput == null || tOutput.stackSize <= 0) { - // Seriously, who would ever do that shit? - if (!GregTech_API.sPostloadFinished) - throw new GT_ItsNotMyFaultException("Seems another Mod added a Crafting Recipe with null Output. Tell the Developer of said Mod to fix that."); - } else { - if (aUncopiedStack) return tOutput; - return GT_Utility.copy(tOutput); - } + for (int i = 0; i < tList_sS; i++) { + temp = false; + temp = tList.get(i).matches(aCrafting, DW); + if (temp) { + ItemStack tOutput = aUncopiedStack ? tList.get(i).getRecipeOutput() : tList.get(i).getCraftingResult(aCrafting); + if (tOutput == null || tOutput.stackSize <= 0) { + // Seriously, who would ever do that shit? + if (!GregTech_API.sPostloadFinished) + throw new GT_ItsNotMyFaultException("Seems another Mod added a Crafting Recipe with null Output. Tell the Developer of said Mod to fix that."); + } else { + if (aUncopiedStack) return tOutput; + return GT_Utility.copy(tOutput); } - }} catch (Throwable e) {e.printStackTrace(GT_Log.err);} + } + }} catch (Throwable e) {e.printStackTrace(GT_Log.err);} return null; } @@ -1350,7 +1324,6 @@ public class GT_ModHandler { for (IRecipe tRecipe : (ArrayList) CraftingManager.getInstance().getRecipeList()) { ItemStack tStack = tRecipe.getRecipeOutput(); if (GT_Utility.isStackValid(tStack) && tStack.getMaxStackSize() == 1 && tStack.getMaxDamage() > 0 && !(tStack.getItem() instanceof ItemBlock) && !(tStack.getItem() instanceof IReactorComponent) && !isElectricItem(tStack) && !GT_Utility.isStackInList(tStack, sNonReplaceableItems)) { - //if (!(tRecipe instanceof ShapelessRecipes) || tRecipe instanceof ShapelessOreRecipe) { if (tRecipe instanceof ShapedOreRecipe) { boolean temp = true; for (Object tObject : ((ShapedOreRecipe) tRecipe).getInput()) { @@ -1363,7 +1336,8 @@ public class GT_ModHandler { temp = false; break; } - }} + } + } if (temp) {sSingleNonBlockDamagableRecipeList.add(tRecipe);} } else if (tRecipe instanceof ShapedRecipes) { boolean temp = true; @@ -1377,7 +1351,6 @@ public class GT_ModHandler { } else { sSingleNonBlockDamagableRecipeList.add(tRecipe); } - //} } } GT_Log.out.println("GT_Mod: Created a List of Tool Recipes containing " + sSingleNonBlockDamagableRecipeList.size() + " Recipes for recycling." + (sSingleNonBlockDamagableRecipeList.size() > 1024 ? " Scanning all these Recipes is the reason for the startup Lag you receive right now." : E)); @@ -1399,7 +1372,6 @@ public class GT_ModHandler { } } } - } /*ArrayList */ if (sSingleNonBlockDamagableRecipeList_verified.size() != 0) {rList = getRecipeOutputs(sSingleNonBlockDamagableRecipeList_verified, true, aRecipe);} @@ -1462,11 +1434,11 @@ public class GT_ModHandler { } else { rList.add(GT_Utility.copy(tOutput)); if (aDeleteFromList) {tempaList_list.add(i);} + } } } - } - //boolean tempaList_list_b = tempaList_list.size() != 0 ? true : false; - if (aDeleteFromList && tempaList_list.size() != 0) { + //boolean tempaList_list_b = tempaList_list.size() != 0 ? true : false; + if (aDeleteFromList && tempaList_list.size() != 0) { List tempaList_2 = new ArrayList(); for (int i = 0; i < aList_sS; i++) { int k = 0, l = 0; @@ -1524,7 +1496,7 @@ public class GT_ModHandler { for (Entry tEntry : aRecipeList.entrySet()) { if (tEntry.getKey().matches(aInput)) { if (tEntry.getKey().getAmount() <= aInput.stackSize) { - ItemStack[] tList = (ItemStack[]) tEntry.getValue().items.toArray(new ItemStack[tEntry.getValue().items.size()]); + ItemStack[] tList = (ItemStack[]) tEntry.getValue().items.toArray(); if (tList.length == 0) break; ItemStack[] rList = new ItemStack[aOutputSlots.length]; rRecipeMetaData.setTag("return", tEntry.getValue().metadata); @@ -1986,4 +1958,4 @@ public class GT_ModHandler { FMLInterModComms.sendMessage("ThermalExpansion", "Coolant", toSend); } } -} +} \ No newline at end of file