From cea5f224fa01ecac335da669811be1a701c94ace Mon Sep 17 00:00:00 2001 From: mezz Date: Sat, 13 Sep 2014 23:30:50 -0700 Subject: [PATCH] Fix #186. Improve the Beealyzer and Treealyzer Mutations pages --- .../java/forestry/core/gui/GuiAlyzer.java | 88 +++++++------------ .../java/forestry/core/gui/GuiForestry.java | 2 +- 2 files changed, 32 insertions(+), 58 deletions(-) diff --git a/src/main/java/forestry/core/gui/GuiAlyzer.java b/src/main/java/forestry/core/gui/GuiAlyzer.java index 5ec00934f..e082aeb95 100755 --- a/src/main/java/forestry/core/gui/GuiAlyzer.java +++ b/src/main/java/forestry/core/gui/GuiAlyzer.java @@ -130,6 +130,12 @@ public abstract class GuiAlyzer extends GuiForestry { } } + @Override + protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) { + super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); + widgetManager.clear(); + } + protected void drawAnalyticsOverview() { startPage(); @@ -235,10 +241,12 @@ public abstract class GuiAlyzer extends GuiForestry { protected void drawAnalyticsPage4(IIndividual individual) { + float factor = this.factor; + this.setFactor(1.0f); + startPage(COLUMN_0, COLUMN_1, COLUMN_2); drawLine(StringUtil.localize("gui.beealyzer.mutations") + ":", COLUMN_0); newLine(); - newLine(); RenderHelper.enableGUIStandardItemLighting(); @@ -266,7 +274,7 @@ public abstract class GuiAlyzer extends GuiForestry { } x += columnWidth; - if (x > columnWidth * 4) { + if (x >= columnWidth * 4) { x = 0; newLine(); newLine(); @@ -274,73 +282,40 @@ public abstract class GuiAlyzer extends GuiForestry { } endPage(); + + this.setFactor(factor); } protected void drawMutationInfo(IMutation combination, IAllele species, int x) { - drawItemStack(iconStacks.get(combination.getPartner(species).getUID()), - adjustToFactor(guiLeft) + x, adjustToFactor(guiTop) + getLineY()); - /* - itemRenderer.renderItemIntoGUI(fontRendererObj, mc.renderEngine, iconStacks.get(combination.getPartner(species).getUID()), adjustToFactor(guiLeft) + x, - adjustToFactor(guiTop) + getLineY()); - itemRenderer.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, iconStacks.get(combination.getPartner(species).getUID()), adjustToFactor(guiLeft) - + x, adjustToFactor(guiTop) + getLineY()); - */ + ItemStack partnerBee = iconStacks.get(combination.getPartner(species).getUID()); + widgetManager.add(new ItemStackWidget(x, getLineY(), partnerBee)); + + drawProbabilityArrow(combination.getBaseChance(), adjustToFactor(guiLeft) + x + 18, adjustToFactor(guiTop) + getLineY() + 4); IAllele result = combination.getTemplate()[EnumBeeChromosome.SPECIES.ordinal()]; - - drawItemStack(iconStacks.get(result.getUID()), - adjustToFactor(guiLeft) + x + 33, adjustToFactor(guiTop) + getLineY()); - /* - itemRenderer.renderItemIntoGUI(fontRendererObj, mc.renderEngine, iconStacks.get(result.getUID()), adjustToFactor(guiLeft) + x + 33, adjustToFactor(guiTop) - + getLineY()); - itemRenderer.renderItemOverlayIntoGUI(fontRendererObj, mc.renderEngine, iconStacks.get(result.getUID()), adjustToFactor(guiLeft) + x + 33, - adjustToFactor(guiTop) + getLineY()); - */ - - int line = 247; - int column = 100; - - switch (EnumMutateChance.rateChance(combination.getBaseChance())) { - case HIGHEST: - column = 100; - break; - case HIGHER: - column = 100 + 15; - break; - case HIGH: - column = 100 + 15 * 2; - break; - case NORMAL: - column = 100 + 15 * 3; - break; - case LOW: - column = 100 + 15 * 4; - break; - case LOWEST: - column = 100 + 15 * 5; - default: - break; - } - - Proxies.common.bindTexture(textureFile); - drawTexturedModalRect(adjustToFactor(guiLeft) + x + 18, adjustToFactor(guiTop) + getLineY() + 4, column, line, 15, 9); - + ItemStack resultBee = iconStacks.get(result.getUID()); + widgetManager.add(new ItemStackWidget(x + 33, getLineY(), resultBee)); } protected void drawUnknownMutation(IMutation combination, IAllele species, int x) { - // Question marks - Proxies.common.bindTexture(textureFile); - drawTexturedModalRect(adjustToFactor(guiLeft) + x, adjustToFactor(guiTop) + getLineY(), 78, 240, 16, 16); + drawQuestionMark(adjustToFactor(guiLeft) + x, adjustToFactor(guiTop) + getLineY()); - Proxies.common.bindTexture(textureFile); - drawTexturedModalRect(adjustToFactor(guiLeft) + x + 32, adjustToFactor(guiTop) + getLineY(), 78, 240, 16, 16); + drawProbabilityArrow(combination.getBaseChance(), adjustToFactor(guiLeft) + x + 18, adjustToFactor(guiTop) + getLineY() + 4); + drawQuestionMark(adjustToFactor(guiLeft) + x + 32, adjustToFactor(guiTop) + getLineY()); + } + + protected void drawQuestionMark(int x, int y) { + Proxies.common.bindTexture(textureFile); + drawTexturedModalRect(x, y, 78, 240, 16, 16); + } + + protected void drawProbabilityArrow(float chance, int x, int y) { int line = 247; int column = 100; - - switch (EnumMutateChance.rateChance(combination.getBaseChance())) { + switch (EnumMutateChance.rateChance(chance)) { case HIGHEST: column = 100; break; @@ -364,8 +339,7 @@ public abstract class GuiAlyzer extends GuiForestry { // Probability arrow Proxies.common.bindTexture(textureFile); - drawTexturedModalRect(adjustToFactor(guiLeft) + x + 18, adjustToFactor(guiTop) + getLineY() + 4, column, line, 15, 9); - + drawTexturedModalRect(x, y, column, line, 15, 9); } protected void drawToleranceInfo(EnumTolerance tolerance, int x, int textColor) { diff --git a/src/main/java/forestry/core/gui/GuiForestry.java b/src/main/java/forestry/core/gui/GuiForestry.java index e0bfda37b..0851bf031 100755 --- a/src/main/java/forestry/core/gui/GuiForestry.java +++ b/src/main/java/forestry/core/gui/GuiForestry.java @@ -549,7 +549,7 @@ public abstract class GuiForestry extends GuiContainer { public ItemStackWidget(int xPos, int yPos, ItemStack itemStack) { super(widgetManager, xPos, yPos); - IIcon icon = itemStack.getItem().getIconFromDamage(itemStack.getItemDamage()); + IIcon icon = itemStack.getItem().getIcon(itemStack, 0); this.width = icon.getIconWidth(); this.height = icon.getIconHeight();