diff options
author | Jakub <53441451+kuba6000@users.noreply.github.com> | 2022-08-29 16:04:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-29 16:04:28 +0200 |
commit | 7d1f51a8937e0a86486267437d444696e81e8aa0 (patch) | |
tree | a5b145e7271998f7b4b968a2212ed487e54a92b5 /src/main/java/gtPlusPlus/nei | |
parent | 5267969156d30b4bb5f4cb2279ebb49db6bd40e2 (diff) | |
download | GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.gz GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.bz2 GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.zip |
Buildscript + Spotless (#318)
* Convert AES.java to readable class
* Buildscript
* Spotless
Diffstat (limited to 'src/main/java/gtPlusPlus/nei')
11 files changed, 1015 insertions, 912 deletions
diff --git a/src/main/java/gtPlusPlus/nei/DecayableRecipeHandler.java b/src/main/java/gtPlusPlus/nei/DecayableRecipeHandler.java index 04d1a201a5..e84b7a1d03 100644 --- a/src/main/java/gtPlusPlus/nei/DecayableRecipeHandler.java +++ b/src/main/java/gtPlusPlus/nei/DecayableRecipeHandler.java @@ -1,10 +1,5 @@ package gtPlusPlus.nei; -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; @@ -16,6 +11,10 @@ import gtPlusPlus.core.item.materials.DustDecayable; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.VanillaColours; import gtPlusPlus.nei.handlers.NeiTextureHandler; +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -23,242 +22,238 @@ import net.minecraft.util.StatCollector; public class DecayableRecipeHandler extends TemplateRecipeHandler { - public static final String mNEIName = "Decayables"; - - public String getRecipeName() { - return StatCollector.translateToLocal("GTPP.container.decaychest.name"); - } - - public String getGuiTexture() { - return CORE.MODID + ":textures/gui/nei/decayables.png"; - } - - public Class<? extends GuiContainer> getGuiClass() { - return GUI_DecayablesChest.class; - } - - public String getOverlayIdentifier() { - return "GTPP_Decayables"; - } - - public int recipiesPerPage() { - return 1; - } - - public void loadTransferRects() { - this.transferRects.add(new RecipeTransferRect(new Rectangle(6, 3, 16, 16), getOverlayIdentifier(), new Object[0])); - } - - public void loadCraftingRecipes(ItemStack result) { - if (result == null || (!DustDecayable.class.isInstance(result.getItem()) - && !BaseItemDustUnique.class.isInstance(result.getItem()))) { - return; - } - if (result != null) { - //Logger.INFO("Looking up crafting recipes for "+ItemUtils.getItemName(result)); - } - final List<DecayableRecipe> recipes = DecayableRecipe.mRecipes; - for (final DecayableRecipe recipe : recipes) { - if (recipe.isValid()) { - final ItemStack input = recipe.mInput.copy(); - final ItemStack output = recipe.mOutput.copy(); - if (!GT_Utility.areStacksEqual(result, output, true)) { - continue; - } - //Logger.INFO("Showing Usage result for "+ItemUtils.getItemName(result)); - final DecayableRecipeNEI rec = new DecayableRecipeNEI(input, output, recipe.mTime); - this.arecipes.add(rec); - sort(); - } - } - } - - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals(getOverlayIdentifier()) && this.getClass() == DecayableRecipeHandler.class) { - final List<DecayableRecipe> recipes = DecayableRecipe.mRecipes; - for (final DecayableRecipe recipe : recipes) { - if (recipe.isValid()) { - final ItemStack input = recipe.mInput.copy(); - final ItemStack output = recipe.mOutput.copy(); - final DecayableRecipeNEI rec = new DecayableRecipeNEI(input, output, recipe.mTime); - this.arecipes.add(rec); - sort(); - } - } - } else { - super.loadCraftingRecipes(outputId, results); - } - } - - public void loadUsageRecipes(ItemStack ingredient) { - final List<DecayableRecipe> recipes = DecayableRecipe.mRecipes; - if (ingredient != null) { - //Logger.INFO("Looking up Usage results for "+ItemUtils.getItemName(ingredient)); - } - for (final DecayableRecipe recipe : recipes) { - if (recipe.isValid()) { - final ItemStack input = recipe.mInput.copy(); - final ItemStack output = recipe.mOutput.copy(); - if (!GT_Utility.areStacksEqual(ingredient, input, true)) { - continue; - } - //Logger.INFO("Showing up Usage results for "+ItemUtils.getItemName(ingredient)); - final DecayableRecipeNEI rec = new DecayableRecipeNEI(input, output, recipe.mTime); - //rec.setIngredientPermutation((Collection) rec.input, ingredient); - this.arecipes.add(rec); - sort(); - } - } - } - - private final void sort() { - List<DecayableRecipeNEI> g = new ArrayList<DecayableRecipeNEI>(); - for (CachedRecipe u : arecipes) { - g.add((DecayableRecipeNEI) u); - } - if (g != null && !g.isEmpty()) { - Collections.sort(g); - } - } - - public void drawExtras(int recipeIndex) { - DecayableRecipeNEI recipe = (DecayableRecipeNEI) this.arecipes.get(recipeIndex); - - //GuiDraw.drawStringC(I18n.format("GTPP.container.decaychest.result", new Object[]{}), 43, 10, 8421504, false); - - int cost = recipe.time; - if (cost > 0) { - - // NEI Strings - String s = I18n.format("GTPP.nei.info", new Object[] { cost }); - String s0 = I18n.format("GTPP.nei.timetaken", new Object[] { cost }); - - // Time Strings - String s1 = I18n.format("GTPP.time.ticks", new Object[] { cost }); - String s2 = I18n.format("GTPP.time.seconds", new Object[] { cost }); - String s3 = I18n.format("GTPP.time.minutes", new Object[] { cost }); - String s4 = I18n.format("GTPP.time.hours", new Object[] { cost }); - String s5 = I18n.format("GTPP.time.days", new Object[] { cost }); - String s6 = I18n.format("GTPP.time.months", new Object[] { cost }); - int y = 20; - - int secs = cost / 20; - int mins = secs / 60; - int hours = mins / 60; - int days = hours / 24; - int months = days / 30; - - String suffix; - int formattedTime; - if (cost <= 20) { - suffix = s1; - formattedTime = cost; - } else if (cost <= (20 * 60)) { - suffix = s2; - formattedTime = secs; - } else if (cost <= (20 * 60 * 60)) { - suffix = s3; - formattedTime = mins; - } else if (cost <= (20 * 60 * 60 * 24)) { - suffix = s4; - formattedTime = hours; - } else if (cost < (20 * 60 * 60 * 24 * 30)) { - suffix = s5; - formattedTime = days; - } else if (cost <= (20 * 60 * 60 * 24 * 30)) { - suffix = s6; - formattedTime = months; - } else { - suffix = s1; - formattedTime = cost; - } - - int x = 5; - GuiDraw.drawString(s, x, 25, VanillaColours.DYE_BLACK.getAsInt(), false); - GuiDraw.drawString(s0, x, 40, VanillaColours.DYE_BLACK.getAsInt(), false); - - GuiDraw.drawString(suffix, x + 16, y + 30, VanillaColours.DYE_BLACK.getAsInt(), false); - - //Values - GuiDraw.drawString(("" + formattedTime), x, y + 30, VanillaColours.DYE_GREEN.getAsInt(), false); - - if (hours > 1) { - int aLeftoverMinutes = (cost - (hours * (20 * 60 * 60))); - if (aLeftoverMinutes > 0) { - int secs2 = aLeftoverMinutes / 20; - int mins2 = secs2 / 60; - GuiDraw.drawString(s3, x + 16, y + 42, VanillaColours.DYE_BLACK.getAsInt(), false); - GuiDraw.drawString(("" + mins2), x, y + 42, VanillaColours.DYE_GREEN.getAsInt(), false); - - } - - } - - } - - NeiTextureHandler.RECIPE_BUTTON.renderIcon(6.0D, 3.0D, 16.0D, 16.0D, 0.0D, true); - } - - public class DecayableRecipeNEI extends TemplateRecipeHandler.CachedRecipe implements Comparable<CachedRecipe> { - private PositionedStack input; - private PositionedStack output; - public int time; - - @Override - public PositionedStack getIngredient() { - return this.input; - } - - public PositionedStack getResult() { - return this.output; - } - - public DecayableRecipeNEI(final ItemStack input, final ItemStack result, final int time) { - super(); - this.input = new PositionedStack(input, 93, 24); - this.output = new PositionedStack(result, 142, 42); - this.time = time; - } - - @Override - public int compareTo(CachedRecipe o) { - boolean b = DecayableRecipeNEI.class.isInstance(o); - if (b) { - DecayableRecipeNEI p = (DecayableRecipeNEI) o; - if (p.time > this.time) { - return 1; - } else if (p.time == this.time) { - return 0; - } else { - return -1; - } - } - return 0; - } - - @Override - public boolean equals(Object obj) { - if (obj != null) { - if (DecayableRecipeNEI.class.isInstance(obj)) { - DecayableRecipeNEI p = (DecayableRecipeNEI) obj; - if (p != null) { - // Time check first to keep it simple and not unbox the Recipes. - if (p.time == this.time) { - ItemStack aInput = p.input.item; - ItemStack aOutput = p.output.item; - if (GT_Utility.areStacksEqual(aInput, this.input.item, true)) { - if (GT_Utility.areStacksEqual(aOutput, this.output.item, true)) { - return true; - } - } - } - } - - } - } - return false; - } - - - } -}
\ No newline at end of file + public static final String mNEIName = "Decayables"; + + public String getRecipeName() { + return StatCollector.translateToLocal("GTPP.container.decaychest.name"); + } + + public String getGuiTexture() { + return CORE.MODID + ":textures/gui/nei/decayables.png"; + } + + public Class<? extends GuiContainer> getGuiClass() { + return GUI_DecayablesChest.class; + } + + public String getOverlayIdentifier() { + return "GTPP_Decayables"; + } + + public int recipiesPerPage() { + return 1; + } + + public void loadTransferRects() { + this.transferRects.add( + new RecipeTransferRect(new Rectangle(6, 3, 16, 16), getOverlayIdentifier(), new Object[0])); + } + + public void loadCraftingRecipes(ItemStack result) { + if (result == null + || (!DustDecayable.class.isInstance(result.getItem()) + && !BaseItemDustUnique.class.isInstance(result.getItem()))) { + return; + } + if (result != null) { + // Logger.INFO("Looking up crafting recipes for "+ItemUtils.getItemName(result)); + } + final List<DecayableRecipe> recipes = DecayableRecipe.mRecipes; + for (final DecayableRecipe recipe : recipes) { + if (recipe.isValid()) { + final ItemStack input = recipe.mInput.copy(); + final ItemStack output = recipe.mOutput.copy(); + if (!GT_Utility.areStacksEqual(result, output, true)) { + continue; + } + // Logger.INFO("Showing Usage result for "+ItemUtils.getItemName(result)); + final DecayableRecipeNEI rec = new DecayableRecipeNEI(input, output, recipe.mTime); + this.arecipes.add(rec); + sort(); + } + } + } + + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOverlayIdentifier()) && this.getClass() == DecayableRecipeHandler.class) { + final List<DecayableRecipe> recipes = DecayableRecipe.mRecipes; + for (final DecayableRecipe recipe : recipes) { + if (recipe.isValid()) { + final ItemStack input = recipe.mInput.copy(); + final ItemStack output = recipe.mOutput.copy(); + final DecayableRecipeNEI rec = new DecayableRecipeNEI(input, output, recipe.mTime); + this.arecipes.add(rec); + sort(); + } + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + public void loadUsageRecipes(ItemStack ingredient) { + final List<DecayableRecipe> recipes = DecayableRecipe.mRecipes; + if (ingredient != null) { + // Logger.INFO("Looking up Usage results for "+ItemUtils.getItemName(ingredient)); + } + for (final DecayableRecipe recipe : recipes) { + if (recipe.isValid()) { + final ItemStack input = recipe.mInput.copy(); + final ItemStack output = recipe.mOutput.copy(); + if (!GT_Utility.areStacksEqual(ingredient, input, true)) { + continue; + } + // Logger.INFO("Showing up Usage results for "+ItemUtils.getItemName(ingredient)); + final DecayableRecipeNEI rec = new DecayableRecipeNEI(input, output, recipe.mTime); + // rec.setIngredientPermutation((Collection) rec.input, ingredient); + this.arecipes.add(rec); + sort(); + } + } + } + + private final void sort() { + List<DecayableRecipeNEI> g = new ArrayList<DecayableRecipeNEI>(); + for (CachedRecipe u : arecipes) { + g.add((DecayableRecipeNEI) u); + } + if (g != null && !g.isEmpty()) { + Collections.sort(g); + } + } + + public void drawExtras(int recipeIndex) { + DecayableRecipeNEI recipe = (DecayableRecipeNEI) this.arecipes.get(recipeIndex); + + // GuiDraw.drawStringC(I18n.format("GTPP.container.decaychest.result", new Object[]{}), 43, 10, 8421504, false); + + int cost = recipe.time; + if (cost > 0) { + + // NEI Strings + String s = I18n.format("GTPP.nei.info", new Object[] {cost}); + String s0 = I18n.format("GTPP.nei.timetaken", new Object[] {cost}); + + // Time Strings + String s1 = I18n.format("GTPP.time.ticks", new Object[] {cost}); + String s2 = I18n.format("GTPP.time.seconds", new Object[] {cost}); + String s3 = I18n.format("GTPP.time.minutes", new Object[] {cost}); + String s4 = I18n.format("GTPP.time.hours", new Object[] {cost}); + String s5 = I18n.format("GTPP.time.days", new Object[] {cost}); + String s6 = I18n.format("GTPP.time.months", new Object[] {cost}); + int y = 20; + + int secs = cost / 20; + int mins = secs / 60; + int hours = mins / 60; + int days = hours / 24; + int months = days / 30; + + String suffix; + int formattedTime; + if (cost <= 20) { + suffix = s1; + formattedTime = cost; + } else if (cost <= (20 * 60)) { + suffix = s2; + formattedTime = secs; + } else if (cost <= (20 * 60 * 60)) { + suffix = s3; + formattedTime = mins; + } else if (cost <= (20 * 60 * 60 * 24)) { + suffix = s4; + formattedTime = hours; + } else if (cost < (20 * 60 * 60 * 24 * 30)) { + suffix = s5; + formattedTime = days; + } else if (cost <= (20 * 60 * 60 * 24 * 30)) { + suffix = s6; + formattedTime = months; + } else { + suffix = s1; + formattedTime = cost; + } + + int x = 5; + GuiDraw.drawString(s, x, 25, VanillaColours.DYE_BLACK.getAsInt(), false); + GuiDraw.drawString(s0, x, 40, VanillaColours.DYE_BLACK.getAsInt(), false); + + GuiDraw.drawString(suffix, x + 16, y + 30, VanillaColours.DYE_BLACK.getAsInt(), false); + + // Values + GuiDraw.drawString(("" + formattedTime), x, y + 30, VanillaColours.DYE_GREEN.getAsInt(), false); + + if (hours > 1) { + int aLeftoverMinutes = (cost - (hours * (20 * 60 * 60))); + if (aLeftoverMinutes > 0) { + int secs2 = aLeftoverMinutes / 20; + int mins2 = secs2 / 60; + GuiDraw.drawString(s3, x + 16, y + 42, VanillaColours.DYE_BLACK.getAsInt(), false); + GuiDraw.drawString(("" + mins2), x, y + 42, VanillaColours.DYE_GREEN.getAsInt(), false); + } + } + } + + NeiTextureHandler.RECIPE_BUTTON.renderIcon(6.0D, 3.0D, 16.0D, 16.0D, 0.0D, true); + } + + public class DecayableRecipeNEI extends TemplateRecipeHandler.CachedRecipe implements Comparable<CachedRecipe> { + private PositionedStack input; + private PositionedStack output; + public int time; + + @Override + public PositionedStack getIngredient() { + return this.input; + } + + public PositionedStack getResult() { + return this.output; + } + + public DecayableRecipeNEI(final ItemStack input, final ItemStack result, final int time) { + super(); + this.input = new PositionedStack(input, 93, 24); + this.output = new PositionedStack(result, 142, 42); + this.time = time; + } + + @Override + public int compareTo(CachedRecipe o) { + boolean b = DecayableRecipeNEI.class.isInstance(o); + if (b) { + DecayableRecipeNEI p = (DecayableRecipeNEI) o; + if (p.time > this.time) { + return 1; + } else if (p.time == this.time) { + return 0; + } else { + return -1; + } + } + return 0; + } + + @Override + public boolean equals(Object obj) { + if (obj != null) { + if (DecayableRecipeNEI.class.isInstance(obj)) { + DecayableRecipeNEI p = (DecayableRecipeNEI) obj; + if (p != null) { + // Time check first to keep it simple and not unbox the Recipes. + if (p.time == this.time) { + ItemStack aInput = p.input.item; + ItemStack aOutput = p.output.item; + if (GT_Utility.areStacksEqual(aInput, this.input.item, true)) { + if (GT_Utility.areStacksEqual(aOutput, this.output.item, true)) { + return true; + } + } + } + } + } + } + return false; + } + } +} diff --git a/src/main/java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java b/src/main/java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java index 27dce789ae..f080a0bf44 100644 --- a/src/main/java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java +++ b/src/main/java/gtPlusPlus/nei/GTPP_NEI_DefaultHandler.java @@ -1,57 +1,61 @@ package gtPlusPlus.nei; -import java.util.*; - -import gregtech.nei.GT_NEI_DefaultHandler; -import gtPlusPlus.core.util.minecraft.ItemUtils; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.*; import cpw.mods.fml.common.event.FMLInterModComms; import gregtech.api.enums.GT_Values; import gregtech.api.util.*; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.nei.GT_NEI_DefaultHandler; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import java.util.*; import net.minecraft.item.ItemStack; public class GTPP_NEI_DefaultHandler extends GT_NEI_DefaultHandler { - public GTPP_NEI_DefaultHandler(final GT_Recipe_Map tMap) { - super(tMap); - if (!NEI_GT_Config.sIsAdded) { - FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + this.getRecipeName() + "@" + this.getOverlayIdentifier()); - GuiCraftingRecipe.craftinghandlers.add(this); - GuiUsageRecipe.usagehandlers.add(this); - } - } + public GTPP_NEI_DefaultHandler(final GT_Recipe_Map tMap) { + super(tMap); + if (!NEI_GT_Config.sIsAdded) { + FMLInterModComms.sendRuntimeMessage( + GT_Values.GT, + "NEIPlugins", + "register-crafting-handler", + "gregtechplusplus@" + this.getRecipeName() + "@" + this.getOverlayIdentifier()); + GuiCraftingRecipe.craftinghandlers.add(this); + GuiUsageRecipe.usagehandlers.add(this); + } + } - @Override - public TemplateRecipeHandler newInstance() { - return new GTPP_NEI_DefaultHandler(this.mRecipeMap); - } + @Override + public TemplateRecipeHandler newInstance() { + return new GTPP_NEI_DefaultHandler(this.mRecipeMap); + } - @Override - public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack aStack, List<String> currenttip, int aRecipeIndex) { - super.handleItemTooltip(gui, aStack, currenttip, aRecipeIndex); - CachedRecipe tObject = this.arecipes.get(aRecipeIndex); - if (tObject instanceof CachedDefaultRecipe) { - CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; - for (PositionedStack tStack : tRecipe.mOutputs) { - // no-op - } - for (PositionedStack tStack : tRecipe.mInputs) { - if (aStack == tStack.item) { - if (ItemUtils.isMillingBall(aStack)) { - currenttip.remove(GT_Utility.trans("151", "Does not get consumed in the process")); - currenttip.add("Does not always get consumed in the process"); - } - if (ItemUtils.isCatalyst(aStack)) { - currenttip.remove(GT_Utility.trans("151", "Does not get consumed in the process")); - currenttip.add("Does not always get consumed in the process"); - currenttip.add("Higher tier pipe casings allow this item to last longer"); - } - } - } - } + @Override + public List<String> handleItemTooltip( + GuiRecipe<?> gui, ItemStack aStack, List<String> currenttip, int aRecipeIndex) { + super.handleItemTooltip(gui, aStack, currenttip, aRecipeIndex); + CachedRecipe tObject = this.arecipes.get(aRecipeIndex); + if (tObject instanceof CachedDefaultRecipe) { + CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; + for (PositionedStack tStack : tRecipe.mOutputs) { + // no-op + } + for (PositionedStack tStack : tRecipe.mInputs) { + if (aStack == tStack.item) { + if (ItemUtils.isMillingBall(aStack)) { + currenttip.remove(GT_Utility.trans("151", "Does not get consumed in the process")); + currenttip.add("Does not always get consumed in the process"); + } + if (ItemUtils.isCatalyst(aStack)) { + currenttip.remove(GT_Utility.trans("151", "Does not get consumed in the process")); + currenttip.add("Does not always get consumed in the process"); + currenttip.add("Higher tier pipe casings allow this item to last longer"); + } + } + } + } - return currenttip; - } + return currenttip; + } } diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_FluidReactor.java b/src/main/java/gtPlusPlus/nei/GT_NEI_FluidReactor.java index 2ea0121ed9..0a04e0abf7 100644 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_FluidReactor.java +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_FluidReactor.java @@ -5,42 +5,37 @@ import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; public class GT_NEI_FluidReactor extends GTPP_NEI_DefaultHandler { - public GT_NEI_FluidReactor() { - super(GTPP_Recipe_Map.sChemicalPlantRecipes); - } + public GT_NEI_FluidReactor() { + super(GTPP_Recipe_Map.sChemicalPlantRecipes); + } - @Override - public TemplateRecipeHandler newInstance() { - return new GT_NEI_FluidReactor(); - } + @Override + public TemplateRecipeHandler newInstance() { + return new GT_NEI_FluidReactor(); + } - @Override - protected String getSpecialInfo(int specialValue) { - String aTierMaterial = " - "; - if (specialValue <= 0) { - aTierMaterial += "Bronze"; - } - else if (specialValue == 1) { - aTierMaterial += "Steel"; - } - else if (specialValue == 2) { - aTierMaterial += "Aluminium"; - } - else if (specialValue == 3) { - aTierMaterial += "Stainless Steel"; - } - else if (specialValue == 4) { - aTierMaterial += "Titanium"; - } - else if (specialValue == 5) { - aTierMaterial += "Tungsten Steel"; - } - else if (specialValue == 6) { - aTierMaterial += "Laurenium"; - } - else if (specialValue == 7) { - aTierMaterial += "Botmium"; - } - return this.mRecipeMap.mNEISpecialValuePre + (specialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + aTierMaterial; - } + @Override + protected String getSpecialInfo(int specialValue) { + String aTierMaterial = " - "; + if (specialValue <= 0) { + aTierMaterial += "Bronze"; + } else if (specialValue == 1) { + aTierMaterial += "Steel"; + } else if (specialValue == 2) { + aTierMaterial += "Aluminium"; + } else if (specialValue == 3) { + aTierMaterial += "Stainless Steel"; + } else if (specialValue == 4) { + aTierMaterial += "Titanium"; + } else if (specialValue == 5) { + aTierMaterial += "Tungsten Steel"; + } else if (specialValue == 6) { + aTierMaterial += "Laurenium"; + } else if (specialValue == 7) { + aTierMaterial += "Botmium"; + } + return this.mRecipeMap.mNEISpecialValuePre + + (specialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + + aTierMaterial; + } } diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR.java b/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR.java index 82f6299bbb..f0555906eb 100644 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR.java +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR.java @@ -6,22 +6,34 @@ import gtPlusPlus.core.util.math.MathUtils; public class GT_NEI_LFTR extends GT_NEI_MultiNoCell { - public GT_NEI_LFTR() { - super(GTPP_Recipe_Map.sLiquidFluorineThoriumReactorRecipes); - } - - @Override - public TemplateRecipeHandler newInstance() { - return new GT_NEI_LFTR(); - } + public GT_NEI_LFTR() { + super(GTPP_Recipe_Map.sLiquidFluorineThoriumReactorRecipes); + } - @Override - public void drawExtras(final int aRecipeIndex) { - final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue; - final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; - drawText(10, 83, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(0.05d * tDuration)) + " secs", -16777216); - drawText(10, 93, this.mRecipeMap.mNEISpecialValuePre + MathUtils.formatNumbers((((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier)) + this.mRecipeMap.mNEISpecialValuePost, -16777216); - drawText(10, 103, "Dynamo: " + MathUtils.formatNumbers((long) (tDuration * tEUt)) + " EU", -16777216); - drawText(10, 113, "Total: " + MathUtils.formatNumbers((long) (tDuration * tEUt * 4)) + " EU", -16777216); - } + @Override + public TemplateRecipeHandler newInstance() { + return new GT_NEI_LFTR(); + } + + @Override + public void drawExtras(final int aRecipeIndex) { + final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue; + final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; + drawText( + 10, + 83, + "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(0.05d * tDuration)) + " secs", + -16777216); + drawText( + 10, + 93, + this.mRecipeMap.mNEISpecialValuePre + + MathUtils.formatNumbers( + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue + * this.mRecipeMap.mNEISpecialValueMultiplier)) + + this.mRecipeMap.mNEISpecialValuePost, + -16777216); + drawText(10, 103, "Dynamo: " + MathUtils.formatNumbers((long) (tDuration * tEUt)) + " EU", -16777216); + drawText(10, 113, "Total: " + MathUtils.formatNumbers((long) (tDuration * tEUt * 4)) + " EU", -16777216); + } } diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR_Sparging.java b/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR_Sparging.java index c534335b3d..62d2a26cf5 100644 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR_Sparging.java +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_LFTR_Sparging.java @@ -1,14 +1,5 @@ package gtPlusPlus.nei; -import java.awt.Rectangle; -import java.lang.ref.SoftReference; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.stream.Collectors; - -import org.lwjgl.opengl.GL11; - import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.GuiCraftingRecipe; @@ -26,70 +17,87 @@ import gregtech.api.util.GasSpargingRecipe; import gregtech.api.util.GasSpargingRecipeMap; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import java.awt.Rectangle; +import java.lang.ref.SoftReference; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; import net.minecraft.client.Minecraft; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import org.lwjgl.opengl.GL11; public class GT_NEI_LFTR_Sparging extends TemplateRecipeHandler { - public static final String mNEIName = GasSpargingRecipeMap.mNEIDisplayName; + public static final String mNEIName = GasSpargingRecipeMap.mNEIDisplayName; private SoftReference<List<GasSpargingRecipeNEI>> mCachedRecipes = null; - public GT_NEI_LFTR_Sparging() { - this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), this.getOverlayIdentifier(), new Object[0])); - if (!NEI_GT_Config.sIsAdded) { - FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + this.getRecipeName() + "@" + this.getOverlayIdentifier()); - GuiCraftingRecipe.craftinghandlers.add(this); - GuiUsageRecipe.usagehandlers.add(this); - } - } - - public String getRecipeName() { - return mNEIName; - } - - public String getGuiTexture() { - return GasSpargingRecipeMap.mNEIGUIPath; - } - - public String getOverlayIdentifier() { - return gregtech.api.util.GasSpargingRecipeMap.mUnlocalizedName; - } - - public int recipiesPerPage() { - return 1; - } - - @Override - public void drawBackground(final int recipe) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GuiDraw.changeTexture(this.getGuiTexture()); - GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 68); - } - - public void loadTransferRects() { - this.transferRects.add(new RecipeTransferRect(new Rectangle(72, 14, 22, 16), getOverlayIdentifier(), new Object[0])); - } - + public GT_NEI_LFTR_Sparging() { + this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect( + new Rectangle(65, 13, 36, 18), this.getOverlayIdentifier(), new Object[0])); + if (!NEI_GT_Config.sIsAdded) { + FMLInterModComms.sendRuntimeMessage( + GT_Values.GT, + "NEIPlugins", + "register-crafting-handler", + "gregtechplusplus@" + this.getRecipeName() + "@" + this.getOverlayIdentifier()); + GuiCraftingRecipe.craftinghandlers.add(this); + GuiUsageRecipe.usagehandlers.add(this); + } + } + + public String getRecipeName() { + return mNEIName; + } + + public String getGuiTexture() { + return GasSpargingRecipeMap.mNEIGUIPath; + } + + public String getOverlayIdentifier() { + return gregtech.api.util.GasSpargingRecipeMap.mUnlocalizedName; + } + + public int recipiesPerPage() { + return 1; + } + + @Override + public void drawBackground(final int recipe) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 68); + } + + public void loadTransferRects() { + this.transferRects.add( + new RecipeTransferRect(new Rectangle(72, 14, 22, 16), getOverlayIdentifier(), new Object[0])); + } + public List<GasSpargingRecipeNEI> getCache() { List<GasSpargingRecipeNEI> cache; if (mCachedRecipes == null || (cache = mCachedRecipes.get()) == null) { - cache = GasSpargingRecipeMap.mRecipes.stream() // do not use parallel stream. This is already parallelized by NEI - .sorted() - .map(temp -> {return createCachedRecipe(temp);}) - .collect(Collectors.toList()); + cache = + GasSpargingRecipeMap.mRecipes + .stream() // do not use parallel stream. This is already parallelized by NEI + .sorted() + .map(temp -> { + return createCachedRecipe(temp); + }) + .collect(Collectors.toList()); // while the NEI parallelize handlers, for each individual handler it still uses sequential execution model // so we do not need any synchronization here mCachedRecipes = new SoftReference<>(cache); } return cache; } - + public GasSpargingRecipeNEI createCachedRecipe(GasSpargingRecipe aRecipe) { - return new GasSpargingRecipeNEI(aRecipe); + return new GasSpargingRecipeNEI(aRecipe); } - + public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equals(getOverlayIdentifier())) { arecipes.addAll(getCache()); @@ -104,7 +112,9 @@ public class GT_NEI_LFTR_Sparging extends TemplateRecipeHandler { ArrayList<ItemStack> tResults = new ArrayList<>(); tResults.add(aResult); tResults.add(GT_OreDictUnificator.get(true, aResult)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + if ((tPrefixMaterial != null) + && (!tPrefixMaterial.mBlackListed) + && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); } @@ -114,14 +124,12 @@ public class GT_NEI_LFTR_Sparging extends TemplateRecipeHandler { if (tFluid != null) { tFluidStack = tFluid; tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - } - else tFluidStack = GT_Utility.getFluidFromDisplayStack(aResult); + } else tFluidStack = GT_Utility.getFluidFromDisplayStack(aResult); if (tFluidStack != null) { tResults.addAll(GT_Utility.getContainersFromFluid(tFluidStack)); } for (GasSpargingRecipeNEI recipe : getCache()) { - if (tResults.stream().anyMatch(stack -> recipe.contains(recipe.mOutputs, stack))) - arecipes.add(recipe); + if (tResults.stream().anyMatch(stack -> recipe.contains(recipe.mOutputs, stack))) arecipes.add(recipe); } } @@ -141,237 +149,320 @@ public class GT_NEI_LFTR_Sparging extends TemplateRecipeHandler { if (tFluid != null) { tFluidStack = tFluid; tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false)); - } - else tFluidStack = GT_Utility.getFluidFromDisplayStack(aInput); + } else tFluidStack = GT_Utility.getFluidFromDisplayStack(aInput); if (tFluidStack != null) { tInputs.addAll(GT_Utility.getContainersFromFluid(tFluidStack)); } for (GasSpargingRecipeNEI recipe : getCache()) { - if (tInputs.stream().anyMatch(stack -> recipe.contains(recipe.mInputs, stack))) - arecipes.add(recipe); + if (tInputs.stream().anyMatch(stack -> recipe.contains(recipe.mInputs, stack))) arecipes.add(recipe); + } + } + + protected static void drawText(int aX, int aY, String aString, int aColor) { + Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); + } + + public void drawExtras(int aRecipeIndex) { + final long tEUt = ((GasSpargingRecipeNEI) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; + final long tDuration = ((GasSpargingRecipeNEI) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; + drawText(10, 73, "Total: " + MathUtils.formatNumbers((long) (tDuration * tEUt)) + " EU", -16777216); + drawText(10, 83, "Usage: " + MathUtils.formatNumbers(tEUt) + " EU/t", -16777216); + drawText( + 10, + 93, + "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(0.05d * tDuration)) + " secs", + -16777216); + drawText(10, 103, "Gas not used to sparge is", -16777216); + drawText(10, 113, "returned alongside outputs.", -16777216); + } + + @Override + public List<String> handleItemTooltip( + final GuiRecipe<?> gui, final ItemStack aStack, final List<String> currenttip, final int aRecipeIndex) { + final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); + if ((tObject instanceof GasSpargingRecipeNEI)) { + final GasSpargingRecipeNEI tRecipe = (GasSpargingRecipeNEI) tObject; + ItemStack aSpargeInput = tRecipe.mOutputs.get(0).item; + ItemStack aSpentFuel = tRecipe.mOutputs.get(1).item; + for (final PositionedStack tStack : tRecipe.mOutputs) { + if (aStack == tStack.item) { + if (ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) { + if (GT_Utility.areStacksEqual(aStack, aSpentFuel, true)) { + break; + } + if (GT_Utility.areStacksEqual(aStack, aSpargeInput, true)) { + currenttip.add("The amount returned is the remainder after all other outputs."); + } + currenttip.add("Maximum Output: " + (((FixedPositionedStack) tStack).mChance / 100) + "." + + ((((FixedPositionedStack) tStack).mChance % 100) < 10 + ? "0" + (((FixedPositionedStack) tStack).mChance % 100) + : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + + "L"); + break; + } + break; + } + } + for (final PositionedStack tStack : tRecipe.mInputs) { + if (GT_Utility.areStacksEqual(aStack, tStack.item)) { + if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) + || (tStack.item.stackSize != 0)) { + break; + } + if (ItemUtils.isControlCircuit(aStack)) { + currenttip.add("Does not get consumed in the process"); + } + break; + } + } + } + return currenttip; + } + + public class FixedPositionedStack extends PositionedStack { + public final int mChance; + public boolean permutated = false; + + public FixedPositionedStack(final Object object, final int x, final int y) { + this(object, x, y, 0); + } + + public FixedPositionedStack(final Object object, final int x, final int y, final int aChance) { + super(object, x, y, true); + this.mChance = aChance; + } + + @Override + public void generatePermutations() { + if (this.permutated) { + return; + } + final ArrayList<ItemStack> tDisplayStacks = new ArrayList<ItemStack>(); + for (final ItemStack tStack : this.items) { + if (GT_Utility.isStackValid(tStack)) { + if (tStack.getItemDamage() == 32767) { + final List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); + if (!permutations.isEmpty()) { + ItemStack stack; + for (final Iterator<ItemStack> i$ = permutations.iterator(); + i$.hasNext(); + tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[] {stack}))) { + stack = i$.next(); + } + } else { + final ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize); + base.stackTagCompound = tStack.stackTagCompound; + tDisplayStacks.add(base); + } + } else { + tDisplayStacks.add(GT_Utility.copy(new Object[] {tStack})); + } + } + } + this.items = (tDisplayStacks.toArray(new ItemStack[0])); + if (this.items.length == 0) { + this.items = new ItemStack[] {new ItemStack(Blocks.fire)}; + } + this.permutated = true; + this.setPermutationToRender(0); } } - protected static void drawText(int aX, int aY, String aString, int aColor) { - Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); - } - - public void drawExtras(int aRecipeIndex) { - final long tEUt = ((GasSpargingRecipeNEI) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; - final long tDuration = ((GasSpargingRecipeNEI) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; - drawText(10, 73, "Total: " + MathUtils.formatNumbers((long) (tDuration * tEUt)) + " EU", -16777216); - drawText(10, 83, "Usage: " + MathUtils.formatNumbers(tEUt) + " EU/t", -16777216); - drawText(10, 93, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(0.05d * tDuration)) + " secs", -16777216); - drawText(10, 103, "Gas not used to sparge is", -16777216); - drawText(10, 113, "returned alongside outputs.", -16777216); - } - - @Override - public List<String> handleItemTooltip(final GuiRecipe<?> gui, final ItemStack aStack, final List<String> currenttip, final int aRecipeIndex) { - final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); - if ((tObject instanceof GasSpargingRecipeNEI)) { - final GasSpargingRecipeNEI tRecipe = (GasSpargingRecipeNEI) tObject; - ItemStack aSpargeInput = tRecipe.mOutputs.get(0).item; - ItemStack aSpentFuel = tRecipe.mOutputs.get(1).item; - for (final PositionedStack tStack : tRecipe.mOutputs) { - if (aStack == tStack.item) { - if (ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) { - if (GT_Utility.areStacksEqual(aStack, aSpentFuel, true)) { - break; - } - if (GT_Utility.areStacksEqual(aStack, aSpargeInput, true)) { - currenttip.add("The amount returned is the remainder after all other outputs."); - } - currenttip.add("Maximum Output: " + (((FixedPositionedStack) tStack).mChance / 100) + "." + ((((FixedPositionedStack) tStack).mChance % 100) < 10 ? "0" + (((FixedPositionedStack) tStack).mChance % 100) : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "L"); - break; - } - break; - } - } - for (final PositionedStack tStack : tRecipe.mInputs) { - if (GT_Utility.areStacksEqual(aStack, tStack.item)) { - if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) || - (tStack.item.stackSize != 0)) { - break; - } - if (ItemUtils.isControlCircuit(aStack)) { - currenttip.add("Does not get consumed in the process"); - } - break; - } - } - } - return currenttip; - } - - public class FixedPositionedStack - extends PositionedStack { - public final int mChance; - public boolean permutated = false; - - public FixedPositionedStack(final Object object, final int x, final int y) { - this(object, x, y, 0); - } - - public FixedPositionedStack(final Object object, final int x, final int y, final int aChance) { - super(object, x, y, true); - this.mChance = aChance; - } - - @Override - public void generatePermutations() { - if (this.permutated) { - return; - } - final ArrayList<ItemStack> tDisplayStacks = new ArrayList<ItemStack>(); - for (final ItemStack tStack : this.items) { - if (GT_Utility.isStackValid(tStack)) { - if (tStack.getItemDamage() == 32767) { - final List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); - if (!permutations.isEmpty()) { - ItemStack stack; - for (final Iterator<ItemStack> i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[]{stack}))) { - stack = i$.next(); - } - } else { - final ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize); - base.stackTagCompound = tStack.stackTagCompound; - tDisplayStacks.add(base); - } - } else { - tDisplayStacks.add(GT_Utility.copy(new Object[]{tStack})); - } - } - } - this.items = (tDisplayStacks.toArray(new ItemStack[0])); - if (this.items.length == 0) { - this.items = new ItemStack[]{new ItemStack(Blocks.fire)}; - } - this.permutated = true; - this.setPermutationToRender(0); - } - } - - public class GasSpargingRecipeNEI extends CachedRecipe implements Comparable<CachedRecipe> { - - public final GasSpargingRecipe mRecipe; - public final List<PositionedStack> mOutputs = new ArrayList<PositionedStack>(); - public final List<PositionedStack> mInputs = new ArrayList<PositionedStack>(); - - public GasSpargingRecipeNEI(GasSpargingRecipe tRecipe) { - super(); - this.mRecipe = tRecipe; - int tStartIndex = 0; - if (tRecipe.mFluidInputs.length > 0) { - if ((tRecipe.mFluidInputs[0] != null) && (tRecipe.mFluidInputs[0].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[0], true), 30, 5)); - } - if ((tRecipe.mFluidInputs.length > 1) && (tRecipe.mFluidInputs[1] != null) && (tRecipe.mFluidInputs[1].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[1], true), 12, 5)); - } - if ((tRecipe.mFluidInputs.length > 2) && (tRecipe.mFluidInputs[2] != null) && (tRecipe.mFluidInputs[2].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[2], true), 48, 5)); - } - if ((tRecipe.mFluidInputs.length > 3) && (tRecipe.mFluidInputs[3] != null) && (tRecipe.mFluidInputs[3].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[3], true), 12, 23)); - } - if ((tRecipe.mFluidInputs.length > 4) && (tRecipe.mFluidInputs[4] != null) && (tRecipe.mFluidInputs[4].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[4], true), 30, 23)); - } - if ((tRecipe.mFluidInputs.length > 5) && (tRecipe.mFluidInputs[5] != null) && (tRecipe.mFluidInputs[5].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[5], true), 48, 23)); - } - if ((tRecipe.mFluidInputs.length > 6) && (tRecipe.mFluidInputs[6] != null) && (tRecipe.mFluidInputs[6].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[6], true), 12, 41)); - } - if ((tRecipe.mFluidInputs.length > 7) && (tRecipe.mFluidInputs[7] != null) && (tRecipe.mFluidInputs[7].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[7], true), 30, 41)); - } - if ((tRecipe.mFluidInputs.length > 8) && (tRecipe.mFluidInputs[8] != null) && (tRecipe.mFluidInputs[8].getFluid() != null)) { - this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[8], true), 48, 41)); - } - } - - tStartIndex = 0; - if (tRecipe.mFluidOutputs.length > 0) { - if ((tRecipe.mFluidOutputs[0] != null) && (tRecipe.mFluidOutputs[0].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[0], false), 120, 5, tRecipe.getMaxOutput(tStartIndex++))); - } - if ((tRecipe.mFluidOutputs.length > 1) && (tRecipe.mFluidOutputs[1] != null) && (tRecipe.mFluidOutputs[1].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[1], true), 102, 5, tRecipe.getMaxOutput(tStartIndex++))); - } - if ((tRecipe.mFluidOutputs.length > 2) && (tRecipe.mFluidOutputs[2] != null) && (tRecipe.mFluidOutputs[2].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[2], false), 138, 5, tRecipe.getMaxOutput(tStartIndex++))); - } - if ((tRecipe.mFluidOutputs.length > 3) && (tRecipe.mFluidOutputs[3] != null) && (tRecipe.mFluidOutputs[3].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[3], false), 102, 23, tRecipe.getMaxOutput(tStartIndex++))); - } - if ((tRecipe.mFluidOutputs.length > 4) && (tRecipe.mFluidOutputs[4] != null) && (tRecipe.mFluidOutputs[4].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[4], false), 120, 23, tRecipe.getMaxOutput(tStartIndex++))); - } - if ((tRecipe.mFluidOutputs.length > 5) && (tRecipe.mFluidOutputs[5] != null) && (tRecipe.mFluidOutputs[5].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[5], false), 138, 23, tRecipe.getMaxOutput(tStartIndex++))); - } - if ((tRecipe.mFluidOutputs.length > 6) && (tRecipe.mFluidOutputs[6] != null) && (tRecipe.mFluidOutputs[6].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[6], false), 102, 41, tRecipe.getMaxOutput(tStartIndex++))); - } - if ((tRecipe.mFluidOutputs.length > 7) && (tRecipe.mFluidOutputs[7] != null) && (tRecipe.mFluidOutputs[7].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[7], false), 120, 41, tRecipe.getMaxOutput(tStartIndex++))); - } - if ((tRecipe.mFluidOutputs.length > 8) && (tRecipe.mFluidOutputs[8] != null) && (tRecipe.mFluidOutputs[8].getFluid() != null)) { - this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[8], false), 138, 41, tRecipe.getMaxOutput(tStartIndex++))); - } - } - } - - @Override - public int compareTo(CachedRecipe o) { - boolean b = GasSpargingRecipeNEI.class.isInstance(o); - if (b) { - GasSpargingRecipeNEI p = (GasSpargingRecipeNEI) o; - if (p.mOutputs.size() > this.mOutputs.size()) { - return 1; - } else if (p.mOutputs.size() == this.mOutputs.size()) { - return 0; - } else { - return -1; - } - } - return 0; - } - - @Override - public boolean equals(Object obj) { - if (obj != null) { - if (GasSpargingRecipeNEI.class.isInstance(obj)) { - GasSpargingRecipeNEI p = (GasSpargingRecipeNEI) obj; - if (p != null) { - if (GT_Utility.areStacksEqual(p.mInputs.get(0).item, this.mInputs.get(0).item, true)) { - if (p.mOutputs.size() == this.mOutputs.size()) { - return true; - } - } - } - } - } - return false; - } - - @Override - public List<PositionedStack> getIngredients() { - return this.getCycledIngredients(GT_NEI_LFTR_Sparging.this.cycleticks / 10, this.mInputs); - } - - @Override - public PositionedStack getResult() { - return null; - } - - @Override - public List<PositionedStack> getOtherStacks() { - return this.mOutputs; - } - - - } + public class GasSpargingRecipeNEI extends CachedRecipe implements Comparable<CachedRecipe> { + + public final GasSpargingRecipe mRecipe; + public final List<PositionedStack> mOutputs = new ArrayList<PositionedStack>(); + public final List<PositionedStack> mInputs = new ArrayList<PositionedStack>(); + + public GasSpargingRecipeNEI(GasSpargingRecipe tRecipe) { + super(); + this.mRecipe = tRecipe; + int tStartIndex = 0; + if (tRecipe.mFluidInputs.length > 0) { + if ((tRecipe.mFluidInputs[0] != null) && (tRecipe.mFluidInputs[0].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[0], true), 30, 5)); + } + if ((tRecipe.mFluidInputs.length > 1) + && (tRecipe.mFluidInputs[1] != null) + && (tRecipe.mFluidInputs[1].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[1], true), 12, 5)); + } + if ((tRecipe.mFluidInputs.length > 2) + && (tRecipe.mFluidInputs[2] != null) + && (tRecipe.mFluidInputs[2].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[2], true), 48, 5)); + } + if ((tRecipe.mFluidInputs.length > 3) + && (tRecipe.mFluidInputs[3] != null) + && (tRecipe.mFluidInputs[3].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[3], true), 12, 23)); + } + if ((tRecipe.mFluidInputs.length > 4) + && (tRecipe.mFluidInputs[4] != null) + && (tRecipe.mFluidInputs[4].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[4], true), 30, 23)); + } + if ((tRecipe.mFluidInputs.length > 5) + && (tRecipe.mFluidInputs[5] != null) + && (tRecipe.mFluidInputs[5].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[5], true), 48, 23)); + } + if ((tRecipe.mFluidInputs.length > 6) + && (tRecipe.mFluidInputs[6] != null) + && (tRecipe.mFluidInputs[6].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[6], true), 12, 41)); + } + if ((tRecipe.mFluidInputs.length > 7) + && (tRecipe.mFluidInputs[7] != null) + && (tRecipe.mFluidInputs[7].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[7], true), 30, 41)); + } + if ((tRecipe.mFluidInputs.length > 8) + && (tRecipe.mFluidInputs[8] != null) + && (tRecipe.mFluidInputs[8].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidInputs[8], true), 48, 41)); + } + } + + tStartIndex = 0; + if (tRecipe.mFluidOutputs.length > 0) { + if ((tRecipe.mFluidOutputs[0] != null) && (tRecipe.mFluidOutputs[0].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[0], false), + 120, + 5, + tRecipe.getMaxOutput(tStartIndex++))); + } + if ((tRecipe.mFluidOutputs.length > 1) + && (tRecipe.mFluidOutputs[1] != null) + && (tRecipe.mFluidOutputs[1].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[1], true), + 102, + 5, + tRecipe.getMaxOutput(tStartIndex++))); + } + if ((tRecipe.mFluidOutputs.length > 2) + && (tRecipe.mFluidOutputs[2] != null) + && (tRecipe.mFluidOutputs[2].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[2], false), + 138, + 5, + tRecipe.getMaxOutput(tStartIndex++))); + } + if ((tRecipe.mFluidOutputs.length > 3) + && (tRecipe.mFluidOutputs[3] != null) + && (tRecipe.mFluidOutputs[3].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[3], false), + 102, + 23, + tRecipe.getMaxOutput(tStartIndex++))); + } + if ((tRecipe.mFluidOutputs.length > 4) + && (tRecipe.mFluidOutputs[4] != null) + && (tRecipe.mFluidOutputs[4].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[4], false), + 120, + 23, + tRecipe.getMaxOutput(tStartIndex++))); + } + if ((tRecipe.mFluidOutputs.length > 5) + && (tRecipe.mFluidOutputs[5] != null) + && (tRecipe.mFluidOutputs[5].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[5], false), + 138, + 23, + tRecipe.getMaxOutput(tStartIndex++))); + } + if ((tRecipe.mFluidOutputs.length > 6) + && (tRecipe.mFluidOutputs[6] != null) + && (tRecipe.mFluidOutputs[6].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[6], false), + 102, + 41, + tRecipe.getMaxOutput(tStartIndex++))); + } + if ((tRecipe.mFluidOutputs.length > 7) + && (tRecipe.mFluidOutputs[7] != null) + && (tRecipe.mFluidOutputs[7].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[7], false), + 120, + 41, + tRecipe.getMaxOutput(tStartIndex++))); + } + if ((tRecipe.mFluidOutputs.length > 8) + && (tRecipe.mFluidOutputs[8] != null) + && (tRecipe.mFluidOutputs[8].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack( + GT_Utility.getFluidDisplayStack(tRecipe.mFluidOutputs[8], false), + 138, + 41, + tRecipe.getMaxOutput(tStartIndex++))); + } + } + } + + @Override + public int compareTo(CachedRecipe o) { + boolean b = GasSpargingRecipeNEI.class.isInstance(o); + if (b) { + GasSpargingRecipeNEI p = (GasSpargingRecipeNEI) o; + if (p.mOutputs.size() > this.mOutputs.size()) { + return 1; + } else if (p.mOutputs.size() == this.mOutputs.size()) { + return 0; + } else { + return -1; + } + } + return 0; + } + + @Override + public boolean equals(Object obj) { + if (obj != null) { + if (GasSpargingRecipeNEI.class.isInstance(obj)) { + GasSpargingRecipeNEI p = (GasSpargingRecipeNEI) obj; + if (p != null) { + if (GT_Utility.areStacksEqual(p.mInputs.get(0).item, this.mInputs.get(0).item, true)) { + if (p.mOutputs.size() == this.mOutputs.size()) { + return true; + } + } + } + } + } + return false; + } + + @Override + public List<PositionedStack> getIngredients() { + return this.getCycledIngredients(GT_NEI_LFTR_Sparging.this.cycleticks / 10, this.mInputs); + } + + @Override + public PositionedStack getResult() { + return null; + } + + @Override + public List<PositionedStack> getOtherStacks() { + return this.mOutputs; + } + } } diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiNoCell.java b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiNoCell.java index 26d11e1803..074371c8f3 100644 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiNoCell.java +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiNoCell.java @@ -1,34 +1,33 @@ package gtPlusPlus.nei; -import org.lwjgl.opengl.GL11; - import codechicken.lib.gui.GuiDraw; import codechicken.nei.recipe.TemplateRecipeHandler; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import org.lwjgl.opengl.GL11; /** * Used for larger GUI ("basicmachines/FissionFuel") */ public class GT_NEI_MultiNoCell extends GTPP_NEI_DefaultHandler { - public GT_NEI_MultiNoCell(GT_Recipe_Map aMap) { - super(aMap); - } + public GT_NEI_MultiNoCell(GT_Recipe_Map aMap) { + super(aMap); + } - @Override - public TemplateRecipeHandler newInstance() { - return new GT_NEI_MultiNoCell(mRecipeMap); - } + @Override + public TemplateRecipeHandler newInstance() { + return new GT_NEI_MultiNoCell(mRecipeMap); + } - @Override - public void drawBackground(final int recipe) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GuiDraw.changeTexture(this.getGuiTexture()); - GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 89); - } + @Override + public void drawBackground(final int recipe) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 89); + } - @Override - protected int getDescriptionYOffset() { - return 85; - } + @Override + protected int getDescriptionYOffset() { + return 85; + } } diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java index 8ea1dec802..9dadd870d1 100644 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java @@ -6,24 +6,27 @@ import gtPlusPlus.core.util.math.MathUtils; public class GT_NEI_MultiSolarTower extends GT_NEI_MultiNoCell { - public GT_NEI_MultiSolarTower(GT_Recipe_Map aMap) { - super(aMap); - } + public GT_NEI_MultiSolarTower(GT_Recipe_Map aMap) { + super(aMap); + } - @Override - public TemplateRecipeHandler newInstance() { - return new GT_NEI_MultiSolarTower(mRecipeMap); - } + @Override + public TemplateRecipeHandler newInstance() { + return new GT_NEI_MultiSolarTower(mRecipeMap); + } - @Override - public void drawExtras(final int aRecipeIndex) { - final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; - if (tDuration > 0) { - drawText(10, 90, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(0.05d * tDuration)) + " secs", -16777216); - } - drawText(5, 100, "Solar Heater rings boost tier", -16777216); - drawText(5, 110, "R1:T1, R2:T2, R3:T4, R4:T8, R5:T16", -16777216); - drawText(5, 120, "Input Amount = 1000 x T", -16777216); - } - + @Override + public void drawExtras(final int aRecipeIndex) { + final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; + if (tDuration > 0) { + drawText( + 10, + 90, + "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(0.05d * tDuration)) + " secs", + -16777216); + } + drawText(5, 100, "Solar Heater rings boost tier", -16777216); + drawText(5, 110, "R1:T1, R2:T2, R3:T4, R4:T8, R5:T16", -16777216); + drawText(5, 120, "Input Amount = 1000 x T", -16777216); + } } diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiTreeGrowthSimulator.java b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiTreeGrowthSimulator.java index ea175f4ddb..5617237044 100644 --- a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiTreeGrowthSimulator.java +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiTreeGrowthSimulator.java @@ -1,51 +1,54 @@ package gtPlusPlus.nei; -import java.util.List; - import codechicken.nei.PositionedStack; import codechicken.nei.recipe.GuiRecipe; import codechicken.nei.recipe.TemplateRecipeHandler; import gregtech.api.util.GTPP_Recipe.GTPP_Recipe_Map; import gtPlusPlus.core.item.ModItems; +import java.util.List; import net.minecraft.item.ItemStack; public class GT_NEI_MultiTreeGrowthSimulator extends GT_NEI_MultiNoCell { - - public GT_NEI_MultiTreeGrowthSimulator() { - super(GTPP_Recipe_Map.sTreeSimFakeRecipes); - } - @Override - public TemplateRecipeHandler newInstance() { - return new GT_NEI_MultiTreeGrowthSimulator(); - } + public GT_NEI_MultiTreeGrowthSimulator() { + super(GTPP_Recipe_Map.sTreeSimFakeRecipes); + } + + @Override + public TemplateRecipeHandler newInstance() { + return new GT_NEI_MultiTreeGrowthSimulator(); + } + + @Override + public void drawExtras(final int aRecipeIndex) { + if (ModItems.fluidFertBasic != null) { + drawText(5, 90, "Chance of Sapling output if", -16777216); + drawText(5, 100, "" + ModItems.fluidFertBasic.getLocalizedName() + " is provided.", -16777216); + drawText(5, 110, "This is optional.", -16777216); + } + } - @Override - public void drawExtras(final int aRecipeIndex) { - if (ModItems.fluidFertBasic != null) { - drawText(5, 90, "Chance of Sapling output if", -16777216); - drawText(5, 100, ""+ModItems.fluidFertBasic.getLocalizedName()+" is provided.", -16777216); - drawText(5, 110, "This is optional.", -16777216); - } - } - - @Override - public List<String> handleItemTooltip(final GuiRecipe<?> gui, final ItemStack aStack, final List<String> currenttip, final int aRecipeIndex) { - final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); - if (tObject instanceof CachedDefaultRecipe) { - final CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; - for (final PositionedStack tStack : tRecipe.mOutputs) { - if (aStack == tStack.item) { - if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) { - break; - } - if (ModItems.fluidFertBasic != null) { - currenttip.add("Chance output if "+ModItems.fluidFertBasic.getLocalizedName()+" is provided."); - } - break; - } - } - } - return currenttip; - } + @Override + public List<String> handleItemTooltip( + final GuiRecipe<?> gui, final ItemStack aStack, final List<String> currenttip, final int aRecipeIndex) { + final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); + if (tObject instanceof CachedDefaultRecipe) { + final CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; + for (final PositionedStack tStack : tRecipe.mOutputs) { + if (aStack == tStack.item) { + if ((!(tStack instanceof FixedPositionedStack)) + || (((FixedPositionedStack) tStack).mChance <= 0) + || (((FixedPositionedStack) tStack).mChance == 10000)) { + break; + } + if (ModItems.fluidFertBasic != null) { + currenttip.add( + "Chance output if " + ModItems.fluidFertBasic.getLocalizedName() + " is provided."); + } + break; + } + } + } + return currenttip; + } } diff --git a/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java b/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java index 053eec139b..a49f124e84 100644 --- a/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java +++ b/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java @@ -10,95 +10,97 @@ import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -public class NEI_GT_Config -implements IConfigureNEI { - - public static boolean sIsAdded = true; - - private static final AutoMap<String> mUniqueRecipeMapHandling = new AutoMap<String>(); - - @Override - public synchronized void loadConfig() { - sIsAdded = false; +public class NEI_GT_Config implements IConfigureNEI { - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sFissionFuelProcessing.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sChemicalPlantRecipes.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sVacuumFurnaceRecipes.mUnlocalizedName); + public static boolean sIsAdded = true; - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sMultiblockMixerRecipes_GT.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sAlloyBlastSmelterRecipes.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sThermalFuels.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sSolarTowerRecipes.mUnlocalizedName); - mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sTreeSimFakeRecipes.mUnlocalizedName); - - // Standard GT Recipe Maps - Logger.INFO("NEI Registration: "+GTPP_Recipe_Map_Internal.sMappingsEx.size()+" sMappingEx"); - for (final GT_Recipe_Map tMap : GTPP_Recipe_Map_Internal.sMappingsEx) { - if (tMap.mNEIAllowed) { - if (!mUniqueRecipeMapHandling.contains(tMap.mUnlocalizedName)) { - Logger.INFO("NEI Registration: Registering NEI handler for "+tMap.mNEIName); - new GTPP_NEI_DefaultHandler(tMap); - } - else { - Logger.INFO("NEI Registration: Not allowed to register NEI handler for "+tMap.mNEIName); - } - } - else { - Logger.INFO("NEI Registration: Skipping registration of NEI handler for "+tMap.mNEIName); - } - } - - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sChemicalPlantRecipes.mNEIName); - new GT_NEI_FluidReactor(); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.mNEIName); - new GT_NEI_LFTR(); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sFissionFuelProcessing.mNEIName); - new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sFissionFuelProcessing); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sVacuumFurnaceRecipes.mNEIName); - new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sVacuumFurnaceRecipes); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sThermalFuels.mNEIName); - new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sThermalFuels); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sSolarTowerRecipes.mNEIName); - new GT_NEI_MultiSolarTower(GTPP_Recipe_Map.sSolarTowerRecipes); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sTreeSimFakeRecipes.mNEIName); - new GT_NEI_MultiTreeGrowthSimulator(); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mNEIName); - new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sAdvFreezerRecipes_GT); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.mNEIName); - new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.mNEIName); - new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sMultiblockMixerRecipes_GT.mNEIName); - new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sMultiblockMixerRecipes_GT); - Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sAlloyBlastSmelterRecipes.mNEIName); - new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sAlloyBlastSmelterRecipes); + private static final AutoMap<String> mUniqueRecipeMapHandling = new AutoMap<String>(); - Logger.INFO("NEI Registration: Registering NEI handler for "+DecayableRecipeHandler.mNEIName); - API.registerRecipeHandler(new DecayableRecipeHandler()); - API.registerUsageHandler(new DecayableRecipeHandler()); + @Override + public synchronized void loadConfig() { + sIsAdded = false; - Logger.INFO("NEI Registration: Registering NEI handler for "+GT_NEI_LFTR_Sparging.mNEIName); - new GT_NEI_LFTR_Sparging(); - - // Hide Flasks - if (Utils.isClient()) { - codechicken.nei.api.API.addItemListEntry(GregtechItemList.VOLUMETRIC_FLASK_8k.get(1)); - codechicken.nei.api.API.addItemListEntry(GregtechItemList.VOLUMETRIC_FLASK_32k.get(1)); - } - sIsAdded = true; - } + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sFissionFuelProcessing.mUnlocalizedName); + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.mUnlocalizedName); + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sChemicalPlantRecipes.mUnlocalizedName); + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sVacuumFurnaceRecipes.mUnlocalizedName); - @Override - public String getName() { - return "GT++ NEI Plugin"; - } + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mUnlocalizedName); + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.mUnlocalizedName); + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.mUnlocalizedName); + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sMultiblockMixerRecipes_GT.mUnlocalizedName); + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sAlloyBlastSmelterRecipes.mUnlocalizedName); + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sThermalFuels.mUnlocalizedName); + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sSolarTowerRecipes.mUnlocalizedName); + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sTreeSimFakeRecipes.mUnlocalizedName); - @Override - public String getVersion() { - return "(1.12)"; - } + // Standard GT Recipe Maps + Logger.INFO("NEI Registration: " + GTPP_Recipe_Map_Internal.sMappingsEx.size() + " sMappingEx"); + for (final GT_Recipe_Map tMap : GTPP_Recipe_Map_Internal.sMappingsEx) { + if (tMap.mNEIAllowed) { + if (!mUniqueRecipeMapHandling.contains(tMap.mUnlocalizedName)) { + Logger.INFO("NEI Registration: Registering NEI handler for " + tMap.mNEIName); + new GTPP_NEI_DefaultHandler(tMap); + } else { + Logger.INFO("NEI Registration: Not allowed to register NEI handler for " + tMap.mNEIName); + } + } else { + Logger.INFO("NEI Registration: Skipping registration of NEI handler for " + tMap.mNEIName); + } + } + + Logger.INFO("NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sChemicalPlantRecipes.mNEIName); + new GT_NEI_FluidReactor(); + Logger.INFO("NEI Registration: Registering NEI handler for " + + GTPP_Recipe_Map.sLiquidFluorineThoriumReactorRecipes.mNEIName); + new GT_NEI_LFTR(); + Logger.INFO("NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sFissionFuelProcessing.mNEIName); + new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sFissionFuelProcessing); + Logger.INFO("NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sVacuumFurnaceRecipes.mNEIName); + new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sVacuumFurnaceRecipes); + Logger.INFO("NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sThermalFuels.mNEIName); + new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sThermalFuels); + Logger.INFO("NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sSolarTowerRecipes.mNEIName); + new GT_NEI_MultiSolarTower(GTPP_Recipe_Map.sSolarTowerRecipes); + Logger.INFO("NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sTreeSimFakeRecipes.mNEIName); + new GT_NEI_MultiTreeGrowthSimulator(); + Logger.INFO("NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mNEIName); + new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sAdvFreezerRecipes_GT); + Logger.INFO("NEI Registration: Registering NEI handler for " + + GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.mNEIName); + new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT); + Logger.INFO("NEI Registration: Registering NEI handler for " + + GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.mNEIName); + new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT); + Logger.INFO( + "NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sMultiblockMixerRecipes_GT.mNEIName); + new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sMultiblockMixerRecipes_GT); + Logger.INFO( + "NEI Registration: Registering NEI handler for " + GTPP_Recipe_Map.sAlloyBlastSmelterRecipes.mNEIName); + new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sAlloyBlastSmelterRecipes); + + Logger.INFO("NEI Registration: Registering NEI handler for " + DecayableRecipeHandler.mNEIName); + API.registerRecipeHandler(new DecayableRecipeHandler()); + API.registerUsageHandler(new DecayableRecipeHandler()); + + Logger.INFO("NEI Registration: Registering NEI handler for " + GT_NEI_LFTR_Sparging.mNEIName); + new GT_NEI_LFTR_Sparging(); + + // Hide Flasks + if (Utils.isClient()) { + codechicken.nei.api.API.addItemListEntry(GregtechItemList.VOLUMETRIC_FLASK_8k.get(1)); + codechicken.nei.api.API.addItemListEntry(GregtechItemList.VOLUMETRIC_FLASK_32k.get(1)); + } + sIsAdded = true; + } + + @Override + public String getName() { + return "GT++ NEI Plugin"; + } + + @Override + public String getVersion() { + return "(1.12)"; + } } diff --git a/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java b/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java index 80589c6811..48c62173c0 100644 --- a/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java +++ b/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java @@ -1,7 +1,6 @@ package gtPlusPlus.nei; import cpw.mods.fml.common.event.FMLInterModComms; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import net.minecraft.nbt.NBTTagCompound; @@ -54,7 +53,7 @@ public class NEI_IMC_Sender { sendCatalyst("gtpp.recipe.treefarm", "gregtech:gt.blockmachines:836"); if (LoadedMods.AdvancedSolarPanel) { - sendHandler("gtpp.recipe.moleculartransformer", "AdvancedSolarPanel:BlockMolecularTransformer"); + sendHandler("gtpp.recipe.moleculartransformer", "AdvancedSolarPanel:BlockMolecularTransformer"); sendCatalyst("gtpp.recipe.moleculartransformer", "gregtech:gt.blockmachines:31072"); } @@ -76,19 +75,18 @@ public class NEI_IMC_Sender { sendCatalyst("crafting", "gregtech:gt.blockmachines:31097", -10); sendCatalyst("crafting", "gregtech:gt.blockmachines:31098", -10); -// if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { -// // Compound Fabricator -// sendCatalyst("gt.recipe.fakeAssemblylineProcess", "gregtech:gt.blockmachines:31024"); -// } + // if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + // // Compound Fabricator + // sendCatalyst("gt.recipe.fakeAssemblylineProcess", "gregtech:gt.blockmachines:31024"); + // } sendCatalyst("gt.recipe.complexfusionreactor", "gregtech:gt.blockmachines:965", -1); } - private static void sendHandler(String aRecipeName, String aBlock) { - sendHandler(aRecipeName, aBlock, 2); + sendHandler(aRecipeName, aBlock, 2); } - + private static void sendHandler(String aRecipeName, String aBlock, int aRecipesPerPage) { NBTTagCompound aNBT = new NBTTagCompound(); aNBT.setString("handler", aRecipeName); diff --git a/src/main/java/gtPlusPlus/nei/handlers/NeiTextureHandler.java b/src/main/java/gtPlusPlus/nei/handlers/NeiTextureHandler.java index 30c159ca93..1da2c7145c 100644 --- a/src/main/java/gtPlusPlus/nei/handlers/NeiTextureHandler.java +++ b/src/main/java/gtPlusPlus/nei/handlers/NeiTextureHandler.java @@ -10,20 +10,19 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; - /** * Based on crazypants.enderio.gui.IconEIO - * + * * @author Original EIO Author * * This is free and unencumbered software released into the public * domain. - * + * * Anyone is free to copy, modify, publish, use, compile, sell, or * distribute this software, either in source code form or as a compiled * binary, for any purpose, commercial or non-commercial, and by any * means. - * + * * In jurisdictions that recognize copyright laws, the author or authors * of this software dedicate any and all copyright interest in the * software to the public domain. We make this dedication for the @@ -31,7 +30,7 @@ import org.lwjgl.opengl.GL11; * successors. We intend this dedication to be an overt act of * relinquishment in perpetuity of all present and future rights to this * software under copyright law. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -39,7 +38,7 @@ import org.lwjgl.opengl.GL11; * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * * For more information, please refer to <http://unlicense.org/> * * https://github.com/SleepyTrousers/EnderIO/blob/release/1.7.10/2.2/src/main/java/crazypants/render/RenderUtil.java @@ -47,118 +46,120 @@ import org.lwjgl.opengl.GL11; */ public final class NeiTextureHandler { - public static final NeiTextureHandler RECIPE = new NeiTextureHandler(16, 132, 16, 16); - public static final NeiTextureHandler RECIPE_BUTTON = new NeiTextureHandler(128, 116, 24, 24); - - public final double minU; - public final double maxU; - public final double minV; - public final double maxV; - public final double width; - public final double height; - - public static final ResourceLocation TEXTURE = new ResourceLocation(CORE.MODID + ":textures/gui/nei/widgets.png"); - - public NeiTextureHandler(int x, int y) { - this(x, y, 16, 16); - } - - public NeiTextureHandler(int x, int y, int width, int height) { - this((double) width, (double) height, (double) ((float) (0.00390625D * (double) x)), - (double) ((float) (0.00390625D * (double) (x + width))), (double) ((float) (0.00390625D * (double) y)), - (double) ((float) (0.00390625D * (double) (y + height)))); - } - - public NeiTextureHandler(double width, double height, double minU, double maxU, double minV, double maxV) { - this.width = width; - this.height = height; - this.minU = minU; - this.maxU = maxU; - this.minV = minV; - this.maxV = maxV; - } - - public void renderIcon(double x, double y) { - this.renderIcon(x, y, this.width, this.height, 0.0D, false); - } - - public void renderIcon(double x, double y, boolean doDraw) { - this.renderIcon(x, y, this.width, this.height, 0.0D, doDraw); - } - - public void renderIcon(double x, double y, double width, double height, double zLevel, boolean doDraw) { - this.renderIcon(x, y, width, height, zLevel, doDraw, false); - } - - public void renderIcon(double x, double y, double width, double height, double zLevel, boolean doDraw, - boolean flipY) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - Tessellator tessellator = Tessellator.instance; - if (doDraw) { - bindTexture(TEXTURE); - tessellator.startDrawingQuads(); - } - - if (flipY) { - tessellator.addVertexWithUV(x, y + height, zLevel, this.minU, this.minV); - tessellator.addVertexWithUV(x + width, y + height, zLevel, this.maxU, this.minV); - tessellator.addVertexWithUV(x + width, y + 0.0D, zLevel, this.maxU, this.maxV); - tessellator.addVertexWithUV(x, y + 0.0D, zLevel, this.minU, this.maxV); - } else { - tessellator.addVertexWithUV(x, y + height, zLevel, this.minU, this.maxV); - tessellator.addVertexWithUV(x + width, y + height, zLevel, this.maxU, this.maxV); - tessellator.addVertexWithUV(x + width, y + 0.0D, zLevel, this.maxU, this.minV); - tessellator.addVertexWithUV(x, y + 0.0D, zLevel, this.minU, this.minV); - } - - if (doDraw) { - tessellator.draw(); - } - - } - - public static final ResourceLocation BLOCK_TEX; - public static final ResourceLocation ITEM_TEX; - public static final ResourceLocation GLINT_TEX; - public static int BRIGHTNESS_MAX; - - static { - BLOCK_TEX = TextureMap.locationBlocksTexture; - ITEM_TEX = TextureMap.locationItemsTexture; - GLINT_TEX = new ResourceLocation("textures/misc/enchanted_item_glint.png"); - BRIGHTNESS_MAX = 15728880; - } - - public static TextureManager engine() { - return Minecraft.getMinecraft().renderEngine; - } - - public static void bindItemTexture(ItemStack stack) { - engine().bindTexture(stack.getItemSpriteNumber() == 0 ? BLOCK_TEX : ITEM_TEX); - } - - public static void bindItemTexture() { - engine().bindTexture(ITEM_TEX); - } - - public static void bindBlockTexture() { - engine().bindTexture(BLOCK_TEX); - } - - public static void bindGlintTexture() { - engine().bindTexture(BLOCK_TEX); - } - - public static void bindTexture(String string) { - engine().bindTexture(new ResourceLocation(string)); - } - - public static void bindTexture(ResourceLocation tex) { - engine().bindTexture(tex); - } - - public static FontRenderer fontRenderer() { - return Minecraft.getMinecraft().fontRenderer; - } - -}
\ No newline at end of file + public static final NeiTextureHandler RECIPE = new NeiTextureHandler(16, 132, 16, 16); + public static final NeiTextureHandler RECIPE_BUTTON = new NeiTextureHandler(128, 116, 24, 24); + + public final double minU; + public final double maxU; + public final double minV; + public final double maxV; + public final double width; + public final double height; + + public static final ResourceLocation TEXTURE = new ResourceLocation(CORE.MODID + ":textures/gui/nei/widgets.png"); + + public NeiTextureHandler(int x, int y) { + this(x, y, 16, 16); + } + + public NeiTextureHandler(int x, int y, int width, int height) { + this( + (double) width, + (double) height, + (double) ((float) (0.00390625D * (double) x)), + (double) ((float) (0.00390625D * (double) (x + width))), + (double) ((float) (0.00390625D * (double) y)), + (double) ((float) (0.00390625D * (double) (y + height)))); + } + + public NeiTextureHandler(double width, double height, double minU, double maxU, double minV, double maxV) { + this.width = width; + this.height = height; + this.minU = minU; + this.maxU = maxU; + this.minV = minV; + this.maxV = maxV; + } + + public void renderIcon(double x, double y) { + this.renderIcon(x, y, this.width, this.height, 0.0D, false); + } + + public void renderIcon(double x, double y, boolean doDraw) { + this.renderIcon(x, y, this.width, this.height, 0.0D, doDraw); + } + + public void renderIcon(double x, double y, double width, double height, double zLevel, boolean doDraw) { + this.renderIcon(x, y, width, height, zLevel, doDraw, false); + } + + public void renderIcon( + double x, double y, double width, double height, double zLevel, boolean doDraw, boolean flipY) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + Tessellator tessellator = Tessellator.instance; + if (doDraw) { + bindTexture(TEXTURE); + tessellator.startDrawingQuads(); + } + + if (flipY) { + tessellator.addVertexWithUV(x, y + height, zLevel, this.minU, this.minV); + tessellator.addVertexWithUV(x + width, y + height, zLevel, this.maxU, this.minV); + tessellator.addVertexWithUV(x + width, y + 0.0D, zLevel, this.maxU, this.maxV); + tessellator.addVertexWithUV(x, y + 0.0D, zLevel, this.minU, this.maxV); + } else { + tessellator.addVertexWithUV(x, y + height, zLevel, this.minU, this.maxV); + tessellator.addVertexWithUV(x + width, y + height, zLevel, this.maxU, this.maxV); + tessellator.addVertexWithUV(x + width, y + 0.0D, zLevel, this.maxU, this.minV); + tessellator.addVertexWithUV(x, y + 0.0D, zLevel, this.minU, this.minV); + } + + if (doDraw) { + tessellator.draw(); + } + } + + public static final ResourceLocation BLOCK_TEX; + public static final ResourceLocation ITEM_TEX; + public static final ResourceLocation GLINT_TEX; + public static int BRIGHTNESS_MAX; + + static { + BLOCK_TEX = TextureMap.locationBlocksTexture; + ITEM_TEX = TextureMap.locationItemsTexture; + GLINT_TEX = new ResourceLocation("textures/misc/enchanted_item_glint.png"); + BRIGHTNESS_MAX = 15728880; + } + + public static TextureManager engine() { + return Minecraft.getMinecraft().renderEngine; + } + + public static void bindItemTexture(ItemStack stack) { + engine().bindTexture(stack.getItemSpriteNumber() == 0 ? BLOCK_TEX : ITEM_TEX); + } + + public static void bindItemTexture() { + engine().bindTexture(ITEM_TEX); + } + + public static void bindBlockTexture() { + engine().bindTexture(BLOCK_TEX); + } + + public static void bindGlintTexture() { + engine().bindTexture(BLOCK_TEX); + } + + public static void bindTexture(String string) { + engine().bindTexture(new ResourceLocation(string)); + } + + public static void bindTexture(ResourceLocation tex) { + engine().bindTexture(tex); + } + + public static FontRenderer fontRenderer() { + return Minecraft.getMinecraft().fontRenderer; + } +} |