From e10456295def2ea5bacede8ab954524aa03165a4 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Fri, 5 Oct 2018 18:46:54 +0200 Subject: try for force unification of assembler recipes --- src/main/java/gregtech/api/util/GT_Recipe.java | 50 +++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) (limited to 'src/main/java/gregtech/api/util/GT_Recipe.java') diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 6750fb895f..234dc994d8 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -19,6 +19,7 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; +import net.minecraftforge.oredict.OreDictionary; import java.util.*; @@ -1295,24 +1296,71 @@ public class GT_Recipe implements Comparable { * Special Class for Assembler handling. */ public static class GT_Recipe_Map_Assembler extends GT_Recipe_Map { + public GT_Recipe_Map_Assembler(Collection aRecipeList, String aUnlocalizedName, String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount, int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre, int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI, boolean aNEIAllowed) { super(aRecipeList, aUnlocalizedName, aLocalName, aNEIName, aNEIGUIPath, aUsualInputCount, aUsualOutputCount, aMinimalInputItems, aMinimalInputFluids, aAmperage, aNEISpecialValuePre, aNEISpecialValueMultiplier, aNEISpecialValuePost, aShowVoltageAmperageInNEI, aNEIAllowed); } @Override public GT_Recipe findRecipe(IHasWorldObjectAndCoords aTileEntity, GT_Recipe aRecipe, boolean aNotUnificated, long aVoltage, FluidStack[] aFluids, ItemStack aSpecialSlot, ItemStack... aInputs) { - GT_Recipe rRecipe = super.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, aSpecialSlot, aInputs); + + GT_Recipe rRecipe = super.findRecipe(aTileEntity, aRecipe, true, aVoltage, aFluids, aSpecialSlot, aInputs); +/* + + + Doesnt work, keep it as a reminder tho + + if (rRecipe == null){ + Set aInputs2 = new TreeSet(); + for (ItemStack aInput : aInputs) { + aInputs2.add(aInput); + } + + for (ItemStack aInput : aInputs) { + aInputs2.remove(aInput); + int[] oredictIDs = OreDictionary.getOreIDs(aInput); + if ( oredictIDs.length > 1){ + for (final int i : oredictIDs){ + final ItemStack[] oredictIS = (ItemStack[]) OreDictionary.getOres(OreDictionary.getOreName(i)).toArray(); + if (oredictIS != null && oredictIS.length > 1){ + for (final ItemStack IS : oredictIS){ + aInputs2.add(IS); + ItemStack[] temp = (ItemStack[]) aInputs2.toArray(); + rRecipe = super.findRecipe(aTileEntity, aRecipe, aNotUnificated, aVoltage, aFluids, aSpecialSlot,temp); + if(rRecipe!= null){ + break; + } + else { + aInputs2.remove(IS); + } + } + if(rRecipe!= null) + break; + } + } + if(rRecipe!= null) + break; + }else + aInputs2.add(aInput); + if(rRecipe!= null) + break; + } + } +*/ if (aInputs == null || aInputs.length <= 0 || aInputs[0] == null || rRecipe == null || !GregTech_API.sPostloadFinished) return rRecipe; + for (ItemStack aInput : aInputs) { if (ItemList.Paper_Printed_Pages.isStackEqual(aInput, false, true)) { rRecipe = rRecipe.copy(); rRecipe.mCanBeBuffered = false; rRecipe.mOutputs[0].setTagCompound(aInput.getTagCompound()); } + } return rRecipe; } + } /** -- cgit