From f05f216f308479f320b4168cbcfc98ec6a4e41e1 Mon Sep 17 00:00:00 2001 From: Techlone Date: Sun, 12 Mar 2017 00:16:10 +0500 Subject: [PATCH 1/4] Added new config value useOnlyGoodSolderingMaterials --- .../java/gregtech/loaders/postload/GT_MachineRecipeLoader.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java index c89ba0e6..a0811910 100644 --- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java @@ -491,8 +491,9 @@ if(Loader.isModLoaded("Railcraft")){ GT_Values.RA.addFormingPressRecipe(ItemList.Food_Dough_Sugar.get(4L, new Object[0]), ItemList.Shape_Mold_Cylinder.get(0L, new Object[0]), ItemList.Food_Raw_Cake.get(1L, new Object[0]), 384, 4); GT_Values.RA.addFormingPressRecipe(new ItemStack(Blocks.glass, 1, 32767), ItemList.Shape_Mold_Arrow.get(0L, new Object[0]), ItemList.Arrow_Head_Glass_Emtpy.get(1L, new Object[0]), 64, 4); + boolean useOnlyGoodSolderingMaterials = GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.harderrecipes, "useonlygoodsolderingmaterials", false); for (Materials tMat : Materials.values()) { - if ((tMat.mStandardMoltenFluid != null) && (tMat.contains(SubTag.SOLDERING_MATERIAL))) { + if (tMat.mStandardMoltenFluid != null && tMat.contains(SubTag.SOLDERING_MATERIAL) && !(useOnlyGoodSolderingMaterials && !tMat.contains(SubTag.SOLDERING_MATERIAL_GOOD))) { int tMultiplier = tMat.contains(SubTag.SOLDERING_MATERIAL_GOOD) ? 1 : tMat.contains(SubTag.SOLDERING_MATERIAL_BAD) ? 4 : 2; //Circuit soldering //Integraded Circuits From 556fa42c372c7be7c891c16cc6647c966ca23aaa Mon Sep 17 00:00:00 2001 From: Techlone Date: Sun, 12 Mar 2017 23:45:12 +0500 Subject: [PATCH 2/4] fix adv circuit --- src/main/java/gregtech/GT_Mod.java | 2 ++ src/main/java/gregtech/api/GregTech_API.java | 3 +++ .../gregtech/loaders/oreprocessing/ProcessingCircuit.java | 8 +------- .../gregtech/loaders/postload/GT_MachineRecipeLoader.java | 8 ++++++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 4ad00b4f..4a068f75 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -263,6 +263,8 @@ public class GT_Mod implements IGT_Mod { GregTech_API.mRFExplosions = GregTech_API.sOPStuff.get(ConfigCategories.general, "RFExplosions", false); GregTech_API.meIOLoaded = Loader.isModLoaded("EnderIO"); + GregTech_API.mUseOnlyGoodSolderingMaterials = GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.harderrecipes, "useonlygoodsolderingmaterials", GregTech_API.mUseOnlyGoodSolderingMaterials); + if (tMainConfig.get("general", "hardermobspawners", true).getBoolean(true)) { Blocks.mob_spawner.setHardness(500.0F).setResistance(6000000.0F); } diff --git a/src/main/java/gregtech/api/GregTech_API.java b/src/main/java/gregtech/api/GregTech_API.java index de21d02f..6318ff93 100644 --- a/src/main/java/gregtech/api/GregTech_API.java +++ b/src/main/java/gregtech/api/GregTech_API.java @@ -197,6 +197,9 @@ public class GregTech_API { public static boolean mMagneticraft = false; public static boolean mImmersiveEngineering = false; public static boolean mGTPlusPlus = false; + + public static boolean mUseOnlyGoodSolderingMaterials = false; + private static final String aTextIC2Lower = MOD_ID_IC2.toLowerCase(Locale.ENGLISH); /** * Getting assigned by the Mod loading diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingCircuit.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingCircuit.java index 63297c53..b006872c 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingCircuit.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingCircuit.java @@ -34,13 +34,7 @@ public class ProcessingCircuit implements gregtech.api.interfaces.IOreRecipeRegi GT_ModHandler.addShapelessCraftingRecipe(ItemList.Circuit_Basic.get(1L, new Object[0]), new Object[]{ItemList.Circuit_Integrated.getWildcard(1L, new Object[0])}); break; case "Advanced": - GT_ModHandler.removeRecipeByOutput(aStack); - GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Integrated_Good.get(2,new Object[0]),ItemList.Circuit_Chip_ILC.get(3,new Object[0]),ItemList.Circuit_Chip_Ram.get(1,new Object[0]),ItemList.Circuit_Parts_Transistor.get(4,new Object[0]),GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Electrum, 16)},Materials.SolderingAlloy.getMolten(72), aStack, 800, 28); - GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Integrated_Good.get(2,new Object[0]),ItemList.Circuit_Chip_ILC.get(3,new Object[0]),ItemList.Circuit_Chip_Ram.get(1,new Object[0]),ItemList.Circuit_Parts_TransistorSMD.get(4,new Object[0]),GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Electrum, 16)},Materials.SolderingAlloy.getMolten(72), aStack, 800, 28); - GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Integrated_Good.get(2,new Object[0]),ItemList.Circuit_Chip_ILC.get(3,new Object[0]),ItemList.Circuit_Chip_Ram.get(1,new Object[0]),ItemList.Circuit_Parts_Transistor.get(4,new Object[0]),GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Electrum, 16)},Materials.Tin.getMolten(144), aStack, 800, 28); - GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Integrated_Good.get(2,new Object[0]),ItemList.Circuit_Chip_ILC.get(3,new Object[0]),ItemList.Circuit_Chip_Ram.get(1,new Object[0]),ItemList.Circuit_Parts_TransistorSMD.get(4,new Object[0]),GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Electrum, 16)},Materials.Tin.getMolten(144), aStack, 800, 28); - GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Integrated_Good.get(2,new Object[0]),ItemList.Circuit_Chip_ILC.get(3,new Object[0]),ItemList.Circuit_Chip_Ram.get(1,new Object[0]),ItemList.Circuit_Parts_Transistor.get(4,new Object[0]),GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Electrum, 16)},Materials.Lead.getMolten(288), aStack, 800, 28); - GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Integrated_Good.get(2,new Object[0]),ItemList.Circuit_Chip_ILC.get(3,new Object[0]),ItemList.Circuit_Chip_Ram.get(1,new Object[0]),ItemList.Circuit_Parts_TransistorSMD.get(4,new Object[0]),GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Electrum, 16)},Materials.Lead.getMolten(288), aStack, 800, 28); + GT_ModHandler.removeRecipeByOutput(aStack); break; } } diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java index a0811910..ac37994c 100644 --- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java @@ -491,9 +491,8 @@ if(Loader.isModLoaded("Railcraft")){ GT_Values.RA.addFormingPressRecipe(ItemList.Food_Dough_Sugar.get(4L, new Object[0]), ItemList.Shape_Mold_Cylinder.get(0L, new Object[0]), ItemList.Food_Raw_Cake.get(1L, new Object[0]), 384, 4); GT_Values.RA.addFormingPressRecipe(new ItemStack(Blocks.glass, 1, 32767), ItemList.Shape_Mold_Arrow.get(0L, new Object[0]), ItemList.Arrow_Head_Glass_Emtpy.get(1L, new Object[0]), 64, 4); - boolean useOnlyGoodSolderingMaterials = GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.harderrecipes, "useonlygoodsolderingmaterials", false); for (Materials tMat : Materials.values()) { - if (tMat.mStandardMoltenFluid != null && tMat.contains(SubTag.SOLDERING_MATERIAL) && !(useOnlyGoodSolderingMaterials && !tMat.contains(SubTag.SOLDERING_MATERIAL_GOOD))) { + if (tMat.mStandardMoltenFluid != null && tMat.contains(SubTag.SOLDERING_MATERIAL) && !(GregTech_API.mUseOnlyGoodSolderingMaterials && !tMat.contains(SubTag.SOLDERING_MATERIAL_GOOD))) { int tMultiplier = tMat.contains(SubTag.SOLDERING_MATERIAL_GOOD) ? 1 : tMat.contains(SubTag.SOLDERING_MATERIAL_BAD) ? 4 : 2; //Circuit soldering //Integraded Circuits @@ -501,6 +500,11 @@ if(Loader.isModLoaded("Railcraft")){ GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Board_Phenolic.get(1,o),ItemList.Circuit_Chip_ILC.get(1,o),ItemList.Circuit_Parts_ResistorSMD.get(2,o),GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Copper, 4)},tMat.getMolten(144L * tMultiplier / 2L), ItemList.Circuit_Basic.get(1,o), 200, 8); GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Board_Phenolic.get(1,o),ItemList.Circuit_Chip_ILC.get(3,o),ItemList.Circuit_Parts_Resistor.get(4,o),GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Gold, 8)},tMat.getMolten(144L * tMultiplier / 2L), ItemList.Circuit_Integrated_Good.get(1,o), 400, 16); GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Board_Phenolic.get(1,o),ItemList.Circuit_Chip_ILC.get(3,o),ItemList.Circuit_Parts_ResistorSMD.get(4,o),GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Gold, 8)},tMat.getMolten(144L * tMultiplier / 2L), ItemList.Circuit_Integrated_Good.get(1,o), 400, 16); + + //Advanced circuit + GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Integrated_Good.get(2,new Object[0]),ItemList.Circuit_Chip_ILC.get(3,new Object[0]),ItemList.Circuit_Chip_Ram.get(1,new Object[0]),ItemList.Circuit_Parts_Transistor.get(4,new Object[0]),GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Electrum, 16)},tMat.getMolten(144L * tMultiplier / 2L), GT_ModHandler.getIC2Item("advancedCircuit", 1L), 800, 28); + GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Integrated_Good.get(2,new Object[0]),ItemList.Circuit_Chip_ILC.get(3,new Object[0]),ItemList.Circuit_Chip_Ram.get(1,new Object[0]),ItemList.Circuit_Parts_TransistorSMD.get(4,new Object[0]),GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.Electrum, 16)},tMat.getMolten(144L * tMultiplier / 2L), GT_ModHandler.getIC2Item("advancedCircuit", 1L), 800, 28); + //Highly Integrated Circuits GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Board_Epoxy.get(1,o),ItemList.Circuit_Chip_CPU.get(1,o),ItemList.Circuit_Parts_Resistor.get(4,o),ItemList.Circuit_Parts_Capacitor.get(4,o),ItemList.Circuit_Parts_Transistor.get(4,o),GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.RedAlloy, 4)},tMat.getMolten(144L * tMultiplier / 2L), ItemList.Circuit_Processor.get(1,o), 200, 60); GT_Values.RA.addCircuitAssemblerRecipe(new ItemStack[]{ItemList.Circuit_Board_Epoxy.get(1,o),ItemList.Circuit_Processor.get(3,o),ItemList.Circuit_Parts_Coil.get(4,o),ItemList.Circuit_Parts_Capacitor.get(4,o),ItemList.Circuit_Chip_Ram.get(4,o),GT_OreDictUnificator.get(OrePrefixes.wireFine, Materials.RedAlloy, 12)},tMat.getMolten(144L * tMultiplier), ItemList.Circuit_Computer.get(1,o), 400, 90); From 76e82ed3553cedb2c9ebef4cf033472925e4caf1 Mon Sep 17 00:00:00 2001 From: Dimach Date: Wed, 15 Mar 2017 04:51:15 +0200 Subject: [PATCH 3/4] Implement #292. --- .../common/gui/GT_Container_Regulator.java | 16 +++++---- .../GT_MetaTileEntity_Regulator.java | 34 ++++++++++++++++-- .../gregtech/textures/gui/Regulator.png | Bin 4041 -> 1986 bytes 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/main/java/gregtech/common/gui/GT_Container_Regulator.java b/src/main/java/gregtech/common/gui/GT_Container_Regulator.java index 3e8f9402..c9e51ecb 100644 --- a/src/main/java/gregtech/common/gui/GT_Container_Regulator.java +++ b/src/main/java/gregtech/common/gui/GT_Container_Regulator.java @@ -36,6 +36,8 @@ public class GT_Container_Regulator addSlotToContainer(new Slot(this.mTileEntity, 7, 26, 42)); addSlotToContainer(new Slot(this.mTileEntity, 8, 44, 42)); + addSlotToContainer(new Slot(this.mTileEntity, 19, 44, 63)); + addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 9, 64, 7, false, true, 1)); addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 10, 81, 7, false, true, 1)); addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 11, 98, 7, false, true, 1)); @@ -60,7 +62,7 @@ public class GT_Container_Regulator } public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - if (aSlotIndex < 9) { + if (aSlotIndex < 10) { return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); @@ -68,7 +70,7 @@ public class GT_Container_Regulator if (this.mTileEntity.getMetaTileEntity() == null) { return null; } - if (aSlotIndex == 27) { + if (aSlotIndex == 28) { ((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).bOutput = (!((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).bOutput); if (((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).bOutput) { GT_Utility.sendChatToPlayer(aPlayer, "Emit Energy to Outputside"); @@ -77,7 +79,7 @@ public class GT_Container_Regulator } return null; } - if ((aSlotIndex < 18)) { + if ((aSlotIndex < 19)) { ItemStack tStack = aPlayer.inventory.getItemStack(); if (tStack != null) { tSlot.putStack(GT_Utility.copy(new Object[]{tStack})); @@ -96,8 +98,8 @@ public class GT_Container_Regulator } return null; } - if ((aSlotIndex < 27)) { - ((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).mTargetSlots[(aSlotIndex - 18)] = Math.min(99, Math.max(0, ((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).mTargetSlots[(aSlotIndex - 18)] + (aMouseclick == 0 ? -1 : 1) * (aShifthold == 0 ? 1 : 16))); + if ((aSlotIndex < 28)) { + ((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).mTargetSlots[(aSlotIndex - 19)] = Math.min(99, Math.max(0, ((GT_MetaTileEntity_Regulator) this.mTileEntity.getMetaTileEntity()).mTargetSlots[(aSlotIndex - 19)] + (aMouseclick == 0 ? -1 : 1) * (aShifthold == 0 ? 1 : 16))); return null; } } @@ -156,10 +158,10 @@ public class GT_Container_Regulator } public int getSlotCount() { - return 9; + return 10; } public int getShiftClickSlotCount() { - return 9; + return 10; } } diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java index 3a89b8c8..04930ae5 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java @@ -18,9 +18,10 @@ import java.util.Arrays; public class GT_MetaTileEntity_Regulator extends GT_MetaTileEntity_Buffer { public int[] mTargetSlots = {0, 0, 0, 0, 0, 0, 0, 0, 0}; + private boolean charge = false, decharge = false; public GT_MetaTileEntity_Regulator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 19, "Regulating incoming Items"); + super(aID, aName, aNameRegional, aTier, 20, "Regulating incoming Items"); } public GT_MetaTileEntity_Regulator(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { @@ -36,7 +37,7 @@ public class GT_MetaTileEntity_Regulator } public boolean isValidSlot(int aIndex) { - return aIndex < 9; + return aIndex < 9 || aIndex == 19; } public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { @@ -90,4 +91,33 @@ public class GT_MetaTileEntity_Regulator public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (GT_Utility.areStacksEqual(aStack, this.mInventory[(aIndex + 9)])); } + + @Override + public int rechargerSlotStartIndex() { + return 19; + } + + @Override + public int dechargerSlotStartIndex() { + return 19; + } + + @Override + public int rechargerSlotCount() { + return charge ? 1 : 0; + } + + @Override + public int dechargerSlotCount() { + return decharge ? 1 : 0; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if (aBaseMetaTileEntity.isServerSide()) { + charge = aBaseMetaTileEntity.getStoredEU() / 2 > aBaseMetaTileEntity.getEUCapacity() / 3; + decharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3; + } + } } diff --git a/src/main/resources/assets/gregtech/textures/gui/Regulator.png b/src/main/resources/assets/gregtech/textures/gui/Regulator.png index b92a693f13614b463bdde133791a2192f48cc64b..ecc62186e0ea016246043f88bc448226e97e0741 100644 GIT binary patch literal 1986 zcmb7Ec~sL^7Jk13vO#J@B#12O0L6tN&`=DTl1Pa_D*=lwC{h$ONKtl>wn75b1uKaT zc5n-0n0crxZHCE|vB;<-*Y z8WN&=YM*hvgjE+yUI}AMB4bv}t+J^h>12Q{N(Q+^BJn4dM5D=W)=+9x`*%461qDs3 z@tb+FX??P)7+QzietPk!tC|uyPWH*IIsm5oCni!CkQIU|&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z3}%QJCPia$U06NxK(qOxWz`=1}|{@7VtVAD(ft From 288f44e347097c75933909d5155d47fb66d4c8f6 Mon Sep 17 00:00:00 2001 From: Techlone Date: Thu, 16 Mar 2017 00:24:41 +0500 Subject: [PATCH 4/4] Added a sorting of recipes in NEI --- .../java/gregtech/api/util/GT_Recipe.java | 24 +++++++++++++++++-- .../gregtech/nei/GT_NEI_DefaultHandler.java | 15 ++++++++---- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index d509e6af..30874b28 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -33,7 +33,7 @@ import static gregtech.api.enums.GT_Values.*; *

* I know this File causes some Errors, because of missing Main Functions, but if you just need to compile Stuff, then remove said erroreous Functions. */ -public class GT_Recipe { +public class GT_Recipe implements Comparable { public static volatile int VERSION = 509; /** * If you want to change the Output, feel free to modify or even replace the whole ItemStack Array, for Inputs, please add a new Recipe, because of the HashMaps. @@ -412,7 +412,27 @@ public class GT_Recipe { return true; } - + @Override + public int compareTo(GT_Recipe recipe) { + // first lowest tier recipes + // then fastest + // then with lowest special value + // then dry recipes + // then with fewer inputs + if (this.mEUt != recipe.mEUt) { + return this.mEUt - recipe.mEUt; + } else if (this.mDuration != recipe.mDuration) { + return this.mDuration - recipe.mDuration; + } else if (this.mSpecialValue != recipe.mSpecialValue) { + return this.mSpecialValue - recipe.mSpecialValue; + } else if (this.mFluidInputs.length != recipe.mFluidInputs.length) { + return this.mFluidInputs.length - recipe.mFluidInputs.length; + } else if (this.mInputs.length != recipe.mInputs.length) { + return this.mInputs.length - recipe.mInputs.length; + } + return 0; + } + public static class GT_Recipe_AssemblyLine{ public static final ArrayList sAssemblylineRecipes = new ArrayList(); diff --git a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java index 247a7df4..71e458c6 100644 --- a/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java +++ b/src/main/java/gregtech/nei/GT_NEI_DefaultHandler.java @@ -29,8 +29,7 @@ import net.minecraftforge.fluids.FluidStack; import org.lwjgl.opengl.GL11; import java.awt.*; -import java.util.ArrayList; -import java.util.Iterator; +import java.util.*; import java.util.List; public class GT_NEI_DefaultHandler @@ -55,6 +54,12 @@ public class GT_NEI_DefaultHandler } } + public List getSortedRecipes() { + List result = new ArrayList<>(this.mRecipeMap.mRecipeList); + Collections.sort(result); + return result; + } + public static void drawText(int aX, int aY, String aString, int aColor) { Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); } @@ -65,7 +70,7 @@ public class GT_NEI_DefaultHandler public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equals(getOverlayIdentifier())) { - for (GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { + for (GT_Recipe tRecipe : getSortedRecipes()) { if (!tRecipe.mHidden) { this.arecipes.add(new CachedDefaultRecipe(tRecipe)); } @@ -95,7 +100,7 @@ public class GT_NEI_DefaultHandler } } } - for (GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { + for (GT_Recipe tRecipe : getSortedRecipes()) { if (!tRecipe.mHidden) { CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); for (ItemStack tStack : tResults) { @@ -129,7 +134,7 @@ public class GT_NEI_DefaultHandler } } } - for (GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) { + for (GT_Recipe tRecipe : getSortedRecipes()) { if (!tRecipe.mHidden) { CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); for (ItemStack tStack : tInputs) {