From afdf6a14f26cc451f36e5eea205188bdde72549c Mon Sep 17 00:00:00 2001 From: GWYOG Date: Fri, 4 Nov 2016 12:22:24 +0800 Subject: Remove the itemstack icons from unaccessible items on the gui --- .../java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java | 15 +++++++++++++++ .../gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java | 7 ++++--- .../pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java | 10 +++++----- 3 files changed, 24 insertions(+), 8 deletions(-) (limited to 'src/main') diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java index 789e4babf1..0fbe12a597 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java @@ -5,6 +5,7 @@ import java.awt.Rectangle; import codechicken.lib.gui.GuiDraw; import codechicken.nei.recipe.TemplateRecipeHandler; import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect; +import gregtech.api.util.GT_LanguageManager; import net.minecraft.client.resources.I18n; import net.minecraft.util.EnumChatFormatting; @@ -35,6 +36,20 @@ public class PluginBase extends TemplateRecipeHandler { return null; } + public int getMaximumMaterialIndex(short meta, boolean smallOre) { + int offset = smallOre? 16000: 0; + if (!getGTOreLocalizedName((short)(meta+offset+5000)).equals(getGTOreUnlocalizedName((short)(meta+offset+5000)))) + return 7; + else if (!getGTOreLocalizedName((short)(meta+offset+5000)).equals(getGTOreUnlocalizedName((short)(meta+offset+5000)))) + return 6; + else + return 5; + } + + public String getGTOreLocalizedName(short index) { + return GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)); + } + public String getGTOreUnlocalizedName(short index) { return "gt.blockores." + index + ".name"; } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java index c0e784d3d3..e68c9ac8ee 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java @@ -62,7 +62,7 @@ public class PluginSmallOreStat extends PluginBase { public void drawExtras(int recipe) { CachedSmallOreRecipe crecipe = (CachedSmallOreRecipe) this.arecipes.get(recipe); SmallOreWrapper smallOre = GTSmallOreHelper.mapSmallOreWrapper.get(crecipe.oreGenName); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName((short)(smallOre.oreMeta+16000))), 2, 18, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + getGTOreLocalizedName((short)(smallOre.oreMeta+16000)), 2, 18, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + smallOre.worldGenHeightRange, 2, 31, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.amount") + ": " + smallOre.amountPerChunk, 2, 44, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(smallOre.genOverworld, smallOre.genNether, smallOre.genEnd, smallOre.genMoon, smallOre.genMars), 2, 57, 0x404040, false); @@ -95,10 +95,11 @@ public class PluginSmallOreStat extends PluginBase { for (SmallOreWrapper smallOreWorldGen: GTSmallOreHelper.mapSmallOreWrapper.values()) { if (smallOreWorldGen.oreMeta == baseMeta) { List stackList = new ArrayList(); - for (int i=0;i<7;i++) + int maximumIndex = getMaximumMaterialIndex(baseMeta, true); + for (int i=0;i materialDustStackList = new ArrayList(); - for (int i=0;i<7;i++) + for (int i=0;i stackListSecondary = new ArrayList(); List stackListBetween = new ArrayList(); List stackListSporadic = new ArrayList(); - for (int i=0;i<7;i++) { + for (int i=0;i