mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 04:32:15 +00:00
Merge pull request #2616 from iTitus/updateNotificationIcon
Add update notification icon made by @gigaherz, closes #2582
This commit is contained in:
commit
1811d88266
6 files changed
+180
-28
No files matched your search
@@ -153,13 +153,14 @@ public class GuiModList extends GuiScreen
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
int slotHeight = 35;
|
||||
for (ModContainer mod : mods)
|
||||
{
|
||||
listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(mod.getName()) + 10);
|
||||
listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(mod.getVersion()) + 10);
|
||||
listWidth = Math.max(listWidth,getFontRenderer().getStringWidth(mod.getVersion()) + 5 + slotHeight);
|
||||
}
|
||||
listWidth = Math.min(listWidth, 150);
|
||||
this.modList = new GuiSlotModList(this, mods, listWidth);
|
||||
this.modList = new GuiSlotModList(this, mods, listWidth, slotHeight);
|
||||
|
||||
this.buttonList.add(new GuiButton(6, ((modList.right + this.width) / 2) - 100, this.height - 38, I18n.format("gui.done")));
|
||||
configModButton = new GuiButton(20, 10, this.height - 49, this.listWidth, 20, "Config");
|
||||
|
||||
@@ -14,8 +14,12 @@ package net.minecraftforge.fml.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StringUtils;
|
||||
import net.minecraftforge.common.ForgeVersion;
|
||||
import net.minecraftforge.common.ForgeVersion.CheckResult;
|
||||
@@ -29,12 +33,15 @@ import net.minecraftforge.fml.common.ModContainer;
|
||||
*/
|
||||
public class GuiSlotModList extends GuiScrollingList
|
||||
{
|
||||
|
||||
private static final ResourceLocation VERSION_CHECK_ICONS = new ResourceLocation("forge", "textures/gui/version_check_icons.png");
|
||||
|
||||
private GuiModList parent;
|
||||
private ArrayList<ModContainer> mods;
|
||||
|
||||
public GuiSlotModList(GuiModList parent, ArrayList<ModContainer> mods, int listWidth)
|
||||
public GuiSlotModList(GuiModList parent, ArrayList<ModContainer> mods, int listWidth, int slotHeight)
|
||||
{
|
||||
super(parent.getMinecraftInstance(), listWidth, parent.height, 32, parent.height - 88 + 4, 10, 35, parent.width, parent.height);
|
||||
super(parent.getMinecraftInstance(), listWidth, parent.height, 32, parent.height - 88 + 4, 10, slotHeight, parent.width, parent.height);
|
||||
this.parent = parent;
|
||||
this.mods = mods;
|
||||
}
|
||||
@@ -86,27 +93,23 @@ public class GuiSlotModList extends GuiScrollingList
|
||||
if (Loader.instance().getModState(mc) == ModState.DISABLED)
|
||||
{
|
||||
font.drawString(font.trimStringToWidth(name, listWidth - 10), this.left + 3 , top + 2, 0xFF2222);
|
||||
font.drawString(font.trimStringToWidth(version, listWidth - 10), this.left + 3 , top + 12, 0xFF2222);
|
||||
font.drawString(font.trimStringToWidth(version, listWidth - (5 + height)), this.left + 3 , top + 12, 0xFF2222);
|
||||
font.drawString(font.trimStringToWidth("DISABLED", listWidth - 10), this.left + 3 , top + 22, 0xFF2222);
|
||||
}
|
||||
else
|
||||
{
|
||||
font.drawString(font.trimStringToWidth(name, listWidth - 10), this.left + 3 , top + 2, 0xFFFFFF);
|
||||
font.drawString(font.trimStringToWidth(version, listWidth - 10), this.left + 3 , top + 12, 0xCCCCCC);
|
||||
font.drawString(font.trimStringToWidth(version, listWidth - (5 + height)), this.left + 3 , top + 12, 0xCCCCCC);
|
||||
font.drawString(font.trimStringToWidth(mc.getMetadata() != null ? mc.getMetadata().getChildModCountString() : "Metadata not found", listWidth - 10), this.left + 3 , top + 22, 0xCCCCCC);
|
||||
|
||||
switch(vercheck.status) //TODO: Change to icons?
|
||||
if (vercheck.status.shouldDraw())
|
||||
{
|
||||
case BETA_OUTDATED:
|
||||
case OUTDATED:
|
||||
font.drawString("U", right - font.getCharWidth('U') - 1, top+height-font.FONT_HEIGHT+2, 0x22FF22);
|
||||
break;
|
||||
case AHEAD:
|
||||
case BETA:
|
||||
case FAILED:
|
||||
case PENDING:
|
||||
case UP_TO_DATE:
|
||||
break;
|
||||
//TODO: Consider adding more icons for visualization
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(VERSION_CHECK_ICONS);
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
GlStateManager.pushMatrix();
|
||||
Gui.drawModalRectWithCustomSizedTexture(right - (height / 2 + 4), top + (height / 2 - 4), vercheck.status.getSheetOffset() * 8, (vercheck.status.isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user