From efeee424817abfd50f79a0cdc0445fe02c9b912a Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 30 Jul 2021 17:54:11 +0200 Subject: Add ironman indicator in pv --- .../notenoughupdates/profileviewer/GuiProfileViewer.java | 13 +++++++++++++ .../notenoughupdates/profileviewer/ProfileViewer.java | 4 ++++ src/main/resources/assets/notenoughupdates/pv_ironman.png | Bin 0 -> 430 bytes 3 files changed, 17 insertions(+) create mode 100644 src/main/resources/assets/notenoughupdates/pv_ironman.png (limited to 'src/main') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java index a6152340..d59bb5d8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -65,6 +65,7 @@ public class GuiProfileViewer extends GuiScreen { public static final ResourceLocation pv_dropdown = new ResourceLocation("notenoughupdates:pv_dropdown.png"); public static final ResourceLocation pv_bg = new ResourceLocation("notenoughupdates:pv_bg.png"); public static final ResourceLocation pv_elements = new ResourceLocation("notenoughupdates:pv_elements.png"); + public static final ResourceLocation pv_ironman = new ResourceLocation("notenoughupdates:pv_ironman.png"); public static final ResourceLocation resource_packs = new ResourceLocation("minecraft:textures/gui/resource_packs.png"); public static final ResourceLocation icons = new ResourceLocation("textures/gui/icons.png"); @@ -177,6 +178,7 @@ public class GuiProfileViewer extends GuiScreen { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); if(profile != null) { + JsonObject currProfileInfo = profile.getProfileInformation(profileId); //Render Profile chooser button renderBlurredBackground(width, height, guiLeft+2, guiTop+sizeY+3+2, 100-4, 20-4); Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dropdown); @@ -184,6 +186,11 @@ public class GuiProfileViewer extends GuiScreen { 0, 100/200f, 0, 20/185f, GL11.GL_NEAREST); Utils.drawStringCenteredScaledMaxWidth(profileId, Minecraft.getMinecraft().fontRendererObj, guiLeft+50, guiTop+sizeY+3+10, true, 90, new Color(63, 224, 208, 255).getRGB()); + if(currProfileInfo != null && currProfileInfo.has("game_mode") && currProfileInfo.get("game_mode").getAsString().equals("ironman")) { + GlStateManager.color(1, 1, 1, 1); + Minecraft.getMinecraft().getTextureManager().bindTexture(pv_ironman); + Utils.drawTexturedRect(guiLeft-16-5, guiTop+sizeY+5, 16, 16, GL11.GL_NEAREST); + } //Render Open In Skycrypt button renderBlurredBackground(width, height, guiLeft+100+6+2, guiTop+sizeY+3+2, 100-4, 20-4); Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dropdown); @@ -213,6 +220,12 @@ public class GuiProfileViewer extends GuiScreen { String otherProfileId = profile.getProfileIds().get(yIndex); Utils.drawStringCenteredScaledMaxWidth(otherProfileId, Minecraft.getMinecraft().fontRendererObj, guiLeft+50, guiTop+sizeY+23+dropdownOptionSize/2f+dropdownOptionSize*yIndex, true, 90, new Color(33, 112, 104, 255).getRGB()); + currProfileInfo = profile.getProfileInformation(otherProfileId); + if(currProfileInfo != null && currProfileInfo.has("game_mode") && currProfileInfo.get("game_mode").getAsString().equals("ironman")) { + GlStateManager.color(1, 1, 1, 1); + Minecraft.getMinecraft().getTextureManager().bindTexture(pv_ironman); + Utils.drawTexturedRect(guiLeft-16-5, guiTop+sizeY+2+23+dropdownOptionSize*yIndex, 16, 16, GL11.GL_NEAREST); + } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java index 23c91dd0..9553659d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java @@ -354,6 +354,7 @@ public class ProfileViewer { return null; } + public long getNetWorth(String profileId) { if(profileId == null) profileId = latestProfile; if(networth.get(profileId) != null) return networth.get(profileId); @@ -570,6 +571,9 @@ public class ProfileViewer { if(profile.has("banking")) { profileInfo.add("banking", profile.get("banking").getAsJsonObject()); } + if(profile.has("game_mode")){ + profileInfo.add("game_mode", profile.get("game_mode")); + } profileMap.put(profileId, profileInfo); return profileInfo; } diff --git a/src/main/resources/assets/notenoughupdates/pv_ironman.png b/src/main/resources/assets/notenoughupdates/pv_ironman.png new file mode 100644 index 00000000..3b40b228 Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/pv_ironman.png differ -- cgit