From 2de6e3eadb6ab57736c51ed72d1617cff11d05f1 Mon Sep 17 00:00:00 2001 From: Technus Date: Tue, 22 Nov 2016 19:05:12 +0100 Subject: [PATCH] Stuff --- .../java/gregtech/api/util/GT_Recipe.java | 16 +++++++-- .../java/gregtech/api/util/GT_Utility.java | 2 ++ src/main/java/gregtech/common/GT_Client.java | 3 ++ .../java/gregtech/common/GT_RecipeAdder.java | 2 +- .../gregtech/nei/GT_NEI_AssLineHandler.java | 33 +++++++++++-------- src/main/java/gregtech/nei/NEI_GT_Config.java | 3 +- 6 files changed, 40 insertions(+), 19 deletions(-) diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java index 51307813..6367cd07 100644 --- a/src/main/java/gregtech/api/util/GT_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Recipe.java @@ -466,9 +466,8 @@ public class GT_Recipe { public static final GT_Recipe_Map sRockBreakerFakeRecipes = new GT_Recipe_Map(new HashSet(3), "gt.recipe.rockbreaker", "Rock Breaker", null, RES_PATH_GUI + "basicmachines/RockBreaker", 1, 1, 0, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sByProductList = new GT_Recipe_Map(new HashSet(1000), "gt.recipe.byproductlist", "Ore Byproduct List", null, RES_PATH_GUI + "basicmachines/Default", 1, 6, 1, 0, 1, E, 1, E, true, true); public static final GT_Recipe_Map sRepicatorFakeRecipes = new GT_Recipe_Map(new HashSet(100), "gt.recipe.replicator", "Replicator", null, RES_PATH_GUI + "basicmachines/Replicator", 0, 1, 0, 1, 1, E, 1, E, true, true); - public static final GT_Recipe_Map sAssemblylineFakeRecipes = new GT_Recipe_Map(new HashSet(30), "gt.recipe.fakeAssemblylineProcess", "Assemblyline Process", null, RES_PATH_GUI + "FakeAssemblyline", 1, 1, 1, 0, 1, E, 1, E, true, false);//Just a common list - public static final GT_Recipe_Map sAssemblylineUnlockedRecipes = new GT_Recipe_Map(new HashSet(30), "gt.recipe.unlockedAssemblylineProcess", "Assemblyline Process", null, RES_PATH_GUI + "FakeAssemblyline", 1, 1, 1, 0, 1, E, 1, E, true, true);//will content add in achievements - + public static final GT_Recipe_Map sAssemblylineFakeRecipes = new GT_Recipe_Map(new HashSet(30), "gt.recipe.fakeAssemblylineProcess", "Assemblyline Process", null, RES_PATH_GUI + "FakeAssemblyline", 1, 1, 1, 0, 1, E, 1, E, true, true); + public static final GT_Recipe_Map sPlasmaArcFurnaceRecipes = new GT_Recipe_Map(new HashSet(10000), "gt.recipe.plasmaarcfurnace", "Plasma Arc Furnace", null, RES_PATH_GUI + "basicmachines/PlasmaArcFurnace", 1, 4, 1, 1, 1, E, 1, E, true, true); public static final GT_Recipe_Map sArcFurnaceRecipes = new GT_Recipe_Map(new HashSet(10000), "gt.recipe.arcfurnace", "Arc Furnace", null, RES_PATH_GUI + "basicmachines/ArcFurnace", 1, 4, 1, 1, 3, E, 1, E, true, true); public static final GT_Recipe_Map sPrinterRecipes = new GT_Recipe_Map_Printer(new HashSet(100), "gt.recipe.printer", "Printer", null, RES_PATH_GUI + "basicmachines/Printer", 1, 1, 1, 1, 1, E, 1, E, true, true); @@ -625,6 +624,9 @@ public class GT_Recipe { public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue) { return addFakeRecipe(aCheckForCollisions, new GT_Recipe(false, aInputs, aOutputs, aSpecial, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue)); } + public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue,boolean hidden) { + return addFakeRecipe(aCheckForCollisions, new GT_Recipe(false, aInputs, aOutputs, aSpecial, null, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSpecialValue),hidden); + } /** * Only used for fake Recipe Handlers to show something in NEI, do not use this for adding actual Recipes! findRecipe wont find fake Recipes, containsInput WILL find fake Recipes @@ -632,6 +634,9 @@ public class GT_Recipe { public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, GT_Recipe aRecipe) { return addRecipe(aRecipe, aCheckForCollisions, true, false); } + public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, GT_Recipe aRecipe,boolean hidden) { + return addRecipe(aRecipe, aCheckForCollisions, true, hidden); + } public GT_Recipe add(GT_Recipe aRecipe) { mRecipeList.add(aRecipe); @@ -816,6 +821,11 @@ public class GT_Recipe { return null; } + @Override + public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecial, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue,boolean hidden) { + return null; + } + @Override public GT_Recipe addFakeRecipe(boolean aCheckForCollisions, GT_Recipe aRecipe) { return null; diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 5b065a4b..575f5beb 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -21,6 +21,8 @@ import gregtech.api.objects.ItemData; import gregtech.api.objects.XSTR; import gregtech.api.threads.GT_Runnable_Sound; import gregtech.common.GT_Proxy; +import gregtech.nei.GT_NEI_AssLineHandler; +import gregtech.nei.NEI_GT_Config; import ic2.api.recipe.IRecipeInput; import ic2.api.recipe.RecipeInputItemStack; import ic2.api.recipe.RecipeInputOreDict; diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java index 33222c03..fe2d3c71 100644 --- a/src/main/java/gregtech/common/GT_Client.java +++ b/src/main/java/gregtech/common/GT_Client.java @@ -7,6 +7,7 @@ package gregtech.common; import codechicken.lib.vec.Rotation; import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent; import gregtech.GT_Mod; @@ -20,10 +21,12 @@ import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.objects.GT_FluidStack; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_PlayedSound; +import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.common.entities.GT_Entity_Arrow; import gregtech.common.entities.GT_Entity_Arrow_Potion; import gregtech.common.render.*; +import gregtech.nei.NEI_GT_Config; import ic2.api.tile.IWrenchable; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; diff --git a/src/main/java/gregtech/common/GT_RecipeAdder.java b/src/main/java/gregtech/common/GT_RecipeAdder.java index d9558bce..e8dfc461 100644 --- a/src/main/java/gregtech/common/GT_RecipeAdder.java +++ b/src/main/java/gregtech/common/GT_RecipeAdder.java @@ -836,7 +836,7 @@ public class GT_RecipeAdder implements IGT_RecipeAdder { if(tItem==null)System.out.println("addAssemblylineRecipe"+aResearchItem.getDisplayName()); } GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Research result", new Object[0])}, null, null, aResearchTime, 30, 0); - GT_Recipe.GT_Recipe_Map.sAssemblylineFakeRecipes.addFakeRecipe(false, aInputs, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Research result", new Object[0])}, aFluidInputs, null, aDuration, aEUt, 0); + GT_Recipe.GT_Recipe_Map.sAssemblylineFakeRecipes.addFakeRecipe(false, aInputs, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Research result", new Object[0])}, aFluidInputs, null, aDuration, aEUt, 0,true); GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(new GT_Recipe_AssemblyLine( aResearchItem, aResearchTime, aInputs, aFluidInputs, aOutput, aDuration, aEUt)); return true; } diff --git a/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java b/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java index 6edda76f..227ce05d 100644 --- a/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java +++ b/src/main/java/gregtech/nei/GT_NEI_AssLineHandler.java @@ -58,7 +58,8 @@ public class GT_NEI_AssLineHandler } public TemplateRecipeHandler newInstance() { - return new GT_NEI_AssLineHandler(this.mRecipeMap); + NEI_GT_Config.ALH=new GT_NEI_AssLineHandler(this.mRecipeMap); + return NEI_GT_Config.ALH; } public void loadCraftingRecipes(String outputId, Object... results) { @@ -73,6 +74,10 @@ public class GT_NEI_AssLineHandler } } + public void clearRecipes(){ + this.arecipes.clear(); + } + public void loadCraftingRecipes(ItemStack aResult) { ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); @@ -215,14 +220,14 @@ public class GT_NEI_AssLineHandler public static class GT_RectHandler implements IContainerInputHandler, IContainerTooltipHandler { public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) { - if (canHandle(gui)) { - if (button == 0) { - return transferRect(gui, false); - } - if (button == 1) { - return transferRect(gui, true); - } - } + //if (canHandle(gui)) { + // if (button == 0) { + // return transferRect(gui, false); + // } + // if (button == 1) { + // return transferRect(gui, true); + // } + //} return false; } @@ -236,11 +241,11 @@ public class GT_NEI_AssLineHandler } public List handleTooltip(GuiContainer gui, int mousex, int mousey, List currenttip) { - if ((canHandle(gui)) && (currenttip.isEmpty())) { - if (new Rectangle(138, 18, 18, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { - currenttip.add("Recipes"); - } - } + //if ((canHandle(gui)) && (currenttip.isEmpty())) { + // if (new Rectangle(138, 18, 18, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { + // currenttip.add("Recipes"); + // } + //} return currenttip; } diff --git a/src/main/java/gregtech/nei/NEI_GT_Config.java b/src/main/java/gregtech/nei/NEI_GT_Config.java index ac496b4d..4f72d406 100644 --- a/src/main/java/gregtech/nei/NEI_GT_Config.java +++ b/src/main/java/gregtech/nei/NEI_GT_Config.java @@ -8,6 +8,7 @@ import gregtech.api.util.GT_Utility; public class NEI_GT_Config implements IConfigureNEI { public static boolean sIsAdded = true; + public static GT_NEI_AssLineHandler ALH; public void loadConfig() { sIsAdded = false; @@ -17,7 +18,7 @@ public class NEI_GT_Config } } if(FMLCommonHandler.instance().getEffectiveSide().isClient()) - new GT_NEI_AssLineHandler(GT_Recipe.GT_Recipe_Map.sAssemblylineFakeRecipes); + ALH=new GT_NEI_AssLineHandler(GT_Recipe.GT_Recipe_Map.sAssemblylineFakeRecipes); sIsAdded = true; }