diff options
Diffstat (limited to 'src')
12 files changed, 387 insertions, 349 deletions
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 28ecd5063c..7b52bd44c6 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -10,8 +10,6 @@ import org.apache.logging.log4j.Logger; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; -import java.util.HashSet; - @Mod(modid = GTNEIOrePlugin.MODID, name = GTNEIOrePlugin.NAME, version = GTNEIOrePlugin.VERSION, dependencies = "required-after:gregtech;required-after:NotEnoughItems") public class GTNEIOrePlugin { public static final String MODID = "GRADLETOKEN_MODID"; @@ -21,9 +19,8 @@ public class GTNEIOrePlugin { public static boolean csv = false; public static String CSVname; public static String CSVnameSmall; - public static HashSet OreV = new HashSet(); - public static boolean hideBackground = true; public static boolean toolTips = true; + public static int maxTooltipLines = 11; @Mod.Instance(MODID) public static GTNEIOrePlugin instance; @@ -33,8 +30,8 @@ public class GTNEIOrePlugin { csv = c.tConfig.getBoolean("print csv", "ALL", false, "princsv, you need apache commons collections to be injected in the minecraft jar."); CSVname = c.tConfig.getString("CSV_name", "ALL", event.getModConfigurationDirectory() + "/GTNH-Oresheet.csv", "rename the oresheet here, it will appear in /config"); CSVnameSmall= c.tConfig.getString("CSV_name_for_Small_Ore_Sheet", "ALL", event.getModConfigurationDirectory() + "/GTNH-Small-Ores-Sheet.csv", "rename the oresheet here, it will appear in /config"); - hideBackground = c.tConfig.getBoolean("Hide Background", "ALL", true, "Hides the Background when the tooltip for the Dimensions is rendered"); - toolTips = c.tConfig.getBoolean("DimTooltip", "ALL", true, "Activates Dimensison Tooltips"); + toolTips = c.tConfig.getBoolean("DimTooltip", "ALL", true, "Activates Dimension Tooltips"); + maxTooltipLines = c.tConfig.getInt("MaxToolTipLines", "ALL", 11, 1, Integer.MAX_VALUE, "Maximum number of lines the dimension names tooltip can have before it wraps around."); c.save(); } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java index 8283b3b263..ee76cff2d2 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java @@ -6,8 +6,6 @@ import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5SmallOreStat; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; -//import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5AsteroidStat; - public class NEIPluginConfig implements IConfigureNEI { @Override @@ -23,12 +21,9 @@ public class NEIPluginConfig implements IConfigureNEI { @Override public void loadConfig() { PluginGT5VeinStat pluginVeinStat = new PluginGT5VeinStat(); - //PluginGT5AsteroidStat pluginAsteriodStat = new PluginGT5AsteroidStat(); PluginGT5SmallOreStat pluginSmallOreStat = new PluginGT5SmallOreStat(); API.registerRecipeHandler(pluginVeinStat); API.registerUsageHandler(pluginVeinStat); - //API.registerRecipeHandler(pluginAsteriodStat); - //API.registerUsageHandler(pluginAsteriodStat); API.registerRecipeHandler(pluginSmallOreStat); API.registerUsageHandler(pluginSmallOreStat); } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java index 9186eddcbd..da3947fee8 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java @@ -7,7 +7,7 @@ import net.minecraft.util.EnumChatFormatting; import java.awt.*; -public class PluginBase extends TemplateRecipeHandler { +public abstract class PluginBase extends TemplateRecipeHandler { @Override public int recipiesPerPage() { @@ -30,19 +30,7 @@ public class PluginBase extends TemplateRecipeHandler { transferRects.add(new RecipeTransferRect(new Rectangle(getGuiWidth() - stringLength - 3, 5, stringLength, 9), getOutputId())); } - public String getOutputId() { - return null; - } - - public String getWorldNameTranslated(boolean genOverworld) { - String worldNameTranslated = ""; - if (genOverworld) { - if (!worldNameTranslated.isEmpty()) - worldNameTranslated += ", "; - worldNameTranslated += I18n.format("gtnop.world.overworld.name"); - } - return worldNameTranslated; - } + public abstract String getOutputId(); public int getGuiWidth() { return 166; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java deleted file mode 100644 index b6c676dc70..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java +++ /dev/null @@ -1,143 +0,0 @@ -/*package pers.gwyog.gtneioreplugin.plugin.gregtech5; - -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.List; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect; -import gregtech.api.GregTech_API; -import gregtech.api.util.GT_LanguageManager; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat.CachedVeinStatRecipe; -import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; -import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; -import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; - -public class PluginGT5AsteroidStat extends PluginGT5Base { - - public class CachedAsteroidStatRecipe extends CachedRecipe { - public String veinName; - public PositionedStack positionedStackPrimary; - public PositionedStack positionedStackSecondary; - public PositionedStack positionedStackBetween; - public PositionedStack positionedStackSporadic; - - public CachedAsteroidStatRecipe(String veinName, ItemStack stackListPrimary, ItemStack stackListSecondary, - ItemStack stackListBetween, ItemStack stackListSporadic) { - this.veinName = veinName; - positionedStackPrimary = new PositionedStack(stackListPrimary, 2, 0); - positionedStackSecondary = new PositionedStack(stackListSecondary, 22, 0); - positionedStackBetween = new PositionedStack(stackListBetween, 42, 0); - positionedStackSporadic = new PositionedStack(stackListSporadic, 62, 0); - } - - @Override - public List<PositionedStack> getIngredients() { - List<PositionedStack> ingredientsList = new ArrayList<PositionedStack>(); - ingredientsList.add(positionedStackPrimary); - ingredientsList.add(positionedStackSecondary); - ingredientsList.add(positionedStackBetween); - ingredientsList.add(positionedStackSporadic); - return ingredientsList; - } - - @Override - public PositionedStack getResult() { - return null; - } - - } - - @Override - public void drawExtras(int recipe) { - CachedAsteroidStatRecipe crecipe = (CachedAsteroidStatRecipe) this.arecipes.get(recipe); - OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedAsteroidName(oreLayer.veinName), 2, 18, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidPrimary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.Meta[0])), 2, 31, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSecondary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.Meta[1])), 2, 44, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidBetween") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.Meta[2])), 2, 57, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSporadic") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.Meta[3])), 2, 70, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genEndAsteroid, oreLayer.genGCAsteroid), 2, 83, 0x404040, false); - GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); - } - - public String getWorldNameTranslated(boolean genEndAsteroid, boolean genGCAsteroid) { - String worldNameTranslatedAsteroid = ""; - if (genEndAsteroid) { - if (!worldNameTranslatedAsteroid.isEmpty()) - worldNameTranslatedAsteroid += ", "; - worldNameTranslatedAsteroid += I18n.format("gtnop.world.end.name"); - } - if (genGCAsteroid) { - if (!worldNameTranslatedAsteroid.isEmpty()) - worldNameTranslatedAsteroid += ", "; - worldNameTranslatedAsteroid += I18n.format("gtnop.world.asteroid.name"); - } - return worldNameTranslatedAsteroid; - } - - public String getLocalizedAsteroidName(String unlocalizedName) { - if (unlocalizedName.startsWith("ore.mix.custom.")) - return I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.asteroid.name") + unlocalizedName.substring(15); - else - return I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.asteroid.name"); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals(getOutputId())) { - OreLayerWrapper oreLayerWrapper; - for (String veinName: GT5OreLayerHelper.mapOreLayerWrapper.keySet()) { - oreLayerWrapper = GT5OreLayerHelper.mapOreLayerWrapper.get(veinName); - if (oreLayerWrapper.genEndAsteroid || oreLayerWrapper.genGCAsteroid) { - ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[0]+2000); - ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[1]+2000); - ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[2]+2000); - ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[3]+2000); - this.arecipes.add(new CachedAsteroidStatRecipe(veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); - } - } - } - else - super.loadCraftingRecipes(outputId, results); - } - - @Override - public void loadCraftingRecipes(ItemStack stack) { - if (stack.getUnlocalizedName().startsWith("gt.blockores")) { - if (stack.getItemDamage()>16000) { - super.loadCraftingRecipes(stack); - return; - } - short baseMeta = (short)(stack.getItemDamage() % 1000); - for (OreLayerWrapper worldGen: GT5OreLayerHelper.mapOreLayerWrapper.values()) { - if (worldGen.Meta[0] == baseMeta || worldGen.Meta[1] == baseMeta || worldGen.Meta[2] == baseMeta || worldGen.Meta[3] == baseMeta) { - if (worldGen.genEndAsteroid || worldGen.genGCAsteroid) { - ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[0]+2000); - ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[1]+2000); - ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[2]+2000); - ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[3]+2000); - this.arecipes.add(new CachedAsteroidStatRecipe(worldGen.veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); - } - } - } - } - else - super.loadCraftingRecipes(stack); - } - - @Override - public String getOutputId() { - return "GTOrePluginAsteroid"; - } - - @Override - public String getRecipeName() { - return I18n.format("gtnop.gui.asteroidStat.name"); - } -} -*/
\ No newline at end of file diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java index 00107e12c1..6bc9db3e2c 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java @@ -1,37 +1,28 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; import codechicken.lib.gui.GuiDraw; +import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.recipe.GuiRecipe; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.util.GT_LanguageManager; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.resources.I18n; +import net.minecraft.util.EnumChatFormatting; import pers.gwyog.gtneioreplugin.plugin.PluginBase; import pers.gwyog.gtneioreplugin.util.DimensionHelper; +import java.awt.Point; +import java.awt.Rectangle; import java.util.List; -import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.hideBackground; import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.toolTips; -public class PluginGT5Base extends PluginBase { - - protected boolean ttDisplayed = false; +public abstract class PluginGT5Base extends PluginBase { protected static String getLocalizedNameForItem(Materials aMaterial, String aFormat) { return String.format(aFormat.replace("%s", "%temp").replace("%material", "%s"), aMaterial.mLocalizedName).replace("%temp", "%s"); } - protected static int calculateMaxW(List L) { - int w = 0; - FontRenderer font = GuiDraw.fontRenderer; - for (int i = 0; i < L.size(); ++i) { - String s = (String) L.get(i); - w = Math.max(font.getStringWidth(s), w); - } - return w; - } - protected static String getLocalizedNameForItem(String aFormat, int aMaterialID) { if (aMaterialID >= 0 && aMaterialID < 1000) { Materials aMaterial = GregTech_API.sGeneratedMaterials[aMaterialID]; @@ -54,25 +45,51 @@ public class PluginGT5Base extends PluginBase { return "gt.blockores." + index + ".name"; } - protected void drawToolTip(String sDimNames) { - if (toolTips) { - ttDisplayed = false; - if (GuiDraw.getMousePosition().y > (int) (Minecraft.getMinecraft().currentScreen.height * 0.6f) && GuiDraw.getMousePosition().y < (int) (Minecraft.getMinecraft().currentScreen.height * 0.8f)) { - List<String> dims = DimensionHelper.convertCondensedStringToToolTip(sDimNames); - int w = calculateMaxW(dims); - int x = GuiDraw.getMousePosition().x > Minecraft.getMinecraft().currentScreen.width / 2 ? this.getGuiWidth() - w - 8 : 0; - if (dims.size() > 10) { - List<String> dims2 = dims.subList(11, dims.size()); - int w2 = calculateMaxW(dims2); - dims = dims.subList(0, 11); - w = calculateMaxW(dims); - GuiDraw.drawMultilineTip(x == 0 ? 16 + w : x - (w2 + 8), 108 - (dims.size() * 8), dims2); - } - GuiDraw.drawMultilineTip(x, 108 - (dims.size() * 8), dims); - - ttDisplayed = hideBackground; + /** + * Add lines to the current tooltip if appropriate + * + * @param gui An instance of the currentscreen + * @param currenttip The current tooltip, will contain item name and info + * @param recipe The recipe index being handled + * @return The modified tooltip. DO NOT return null + */ + @Override + public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe) { + if (toolTips && GuiContainerManager.shouldShowTooltip(gui) && currenttip.size() == 0) { + String dimNames = getDimensionNames(recipe); + Rectangle dimRect = getDimensionNamesRect(gui, recipe , dimNames); + Point mousePos = GuiDraw.getMousePosition(); + + + if (dimRect.contains(mousePos.x, mousePos.y)) { + List<String> dims = DimensionHelper.convertCondensedStringToToolTip(dimNames); + currenttip.addAll(dims); } } + + return super.handleTooltip(gui, currenttip, recipe); + } + + /** + * The dimension names for a given recipe index + * + * @param The recipe index being handled + * @return A CSV string of dimension name abbreviations + */ + protected abstract String getDimensionNames(int recipe); + + /** + * Produce a rectangle covering the area of displayed dimension names + * + * @param gui An instance of the currentscreen + * @param recipe The recipe index being handled + * @param dimNames Dimension names to produce a rectangle for + * @return Rectangle area of dimension names + */ + protected Rectangle getDimensionNamesRect(GuiRecipe gui, int recipe, String dimNames) { + int height = dimNames.length() > 70 ? 30 : (dimNames.length() > 36 ? 20 : 10); + Point offset = gui.getRecipePosition(recipe); + return new Rectangle(gui.guiLeft + offset.x + 2, gui.guiTop + offset.y + 110, gui.xSize - 9, height ); } protected int getMaximumMaterialIndex(short meta, boolean smallOre) { @@ -85,4 +102,32 @@ public class PluginGT5Base extends PluginBase { return 5; } + /** + * Draw the dimension header and the dimension names over up to 3 lines + * + * @param dimNames A CSV string of dimension name abbreviations + */ + protected void drawDimNames(String dimNames) { + GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false); + + if (dimNames.length() > 36) { + GuiDraw.drawString(I18n.format("") + dimNames.substring(0, 36), 2, 110, 0x404040, false); + if (dimNames.length() > 70) { + GuiDraw.drawString(I18n.format("") + dimNames.substring(36, 70), 2, 120, 0x404040, false); + GuiDraw.drawString(I18n.format("") + dimNames.substring(70, dimNames.length() - 1), 2, 130, 0x404040, false); + } else + { + GuiDraw.drawString(I18n.format("") + dimNames.substring(36, dimNames.length() - 1), 2, 120, 0x404040, false); + } + } else{ + GuiDraw.drawString(I18n.format("") + dimNames.substring(0, dimNames.length() - 1), 2, 110, 0x404040, false); + } + } + + /** + * Draw the "see all recipes" transfer label + */ + protected void drawSeeAllRecipesLabel() { + GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth() - 3, 5, 0x404040, false); + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java index 4a8e2174e3..70346889e9 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java @@ -7,7 +7,6 @@ import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_OreDictUnificator; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper.OreSmallWrapper; @@ -22,25 +21,15 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { OreSmallWrapper oreSmall = GT5OreSmallHelper.mapOreSmallWrapper.get(crecipe.oreGenName); String sDimNames = GT5OreSmallHelper.bufferedDims.get(oreSmall); GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + getGTOreLocalizedName((short) (oreSmall.oreMeta + 16000)), 2, 18, 0x404040, false); - drawToolTip(sDimNames); - if (!ttDisplayed) { - GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreSmall.worldGenHeightRange, 2, 31, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.amount") + ": " + oreSmall.amountPerChunk, 2, 44, 0x404040, false); - // GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreSmall.genOverworld, oreSmall.genNether, oreSmall.genEnd, oreSmall.genMoon, oreSmall.genMars), 2, 57, 0x404040, false); - // if (GT5OreSmallHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gtnop.gui.nei.restrictBiome") + ": " + getBiomeTranslated(oreSmall.restrictBiome), 2, 70, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.chanceDrops") + ": ", 2, 83 + getRestrictBiomeOffset(), 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 110, 0x404040, false); - if (sDimNames.length() > 36) { - GuiDraw.drawString(I18n.format("") + sDimNames.substring(0, 36), 2, 120, 0x404040, false); - if (sDimNames.length() > 70) { - GuiDraw.drawString(I18n.format("") + sDimNames.substring(36, 70), 2, 130, 0x404040, false); - GuiDraw.drawString(I18n.format("") + sDimNames.substring(70, sDimNames.length() - 1), 2, 140, 0x404040, false); - } else - GuiDraw.drawString(I18n.format("") + sDimNames.substring(36, sDimNames.length() - 1), 2, 130, 0x404040, false); - } else - GuiDraw.drawString(I18n.format("") + sDimNames.substring(0, sDimNames.length() - 1), 2, 120, 0x404040, false); - } - GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth() - 3, 5, 0x404040, false); + + GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreSmall.worldGenHeightRange, 2, 31, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.amount") + ": " + oreSmall.amountPerChunk, 2, 44, 0x404040, false); + // if (GT5OreSmallHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gtnop.gui.nei.restrictBiome") + ": " + getBiomeTranslated(oreSmall.restrictBiome), 2, 70, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.chanceDrops") + ": ", 2, 83 + getRestrictBiomeOffset(), 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false); + + drawDimNames(sDimNames); + drawSeeAllRecipesLabel(); } public int getRestrictBiomeOffset() { @@ -104,6 +93,19 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { return I18n.format("gtnop.gui.smallOreStat.name"); } + /** + * The dimension names for a given recipe identifier + * + * @param recipe identifier + * @return A CSV string of dimension name abbreviations + */ + @Override + protected String getDimensionNames(int recipe) { + CachedOreSmallRecipe crecipe = (CachedOreSmallRecipe) this.arecipes.get(recipe); + OreSmallWrapper oreSmall = GT5OreSmallHelper.mapOreSmallWrapper.get(crecipe.oreGenName); + return GT5OreSmallHelper.bufferedDims.get(oreSmall); + } + public class CachedOreSmallRecipe extends CachedRecipe { public String oreGenName; public PositionedStack positionedStackOreSmall; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index c288aa72ca..8f8a01ef0a 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -6,7 +6,6 @@ import cpw.mods.fml.common.Loader; import gregtech.api.GregTech_API; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; @@ -17,6 +16,7 @@ import java.util.Set; public class PluginGT5VeinStat extends PluginGT5Base { + // Unused public static String[] getLocalizedVeinName(OreLayerWrapper oreLayer) { String unlocalizedName = oreLayer.veinName; if (unlocalizedName.startsWith("ore.mix.custom.")) @@ -25,6 +25,7 @@ public class PluginGT5VeinStat extends PluginGT5Base { return new String[]{I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.vein.name")}; } + // Unused public static String coustomVeinRenamer(OreLayerWrapper oreLayer) { Set<String> s = new HashSet<String>(); for (int i = 0; i < 4; i++) @@ -58,6 +59,7 @@ public class PluginGT5VeinStat extends PluginGT5Base { return weightedChance; }*/ + // Unused public static String[] get_Cnames(OreLayerWrapper oreLayer) { String[] splt = coustomVeinRenamer(oreLayer).split("\\s"); @@ -167,18 +169,8 @@ public class PluginGT5VeinStat extends PluginGT5Base { String sDimNames = GT5OreLayerHelper.bufferedDims.get(oreLayer); - /*if (getLocalizedVeinName(oreLayer).length>1) { - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[0], 2, 20, 0x404040, false); - if (getLocalizedVeinName(oreLayer).length>2) { - GuiDraw.drawString(I18n.format(getLocalizedVeinName(oreLayer)[1]), 2, 30, 0x404040, false); - GuiDraw.drawString(I18n.format(getLocalizedVeinName(oreLayer)[2]), 2, 40, 0x404040, false); - } - else - GuiDraw.drawString(I18n.format(getLocalizedVeinName(oreLayer)[1]), 2, 30, 0x404040, false); - } - else*/ if(Loader.isModLoaded("visualprospecting")) { - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format(oreLayer.veinName) + "" + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format(oreLayer.veinName) + " " + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); } else { if (getGTOreLocalizedName(oreLayer.Meta[0]).contains("Ore")) @@ -188,34 +180,23 @@ public class PluginGT5VeinStat extends PluginGT5Base { else GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]) + " " + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); } - - drawToolTip(sDimNames); - if (!ttDisplayed) { - GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]), 2, 50, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[1]), 2, 60, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]), 2, 50, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[2]), 2, 70, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[1]), 2, 60, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[3]), 2, 80, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[2]), 2, 70, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 90, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[3]), 2, 80, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + Integer.toString(oreLayer.randomWeight), 100, 90, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 90, 0x404040, false); + + GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + Integer.toString(oreLayer.randomWeight), 100, 90, 0x404040, false); + + drawDimNames(sDimNames); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false); - if (sDimNames.length() > 36) { - GuiDraw.drawString(I18n.format("") + sDimNames.substring(0, 36), 2, 110, 0x404040, false); - if (sDimNames.length() > 70) { - GuiDraw.drawString(I18n.format("") + sDimNames.substring(36, 70), 2, 120, 0x404040, false); - GuiDraw.drawString(I18n.format("") + sDimNames.substring(70, sDimNames.length() - 1), 2, 130, 0x404040, false); - } else - GuiDraw.drawString(I18n.format("") + sDimNames.substring(36, sDimNames.length() - 1), 2, 120, 0x404040, false); - } else - GuiDraw.drawString(I18n.format("") + sDimNames.substring(0, sDimNames.length() - 1), 2, 110, 0x404040, false); - } //if (GT5OreLayerHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gtnop.gui.nei.restrictBiome") + ": " + getBiomeTranslated(oreLayer.restrictBiome), 2, 122, 0x404040, false); - GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth() - 3, 5, 0x404040, false); + drawSeeAllRecipesLabel(); } @Override @@ -227,6 +208,19 @@ public class PluginGT5VeinStat extends PluginGT5Base { public String getRecipeName() { return I18n.format("gtnop.gui.veinStat.name"); } + + /** + * The dimension names for a given recipe identifier + * + * @param recipe identifier + * @return A CSV string of dimension name abbreviations + */ + @Override + protected String getDimensionNames(int recipe) { + CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe); + OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); + return GT5OreLayerHelper.bufferedDims.get(oreLayer); + } public class CachedVeinStatRecipe extends CachedRecipe { public String veinName; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index 427d8a8be8..fb422ed074 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -5,84 +5,104 @@ import java.util.HashMap; import java.util.List; import net.minecraft.client.resources.I18n; +import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.maxTooltipLines; + public class DimensionHelper { public static String[] DimName = { + // Non GC dimensions in progression order instead of alphabetical + "Overworld", + "Nether", + "Twilight", + "TheEnd", + "Vanilla_EndAsteroids", "EndAsteroid", + // T1 "GalacticraftCore_Moon", - "GalacticraftMars_Asteroids", + // T2 + "GalaxySpace_Deimos", "GalacticraftMars_Mars", - "GalaxySpace_BarnardC", - "GalaxySpace_BarnardE", - "GalaxySpace_BarnardF", + "GalaxySpace_Phobos", + // T3 + "GalacticraftMars_Asteroids", "GalaxySpace_Callisto", - "GalaxySpace_CentauriA", "GalaxySpace_Ceres", - "GalaxySpace_Deimos", - "GalaxySpace_Enceladus", "GalaxySpace_Europa", "GalaxySpace_Ganymede", - "GalaxySpace_Haumea", + // T4 "GalaxySpace_Io", - "GalaxySpace_Kuiperbelt", - "GalaxySpace_MakeMake", "GalaxySpace_Mercury", + "GalaxySpace_Venus", + // T5 + "GalaxySpace_Enceladus", "GalaxySpace_Miranda", "GalaxySpace_Oberon", - "GalaxySpace_Phobos", - "GalaxySpace_Pluto", - "GalaxySpace_Proteus", - "GalaxySpace_TcetiE", "GalaxySpace_Titan", + // T6 + "GalaxySpace_Proteus", "GalaxySpace_Triton", + // T7 + "GalaxySpace_Haumea", + "GalaxySpace_Kuiperbelt", + "GalaxySpace_MakeMake", + "GalaxySpace_Pluto", + // T8 + "GalaxySpace_BarnardC", + "GalaxySpace_BarnardE", + "GalaxySpace_BarnardF", + "GalaxySpace_CentauriA", + "GalaxySpace_TcetiE", + "Underdark", "GalaxySpace_VegaB", - "GalaxySpace_Venus", - "Nether", - "Overworld", - "TheEnd", - "Vanilla_EndAsteroids", - "Twilight", - "Underdark" }; public static String[] DimNameDisplayed = - {// first 2 letters if one word else 1 letter of every word, execpt capital letter in name, then 1rst + capital Moon = Mo, BarnardC = BC, EndAsteroid = EA - "EA", - "Mo", - "As", - "Ma", - "BC", - "BE", - "BF", - "Ca", - "CA", - "Ce", - "De", - "En", - "Eu", - "Ga", - "Ha", - "Io", - "KB", - "MM", - "Me", - "Mi", - "Ob", - "Ph", - "Pl", - "Pr", - "TE", - "Ti", - "Tr", - "VB", - "Ve", - "Ne", - "Ow", - "EN",//End = EN bc En = Encalus - "VA", |
