aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
diff options
context:
space:
mode:
authorMoulberry <jjenour@student.unimelb.edu.au>2022-10-15 16:14:46 +0200
committerGitHub <noreply@github.com>2022-10-15 16:14:46 +0200
commit9dff9de9be425a07691951f7f7e6d43ca2c967bf (patch)
tree525c4086b4b8cb9ee2a329dee7a0915ceaaa788a /src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
parent7c6d37b2eb758a13b342b906f0aef88b940bc52a (diff)
parentdf02addf3404f07f245d6e6da8ce3ee8d72bd235 (diff)
downloadnotenoughupdates-9dff9de9be425a07691951f7f7e6d43ca2c967bf.tar.gz
notenoughupdates-9dff9de9be425a07691951f7f7e6d43ca2c967bf.tar.bz2
notenoughupdates-9dff9de9be425a07691951f7f7e6d43ca2c967bf.zip
Merge pull request #268 from NotEnoughUpdates/master
2.1 Continued
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java5114
1 files changed, 654 insertions, 4460 deletions
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 44ea686d..98f186cb 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
@@ -1,43 +1,55 @@
+/*
+ * Copyright (C) 2022 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
package io.github.moulberry.notenoughupdates.profileviewer;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Lists;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-import com.google.gson.JsonPrimitive;
-import com.mojang.authlib.GameProfile;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.core.util.StringUtils;
import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager;
import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField;
+import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay;
+import io.github.moulberry.notenoughupdates.profileviewer.bestiary.BestiaryPage;
+import io.github.moulberry.notenoughupdates.profileviewer.trophy.TrophyFishPage;
+import io.github.moulberry.notenoughupdates.util.AsyncDependencyLoader;
import io.github.moulberry.notenoughupdates.util.Constants;
-import io.github.moulberry.notenoughupdates.util.SBInfo;
+import io.github.moulberry.notenoughupdates.util.PronounDB;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityOtherPlayerMP;
-import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
-import net.minecraft.client.renderer.RenderHelper;
-import net.minecraft.client.renderer.entity.RenderManager;
-import net.minecraft.client.resources.DefaultPlayerSkin;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.client.shader.Shader;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.player.EnumPlayerModelParts;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.*;
+import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.Matrix4f;
import net.minecraft.util.ResourceLocation;
-import org.apache.commons.lang3.text.WordUtils;
import org.lwjgl.input.Keyboard;
-import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14;
import org.lwjgl.opengl.GL20;
@@ -47,29 +59,18 @@ import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.text.NumberFormat;
-import java.time.Instant;
-import java.time.LocalDateTime;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
-import java.util.*;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.function.Supplier;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
public class GuiProfileViewer extends GuiScreen {
- private static final ResourceLocation CHEST_GUI_TEXTURE =
- new ResourceLocation("textures/gui/container/generic_54.png");
- public static final ResourceLocation pv_basic = new ResourceLocation("notenoughupdates:pv_basic.png");
- public static final ResourceLocation pv_dung = new ResourceLocation("notenoughupdates:pv_dung.png");
- public static final ResourceLocation pv_extra = new ResourceLocation("notenoughupdates:pv_extra.png");
- public static final ResourceLocation pv_mining = new ResourceLocation("notenoughupdates:pv_mining.png");
- public static final ResourceLocation pv_invs = new ResourceLocation("notenoughupdates:pv_invs.png");
- public static final ResourceLocation pv_cols = new ResourceLocation("notenoughupdates:pv_cols.png");
- public static final ResourceLocation pv_pets = new ResourceLocation("notenoughupdates:pv_pets.png");
+
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");
@@ -80,64 +81,232 @@ public class GuiProfileViewer extends GuiScreen {
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");
+ public static final HashMap<String, HashMap<String, Float>> PET_STAT_BOOSTS =
+ new HashMap<String, HashMap<String, Float>>() {
+ {
+ put(
+ "PET_ITEM_BIG_TEETH_COMMON",
+ new HashMap<String, Float>() {
+ {
+ put("CRIT_CHANCE", 5f);
+ }
+ }
+ );
+ put(
+ "PET_ITEM_HARDENED_SCALES_UNCOMMON",
+ new HashMap<String, Float>() {
+ {
+ put("DEFENCE", 25f);
+ }
+ }
+ );
+ put(
+ "PET_ITEM_LUCKY_CLOVER",
+ new HashMap<String, Float>() {
+ {
+ put("MAGIC_FIND", 7f);
+ }
+ }
+ );
+ put(
+ "PET_ITEM_SHARPENED_CLAWS_UNCOMMON",
+ new HashMap<String, Float>() {
+ {
+ put("CRIT_DAMAGE", 15f);
+ }
+ }
+ );
+ }
+ };
+ public static final HashMap<String, HashMap<String, Float>> PET_STAT_BOOSTS_MULT =
+ new HashMap<String, HashMap<String, Float>>() {
+ {
+ put(
+ "PET_ITEM_IRON_CLAWS_COMMON",
+ new HashMap<String, Float>() {
+ {
+ put("CRIT_DAMAGE", 1.4f);
+ put("CRIT_CHANCE", 1.4f);
+ }
+ }
+ );
+ put(
+ "PET_ITEM_TEXTBOOK",
+ new HashMap<String, Float>() {
+ {
+ put("INTELLIGENCE", 2f);
+ }
+ }
+ );
+ }
+ };
- private static final NumberFormat numberFormat = NumberFormat.getInstance(Locale.US);
+ public static final NumberFormat numberFormat = NumberFormat.getInstance(Locale.US);
- private final ProfileViewer.Profile profile;
+ private static final char[] c = new char[]{'k', 'm', 'b', 't'};
public static ProfileViewerPage currentPage = ProfileViewerPage.BASIC;
- private int sizeX;
- private int sizeY;
- private int guiLeft;
- private int guiTop;
-
- private float backgroundRotation = 0;
-
- private long currentTime = 0;
- private long lastTime = 0;
- private long startTime = 0;
-
- private List<String> tooltipToDisplay = null;
-
- private String profileId = null;
+ public static HashMap<String, String> MINION_RARITY_TO_NUM = new HashMap<String, String>() {
+ {
+ put("COMMON", "0");
+ put("UNCOMMON", "1");
+ put("RARE", "2");
+ put("EPIC", "3");
+ put("LEGENDARY", "4");
+ put("MYTHIC", "5");
+ }
+ };
+ private static int guiLeft;
+ private static int guiTop;
+ private static ProfileViewer.Profile profile;
+ private static String profileId = null;
+ public static AsyncDependencyLoader<Optional<PronounDB.PronounChoice>> pronouns =
+ AsyncDependencyLoader.withEqualsInvocation(
+ () ->
+ NotEnoughUpdates.INSTANCE.config.profileViewer.showPronounsInPv
+ ? Optional.ofNullable(profile).map(it -> Utils.parseDashlessUUID(it.getUuid()))
+ : Optional.<UUID>empty(),
+ uuid -> uuid.isPresent()
+ ? PronounDB.getPronounsFor(uuid.get())
+ : CompletableFuture.completedFuture(Optional.empty())
+ );
+ public final GuiElementTextField playerNameTextField;
+ public final GuiElementTextField inventoryTextField = new GuiElementTextField("", GuiElementTextField.SCALE_TEXT);
+ private final Map<ProfileViewerPage, GuiProfileViewerPage> pages = new HashMap<>();
+ public int sizeX;
+ public int sizeY;
+ public float backgroundRotation = 0;
+ public long currentTime = 0;
+ public long lastTime = 0;
+ public long startTime = 0;
+ public List<String> tooltipToDisplay = null;
+ Shader blurShaderHorz = null;
+ Framebuffer blurOutputHorz = null;
+ Shader blurShaderVert = null;
+ Framebuffer blurOutputVert = null;
private boolean profileDropdownSelected = false;
- public enum ProfileViewerPage {
- LOADING(null),
- INVALID_NAME(null),
- NO_SKYBLOCK(null),
- BASIC(new ItemStack(Items.paper)),
- DUNG(new ItemStack(Item.getItemFromBlock(Blocks.deadbush))),
- EXTRA(new ItemStack(Items.book)),
- INVS(new ItemStack(Item.getItemFromBlock(Blocks.ender_chest))),
- COLS(new ItemStack(Items.painting)),
- PETS(new ItemStack(Items.bone)),
- MINING(new ItemStack(Items.iron_pickaxe));
-
- public final ItemStack stack;
-
- ProfileViewerPage(ItemStack stack) {
- this.stack = stack;
- }
- }
+ private double lastBgBlurFactor = -1;
+ private boolean showBingoPage;
public GuiProfileViewer(ProfileViewer.Profile profile) {
- this.profile = profile;
+ GuiProfileViewer.profile = profile;
+ GuiProfileViewer.profileId = profile.getLatestProfile();
String name = "";
- if (profile != null && profile.getHypixelProfile() != null) {
+ if (profile.getHypixelProfile() != null) {
name = profile.getHypixelProfile().get("displayname").getAsString();
}
- playerNameTextField = new GuiElementTextField(
- name,
- GuiElementTextField.SCALE_TEXT
- );
+ playerNameTextField = new GuiElementTextField(name, GuiElementTextField.SCALE_TEXT);
playerNameTextField.setSize(100, 20);
if (currentPage == ProfileViewerPage.LOADING) {
currentPage = ProfileViewerPage.BASIC;
}
+
+ pages.put(ProfileViewerPage.BASIC, new BasicPage(this));
+ pages.put(ProfileViewerPage.DUNGEON, new DungeonPage(this));
+ pages.put(ProfileViewerPage.EXTRA, new ExtraPage(this));
+ pages.put(ProfileViewerPage.INVENTORIES, new InventoriesPage(this));
+ pages.put(ProfileViewerPage.COLLECTIONS, new CollectionsPage(this));
+ pages.put(ProfileViewerPage.PETS, new PetsPage(this));
+ pages.put(ProfileViewerPage.MINING, new MiningPage(this));
+ pages.put(ProfileViewerPage.BINGO, new BingoPage(this));
+ pages.put(ProfileViewerPage.TROPHY_FISH, new TrophyFishPage(this));
+ pages.put(ProfileViewerPage.BESTIARY, new BestiaryPage(this));
+ }
+
+ private static float getMaxLevelXp(JsonArray levels, int offset, int maxLevel) {
+ float xpTotal = 0;
+
+ for (int i = offset; i < offset + maxLevel - 1; i++) {
+ xpTotal += levels.get(i).getAsFloat();
+ }
+
+ return xpTotal;
+ }
+
+ public static PetLevel getPetLevel(
+ String petType,
+ String rarity,
+ float exp
+ ) {
+ int offset = PetInfoOverlay.Rarity.valueOf(rarity).petOffset;
+ int maxLevel = 100;
+
+ JsonArray levels = new JsonArray();
+ levels.addAll(Constants.PETS.get("pet_levels").getAsJsonArray());
+ JsonElement customLevelingJson = Constants.PETS.get("custom_pet_leveling").getAsJsonObject().get(petType);
+ if (customLevelingJson != null) {
+ switch (Utils.getElementAsInt(Utils.getElement(customLevelingJson, "type"), 0)) {
+ case 1:
+ levels.addAll(customLevelingJson.getAsJsonObject().get("pet_levels").getAsJsonArray());
+ break;
+ case 2:
+ levels = customLevelingJson.getAsJsonObject().get("pet_levels").getAsJsonArray();
+ break;
+ }
+ maxLevel = Utils.getElementAsInt(Utils.getElement(customLevelingJson, "max_level"), 100);
+ }
+
+ float maxXP = getMaxLevelXp(levels, offset, maxLevel);
+ boolean isMaxed = exp >= maxXP;
+
+ int level = 1;
+ float currentLevelRequirement = 0;
+ float xpThisLevel = 0;
+ float pct = 0;
+
+ if (isMaxed) {
+ level = maxLevel;
+ currentLevelRequirement = levels.get(offset + level - 2).getAsFloat();
+ xpThisLevel = currentLevelRequirement;
+ pct = 1;
+ } else {
+ long totalExp = 0;
+ for (int i = offset; i < levels.size(); i++) {
+ currentLevelRequirement = levels.get(i).getAsLong();
+ totalExp += currentLevelRequirement;
+ if (totalExp >= exp) {
+ xpThisLevel = currentLevelRequirement - (totalExp - exp);
+ level = Math.min(i - offset + 1, maxLevel);
+ break;
+ }
+ }
+ pct = currentLevelRequirement != 0 ? xpThisLevel / currentLevelRequirement : 0;
+ level += pct;
+ }
+
+ GuiProfileViewer.PetLevel levelObj = new GuiProfileViewer.PetLevel();
+ levelObj.level = level;
+ levelObj.maxLevel = maxLevel;
+ levelObj.currentLevelRequirement = currentLevelRequirement;
+ levelObj.maxXP = maxXP;
+ levelObj.levelPercentage = pct;
+ levelObj.levelXp = xpThisLevel;
+ levelObj.totalXp = exp;
+ return levelObj;
}
- private final GuiElementTextField playerNameTextField;
+ @Deprecated
+ public static String shortNumberFormat(double n, int iteration) {
+ return StringUtils.shortNumberFormat(n, iteration
+ );
+ }
+
+ public static int getGuiLeft() {
+ return guiLeft;
+ }
+
+ public static int getGuiTop() {
+ return guiTop;
+ }
+
+ public static ProfileViewer.Profile getProfile() {
+ return profile;
+ }
+
+ public static String getProfileId() {
+ return profileId;
+ }
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
@@ -147,7 +316,7 @@ public class GuiProfileViewer extends GuiScreen {
ProfileViewerPage page = currentPage;
if (profile == null) {
page = ProfileViewerPage.INVALID_NAME;
- } else if (profile.getPlayerInformation(null) == null) {
+ } else if (profile.getSkyblockProfiles(null) == null) {
page = ProfileViewerPage.LOADING;
} else if (profile.getLatestProfile() == null) {
page = ProfileViewerPage.NO_SKYBLOCK;
@@ -159,14 +328,26 @@ public class GuiProfileViewer extends GuiScreen {
{
//this is just to cache the guild info
if (profile != null) {
- JsonObject guildinfo = profile.getGuildInfo(null);
+ profile.getGuildInformation(null);
}
}
this.sizeX = 431;
this.sizeY = 202;
- this.guiLeft = (this.width - this.sizeX) / 2;
- this.guiTop = (this.height - this.sizeY) / 2;
+ guiLeft = (this.width - this.sizeX) / 2;
+ guiTop = (this.height - this.sizeY) / 2;
+
+ JsonObject currProfileInfo = profile != null ? profile.getProfileInformation(profileId) : null;
+ if (NotEnoughUpdates.INSTANCE.config.profileViewer.alwaysShowBingoTab) {
+ showBingoPage = true;
+ } else {
+ showBingoPage =
+ currProfileInfo != null &&
+ currProfileInfo.has("game_mode") &&
+ currProfileInfo.get("game_mode").getAsString().equals("bingo");
+ }
+
+ if (!showBingoPage && currentPage == ProfileViewerPage.BINGO) currentPage = ProfileViewerPage.BASIC;
super.drawScreen(mouseX, mouseY, partialTicks);
drawDefaultBackground();
@@ -199,42 +380,57 @@ 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);
- Utils.drawTexturedRect(guiLeft, guiTop + sizeY + 3, 100, 20,
- 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()
+ Utils.drawTexturedRect(guiLeft, guiTop + sizeY + 3, 100, 20, 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()
);
//ironman icon
- if (currProfileInfo != null && currProfileInfo.has("game_mode") &&
- currProfileInfo.get("game_mode").getAsString().equals("ironman")) {
+ 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);
}
//bingo! icon
- if (currProfileInfo != null && currProfileInfo.has("game_mode") &&
- currProfileInfo.get("game_mode").getAsString().equals("bingo")) {
+ if (
+ currProfileInfo != null &&
+ currProfileInfo.has("game_mode") &&
+ currProfileInfo.get("game_mode").getAsString().equals("bingo")
+ ) {
GlStateManager.color(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(pv_bingo);
Utils.drawTexturedRect(guiLeft - 16 - 5, guiTop + sizeY + 5, 16, 16, GL11.GL_NEAREST);
}
//stranded icon
- if (currProfileInfo != null && currProfileInfo.has("game_mode") &&
- currProfileInfo.get("game_mode").getAsString().equals("island")) {
+ if (
+ currProfileInfo != null &&
+ currProfileInfo.has("game_mode") &&
+ currProfileInfo.get("game_mode").getAsString().equals("island")
+ ) {
GlStateManager.color(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(pv_stranded);
Utils.drawTexturedRect(guiLeft - 16 - 5, guiTop + sizeY + 5, 16, 16, GL11.GL_NEAREST);
}
//icon if game mode is unknown
- if (currProfileInfo != null && currProfileInfo.has("game_mode") &&
- !currProfileInfo.get("game_mode").getAsString().equals("island") &&
- !currProfileInfo.get("game_mode").getAsString().equals("bingo") &&
- !currProfileInfo.get("game_mode").getAsString().equals("ironman")) {
+ if (
+ currProfileInfo != null &&
+ currProfileInfo.has("game_mode") &&
+ !currProfileInfo.get("game_mode").getAsString().equals("island") &&
+ !currProfileInfo.get("game_mode").getAsString().equals("bingo") &&
+ !currProfileInfo.get("game_mode").getAsString().equals("ironman")
+ ) {
GlStateManager.color(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(pv_unknown);
Utils.drawTexturedRect(guiLeft - 16 - 5, guiTop + sizeY + 5, 16, 16, GL11.GL_NEAREST);
@@ -242,8 +438,16 @@ public class GuiProfileViewer extends GuiScreen {
//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);
- Utils.drawTexturedRect(guiLeft + 100 + 6, guiTop + sizeY + 3, 100, 20,
- 0, 100 / 200f, 0, 20 / 185f, GL11.GL_NEAREST
+ Utils.drawTexturedRect(
+ guiLeft + 100 + 6,
+ guiTop + sizeY + 3,
+ 100,
+ 20,
+ 0,
+ 100 / 200f,
+ 0,
+ 20 / 185f,
+ GL11.GL_NEAREST
);
Utils.drawStringCenteredScaledMaxWidth(
"Open in Skycrypt",
@@ -255,25 +459,39 @@ public class GuiProfileViewer extends GuiScreen {
new Color(63, 224, 208, 255).getRGB()
);
- if (profileDropdownSelected && !profile.getProfileIds().isEmpty() && scaledResolution.getScaleFactor() != 4) {
+ if (profileDropdownSelected && !profile.getProfileNames().isEmpty() && scaledResolution.getScaleFactor() < 4) {
int dropdownOptionSize = scaledResolution.getScaleFactor() == 3 ? 10 : 20;
- int numProfiles = profile.getProfileIds().size();
+ int numProfiles = profile.getProfileNames().size();
int sizeYDropdown = numProfiles * dropdownOptionSize;
renderBlurredBackground(width, height, guiLeft + 2, guiTop + sizeY + 23, 100 - 4, sizeYDropdown - 2);
Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dropdown);
- Utils.drawTexturedRect(guiLeft, guiTop + sizeY + 23 - 3, 100, 3,
- 100 / 200f, 1, 0, 3 / 185f, GL11.GL_NEAREST
+ Utils.drawTexturedRect(guiLeft, guiTop + sizeY + 23 - 3, 100, 3, 100 / 200f, 1, 0, 3 / 185f, GL11.GL_NEAREST);
+ Utils.drawTexturedRect(
+ guiLeft,
+ guiTop + sizeY + 23 + sizeYDropdown - 4,
+ 100,
+ 4,
+ 100 / 200f,
+ 1,
+ 181 / 185f,
+ 1,
+ GL11.GL_NEAREST
);
- Utils.drawTexturedRect(guiLeft, guiTop + sizeY + 23 + sizeYDropdown - 4, 100, 4,
- 100 / 200f, 1, 181 / 185f, 1, GL11.GL_NEAREST
- );
- Utils.drawTexturedRect(guiLeft, guiTop + sizeY + 23, 100, sizeYDropdown - 4,
- 100 / 200f, 1, (181 - sizeYDropdown) / 185f, 181 / 185f, GL11.GL_NEAREST
+ Utils.drawTexturedRect(
+ guiLeft,
+ guiTop + sizeY + 23,
+ 100,
+ sizeYDropdown - 4,
+ 100 / 200f,
+ 1,
+ (181 - sizeYDropdown) / 185f,
+ 181 / 185f,
+ GL11.GL_NEAREST
);
- for (int yIndex = 0; yIndex < profile.getProfileIds().size(); yIndex++) {
- String otherProfileId = profile.getProfileIds().get(yIndex);
+ for (int yIndex = 0; yIndex < profile.getProfileNames().size(); yIndex++) {
+ String otherProfileId = profile.getProfileNames().get(yIndex);
Utils.drawStringCenteredScaledMaxWidth(
otherProfileId,
Minecraft.getMinecraft().fontRendererObj,
@@ -284,8 +502,11 @@ public class GuiProfileViewer extends GuiScreen {
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")) {
+ 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(
@@ -296,8 +517,11 @@ public class GuiProfileViewer extends GuiScreen {
GL11.GL_NEAREST
);
}
- if (currProfileInfo != null && currProfileInfo.has("game_mode") &&
- currProfileInfo.get("game_mode").getAsString().equals("bingo")) {
+ if (
+ currProfileInfo != null &&
+ currProfileInfo.has("game_mode") &&
+ currProfileInfo.get("game_mode").getAsString().equals("bingo")
+ ) {
GlStateManager.color(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(pv_bingo);
Utils.drawTexturedRect(
@@ -308,8 +532,11 @@ public class GuiProfileViewer extends GuiScreen {
GL11.GL_NEAREST
);
}
- if (currProfileInfo != null && currProfileInfo.has("game_mode") &&
- currProfileInfo.get("game_mode").getAsString().equals("island")) {
+ if (
+ currProfileInfo != null &&
+ currProfileInfo.has("game_mode") &&
+ currProfileInfo.get("game_mode").getAsString().equals("island")
+ ) {
GlStateManager.color(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(pv_stranded);
Utils.drawTexturedRect(
@@ -320,10 +547,13 @@ public class GuiProfileViewer extends GuiScreen {
GL11.GL_NEAREST
);
}
- if (currProfileInfo != null && currProfileInfo.has("game_mode") &&
- !currProfileInfo.get("game_mode").getAsString().equals("island") &&
- !currProfileInfo.get("game_mode").getAsString().equals("bingo") &&
- !currProfileInfo.get("game_mode").getAsString().equals("ironman")) {
+ if (
+ currProfileInfo != null &&
+ currProfileInfo.has("game_mode") &&
+ !currProfileInfo.get("game_mode").getAsString().equals("island") &&
+ !currProfileInfo.get("game_mode").getAsString().equals("bingo") &&
+ !currProfileInfo.get("game_mode").getAsString().equals("ironman")
+ ) {
GlStateManager.color(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(pv_unknown);
Utils.drawTexturedRect(
@@ -335,163 +565,156 @@ public class GuiProfileViewer extends GuiScreen {
);
}
}
-
}
}
}
GlStateManager.color(1, 1, 1, 1);
- switch (page) {
- case BASIC:
- drawBasicPage(mouseX, mouseY, partialTicks);
- break;
- case DUNG:
- drawDungPage(mouseX, mouseY, partialTicks);
- break;
- case EXTRA:
- drawExtraPage(mouseX, mouseY, partialTicks);
- break;
- case INVS:
- drawInvsPage(mouseX, mouseY, partialTicks);
- break;
- case COLS:
- drawColsPage(mouseX, mouseY, partialTicks);
- break;
- case PETS:
- drawPetsPage(mouseX, mouseY, partialTicks);
- break;
- case MINING:
- drawMiningPage(mouseX, mouseY, partialTicks);
- break;
- case LOADING:
- String str = EnumChatFormatting.YELLOW + "Loading player profiles.";
- long currentTimeMod = System.currentTimeMillis() % 1000;
- if (currentTimeMod > 333) {
- if (currentTimeMod < 666) {
- str += ".";
- } else {
- str += "..";
- }
- }
-
- Utils.drawStringCentered(str, Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f, guiTop + 101, true, 0
- );
- //This is just here to inform the player what to do
- //like typing /api new or telling them to go find a psychotherapist
- long timeDiff = System.currentTimeMillis() - startTime;
+ if (pages.containsKey(page)) {
+ pages.get(page).drawPage(mouseX, mouseY, partialTicks);
+ } else {
+ switch (page) {
+ case LOADING:
+ String str = EnumChatFormatting.YELLOW + "Loading player profiles.";
+ long currentTimeMod = System.currentTimeMillis() % 1000;
+ if (currentTimeMod > 333) {
+ if (currentTimeMod < 666) {
+ str += ".";
+ } else {
+ str += "..";
+ }
+ }
- if (timeDiff > 20000) {
- Utils.drawStringCentered(
- EnumChatFormatting.YELLOW + "Its taking a while...",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f,
- guiTop + 111,
- true,
- 0
- );
Utils.drawStringCentered(
- EnumChatFormatting.YELLOW + "Try \"/api new\".",
+ str,
Minecraft.getMinecraft().fontRendererObj,
guiLeft + sizeX / 2f,
- guiTop + 121,
+ guiTop + 101,
true,
0
);
- if (timeDiff > 60000) {
+
+ //This is just here to inform the player what to do
+ //like typing /api new or telling them to go find a psychotherapist
+ long timeDiff = System.currentTimeMillis() - startTime;
+
+ if (timeDiff > 20000) {
Utils.drawStringCentered(
- EnumChatFormatting.YELLOW + "Might be hypixel's fault.",
+ EnumChatFormatting.YELLOW + "Its taking a while...",
Minecraft.getMinecraft().fontRendererObj,
guiLeft + sizeX / 2f,
- guiTop + 131,
+ guiTop + 111,
true,
0
);
- if (timeDiff > 180000) {
+ Utils.drawStringCentered(
+ EnumChatFormatting.YELLOW + "Try \"/api new\".",
+ Minecraft.getMinecraft().fontRendererObj,
+ guiLeft + sizeX / 2f,
+ guiTop + 121,
+ true,
+ 0
+ );
+ if (timeDiff > 60000) {
Utils.drawStringCentered(
- EnumChatFormatting.YELLOW + "Wow you're still here?",
+ EnumChatFormatting.YELLOW + "Might be hypixel's fault.",
Minecraft.getMinecraft().fontRendererObj,
guiLeft + sizeX / 2f,
- guiTop + 141,
+ guiTop + 131,
true,
0
);
- if (timeDiff > 360000) {
- long second = (timeDiff / 1000) % 60;
- long minute = (timeDiff / (1000 * 60)) % 60;
- long hour = (timeDiff / (1000 * 60 * 60)) % 24;
-
- String time = String.format("%02d:%02d:%02d", hour, minute, second);
- Utils.drawStringCentered(
- EnumChatFormatting.YELLOW + "You've wasted your time here for: " + time,
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f,
- guiTop + 151,
- true,
- 0
- );
+ if (timeDiff > 180000) {
Utils.drawStringCentered(
- EnumChatFormatting.YELLOW + "" + EnumChatFormatting.BOLD + "What are you doing with your life?",
+ EnumChatFormatting.YELLOW + "Wow you're still here?",
Minecraft.getMinecraft().fontRendererObj,
guiLeft + sizeX / 2f,
- guiTop + 161,
+ guiTop + 141,
true,
0
);
- if (timeDiff > 600000) {
+ if (timeDiff > 360000) {
+ long second = (timeDiff / 1000) % 60;
+ long minute = (timeDiff / (1000 * 60)) % 60;
+ long hour = (timeDiff / (1000 * 60 * 60)) % 24;
+
+ String time = String.format("%02d:%02d:%02d", hour, minute, second);
Utils.drawStringCentered(
- EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "Maniac",
+ EnumChatFormatting.YELLOW + "You've wasted your time here for: " + time,
Minecraft.getMinecraft().fontRendererObj,
guiLeft + sizeX / 2f,
- guiTop + 171,
+ guiTop + 151,
true,
0
);
- if (timeDiff > 1200000) {
+ Utils.drawStringCentered(
+ EnumChatFormatting.YELLOW + "" + EnumChatFormatting.BOLD + "What are you doing with your life?",
+ Minecraft.getMinecraft().fontRendererObj,
+ guiLeft + sizeX / 2f,
+ guiTop + 161,
+ true,
+ 0
+ );
+ if (timeDiff > 600000) {
Utils.drawStringCentered(
- EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "You're a menace to society",
+ EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "Maniac",
Minecraft.getMinecraft().fontRendererObj,
guiLeft + sizeX / 2f,
- guiTop + 181,
+ guiTop + 171,
true,
0
);
- if (timeDiff > 1800000) {
+ if (timeDiff > 1200000) {
Utils.drawStringCentered(
- EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD +
- "You don't know what's gonna happen to you",
+ EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "You're a menace to society",
Minecraft.getMinecraft().fontRendererObj,
guiLeft + sizeX / 2f,
- guiTop + 191,
+ guiTop + 181,
true,
0
);
- if (timeDiff > 3000000) {
+ if (timeDiff > 1800000) {
Utils.drawStringCentered(
- EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "You really want this?",
+ EnumChatFormatting.RED +
+ "" +
+ EnumChatFormatting.BOLD +
+ "You don't know what's gonna happen to you",
Minecraft.getMinecraft().fontRendererObj,
guiLeft + sizeX / 2f,
- guiTop + 91,
+ guiTop + 191,
true,
0
);
- if (timeDiff > 3300000) {
+ if (timeDiff > 3000000) {
Utils.drawStringCentered(
- EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.BOLD + "OW LORD FORGIVE ME FOR THIS",
+ EnumChatFormatting.RED + "" + EnumChatFormatting.BOLD + "You really want this?",
Minecraft.getMinecraft().fontRendererObj,
guiLeft + sizeX / 2f,
- guiTop + 71,
+ guiTop + 91,
true,
0
);
- if (timeDiff > 3600000) {
- throw new Error("Go do something productive") {
- @Override
- public void printStackTrace() {
- throw new Error("Go do something productive");
- }
- };
+ if (timeDiff > 3300000) {
+ Utils.drawStringCentered(
+ EnumChatFormatting.DARK_RED +
+ "" +
+ EnumChatFormatting.BOLD +
+ "OW LORD FORGIVE ME FOR THIS",
+ Minecraft.getMinecraft().fontRendererObj,
+ guiLeft + sizeX / 2f,
+ guiTop + 71,
+ true,
+ 0
+ );
+ if (timeDiff > 3600000) {
+ throw new Error("Go do something productive") {
+ @Override
+ public void printStackTrace() {
+ throw new Error("Go do something productive");
+ }
+ };
+ }
}
}
}
@@ -501,33 +724,61 @@ public class GuiProfileViewer extends GuiScreen {
}
}
}
- }
- break;
- case INVALID_NAME:
- Utils.drawStringCentered(
- EnumChatFormatting.RED + "Invalid name or API is down!",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f,
- guiTop + 101,
- true,
- 0
- );
- break;
- case NO_SKYBLOCK:
- Utils.drawStringCentered(
- EnumChatFormatting.RED + "No skyblock data found!",
- Minecraft.getMinecraft().fontRendererObj,
- guiLeft + sizeX / 2f,
- guiTop + 101,
- true,
- 0
- );
- break;
+ break;
+ case INVALID_NAME:
+ Utils.drawStringCentered(
+ EnumChatFormatting.RED + "Invalid name or API is down!",
+ Minecraft.getMinecraft().fontRendererObj,
+ guiLeft + sizeX / 2f,
+ guiTop + 101,
+ true,
+ 0
+ );
+ break;
+ case NO_SKYBLOCK:
+ Utils.drawStringCentered(
+ EnumChatFormatting.RED + "No skyblock data found!",
+ Minecraft.getMinecraft().fontRendererObj,
+ guiLeft + sizeX / 2f,
+ gui