aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorefefury <69400149+efefury@users.noreply.github.com>2022-06-11 21:18:41 +0200
committerGitHub <noreply@github.com>2022-06-11 15:18:41 -0400
commitce23654aff4c315fde75d57c0cfde5b9e2d4bfe0 (patch)
treef93e4e757bf96b3da244ec2b82fd4a626ee87092 /src/main/java/io
parent63c8be57bf124fd5470b759abdf90d4db0c44b5f (diff)
downloadNotEnoughUpdates-ce23654aff4c315fde75d57c0cfde5b9e2d4bfe0.tar.gz
NotEnoughUpdates-ce23654aff4c315fde75d57c0cfde5b9e2d4bfe0.tar.bz2
NotEnoughUpdates-ce23654aff4c315fde75d57c0cfde5b9e2d4bfe0.zip
Trophy Fishing Tab (#163)
* trophy fishing cool stuff Co-Authored-By: jani270 <69345714+jani270@users.noreply.github.com> * noob * yep bugs: - not uploading when swapping profiles - while hovering over lowest slot, left skulls have light issue Co-Authored-By: jani270 <69345714+jani270@users.noreply.github.com> * change when switching profiles * things lighting bugs add trophy page to pageLayout on startup disable dungeon map on startup * map message * 🤡 but ok Co-authored-by: IRONM00N <64110067+IRONM00N@users.noreply.github.com> * i hate you iron Co-authored-by: jani270 <69345714+jani270@users.noreply.github.com> Co-authored-by: Lulonaut <lulonaut@tutanota.de> Co-authored-by: IRONM00N <64110067+IRONM00N@users.noreply.github.com>
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java11
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/DungeonMapConfig.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ProfileViewer.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java22
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFish.java74
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishingPage.java429
7 files changed, 540 insertions, 13 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index 9f7a98b1..bd54dfba 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -232,6 +232,17 @@ public class NotEnoughUpdates {
config.apiData.apiKey = config.apiKey.apiKey;
config.apiKey = null;
}
+
+ if (config.dungeonMap.dmEnable &&
+ !NotEnoughUpdates.INSTANCE.config.hidden.dev) {
+ config.dungeonMap.dmEnable = false;
+ }
+
+ //add the trophy fishing tab to the config
+ if (config.profileViewer.pageLayout.size() == 8) {
+ config.profileViewer.pageLayout.add(8);
+ }
+ saveConfig();
}
MinecraftForge.EVENT_BUS.register(this);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java
index 3789a09d..529f8e57 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java
@@ -50,6 +50,12 @@ public class MapCommand extends ClientCommandBase {
@Override
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
+ if (!NotEnoughUpdates.INSTANCE.config.hidden.dev) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
+ EnumChatFormatting.RED + "[NEU] The map does not work right now. You can use the map from other mods, for example: SkyblockAddons, DungeonsGuide, or Skytils "));
+ return;
+ }
+
if (NotEnoughUpdates.INSTANCE.colourMap == null) {
try (
BufferedReader reader = new BufferedReader(new InputStreamReader(Minecraft
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/DungeonMapConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/DungeonMapConfig.java
index 8e211bd6..4397c02e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/DungeonMapConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/DungeonMapConfig.java
@@ -73,7 +73,7 @@ public class DungeonMapConfig {
name = "Show Dungeon Map",
desc = "Show/hide the NEU dungeon map"
)
- public boolean dmEnable = true;
+ public boolean dmEnable = false;
@Expose
@ConfigOption(
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ProfileViewer.java
index 5d3b6532..49385d02 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ProfileViewer.java
@@ -20,11 +20,7 @@
package io.github.moulberry.notenoughupdates.options.seperateSections;
import com.google.gson.annotations.Expose;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorButton;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDraggableList;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorFSR;
-import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
+import io.github.moulberry.notenoughupdates.core.config.annotations.*;
import java.util.ArrayList;
import java.util.Arrays;
@@ -71,10 +67,11 @@ public class ProfileViewer {
"\u00a7ePets",
"\u00a7eMining",
"\u00a7eBingo",
+ "\u00a7eTrophy Fish",
},
allowDeleting = false
)
- public List<Integer> pageLayout = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7));
+ public List<Integer> pageLayout = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8));
@Expose
@ConfigOption(
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 ba3b97f8..e4014ca3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
@@ -29,6 +29,7 @@ import com.mojang.authlib.GameProfile;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager;
import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField;
+import io.github.moulberry.notenoughupdates.profileviewer.trophy.TrophyFishingPage;
import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.Utils;
@@ -199,7 +200,7 @@ public class GuiProfileViewer extends GuiScreen {
"personal_vault_contents",
Utils.editItemStackInfo(NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager
.getItemInformation()
- .get("IRON_CHEST")), EnumChatFormatting.GRAY + "Personal vault", true)
+ .get("IRON_CHEST")), EnumChatFormatting.GRAY + "Personal Vault", true)
);
put("talisman_bag", Utils.createItemStack(Items.golden_apple, EnumChatFormatting.GRAY + "Accessory Bag"));
put("wardrobe_contents", Utils.createItemStack(Items.leather_chestplate, EnumChatFormatting.GRAY + "Wardrobe"));
@@ -223,7 +224,7 @@ public class GuiProfileViewer extends GuiScreen {
private static int floorTime = 7;
private static int guiLeft;
private static int guiTop;
- private static ProfileViewer.Profile profile = null;
+ private static ProfileViewer.Profile profile;
private final GuiElementTextField playerNameTextField;
private final HashMap<String, ProfileViewer.Level> levelObjCatas = new HashMap<>();
private final HashMap<String, ProfileViewer.Level> levelObjhotms = new HashMap<>();
@@ -251,7 +252,7 @@ public class GuiProfileViewer extends GuiScreen {
private long lastTime = 0;
private long startTime = 0;
private List<String> tooltipToDisplay = null;
- private String profileId = null;
+ private static String profileId = null;
private boolean profileDropdownSelected = false;
private ItemStack selectedCollectionCategory = null;
private int floorLevelTo = -1;
@@ -282,9 +283,10 @@ public class GuiProfileViewer extends GuiScreen {
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(
@@ -466,6 +468,10 @@ public class GuiProfileViewer extends GuiScreen {
return profile;
}
+ public static String getProfileId() {
+ return profileId;
+ }
+
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
currentTime = System.currentTimeMillis();
@@ -708,6 +714,9 @@ public class GuiProfileViewer extends GuiScreen {
case BINGO:
BingoPage.renderPage(mouseX, mouseY);
break;
+ case TROPHY_FISH:
+ TrophyFishingPage.renderPage(mouseX, mouseY);
+ break;
case LOADING:
String str = EnumChatFormatting.YELLOW + "Loading player profiles.";
long currentTimeMod = System.currentTimeMillis() % 1000;
@@ -5354,7 +5363,8 @@ public class GuiProfileViewer extends GuiScreen {
COLLECTIONS(4, Items.painting, "Collections"),
PETS(5, Items.bone, "Pets"),
MINING(6, Items.iron_pickaxe, "Heart of the Mountain"),
- BINGO(7, Items.filled_map, "Bingo");
+ BINGO(7, Items.filled_map, "Bingo"),
+ TROPHY_FISH(8, Items.fishing_rod, "Trophy Fish");
public final ItemStack stack;
public final int id;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFish.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFish.java
new file mode 100644
index 00000000..9951511d
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFish.java
@@ -0,0 +1,74 @@
+/*
+ * 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.trophy;
+
+import java.util.Map;
+
+public class TrophyFish {
+
+ private final String name;
+
+ private int total = 0;
+
+ public final Map<TrophyFishRarity, Integer> trophyFishRarityIntegerMap;
+
+ public TrophyFish(String name, Map<TrophyFishRarity, Integer> trophyFishRarityIntegerMap) {
+ this.name = name;
+ this.trophyFishRarityIntegerMap = trophyFishRarityIntegerMap;
+ }
+
+ public void addTotal(int n) {
+ total +=n;
+ }
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void removeTotal(int n) {
+ total -=n;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Map<TrophyFishRarity, Integer> getTrophyFishRarityIntegerMap() {
+ return trophyFishRarityIntegerMap;
+ }
+
+ public void add(TrophyFishRarity rarity, int value) {
+ if(!trophyFishRarityIntegerMap.containsKey(rarity)) {
+ trophyFishRarityIntegerMap.put(rarity, value);
+ }
+ }
+
+ public enum TrophyFishRarity {
+ BRONZE,
+ SILVER,
+ GOLD,
+ DIAMOND;
+ }
+
+ public String getInternalName() {
+ return name.toLowerCase().replace(" ", "_");
+ }
+}
+
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishingPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishingPage.java
new file mode 100644
index 00000000..6063dee0
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishingPage.java
@@ -0,0 +1,429 @@
+/*
+ * 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.trophy;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.RenderHelper;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.ResourceLocation;
+import org.apache.commons.lang3.text.WordUtils;
+import org.apache.commons.lang3.tuple.Pair;
+import org.lwjgl.opengl.GL11;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class TrophyFishingPage {
+
+ public static Map<String, EnumChatFormatting> internalTrophyFish = new HashMap<String, EnumChatFormatting>() {
+ {
+ put("gusher", EnumChatFormatting.WHITE);
+ put("flyfish", EnumChatFormatting.GREEN);
+ put("moldfin", EnumChatFormatting.DARK_PURPLE);
+ put("vanille", EnumChatFormatting.BLUE);
+ put("blobfish", EnumChatFormatting.WHITE);
+ put("mana_ray", EnumChatFormatting.BLUE);
+ put("slugfish", EnumChatFormatting.GREEN);
+ put("soul_fish", EnumChatFormatting.DARK_PURPLE);
+ put("lava_horse", EnumChatFormatting.BLUE);
+ put("golden_fish", EnumChatFormatting.GOLD);
+ put("karate_fish", EnumChatFormatting.DARK_PURPLE);
+ put("skeleton_fish", EnumChatFormatting.DARK_PURPLE);
+ put("sulphur_skitter", EnumChatFormatting.WHITE);
+ put("obfuscated_fish_1", EnumChatFormatting.WHITE);
+ put("obfuscated_fish_2", EnumChatFormatting.GREEN);
+ put("obfuscated_fish_3", EnumChatFormatting.BLUE);
+ put("volcanic_stonefish", EnumChatFormatting.BLUE);
+ put("steaming_hot_flounder", EnumChatFormatting.WHITE);
+ }
+ };
+
+ private static LinkedHashMap<ItemStack, Pair<String, Integer>> armorHelmets =
+ new LinkedHashMap<ItemStack, Pair<String, Integer>>() {
+ {
+ put(NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager
+ .getItemInformation()
+ .get("BRONZE_HUNTER_HELMET")), Pair.of(EnumChatFormatting.GREEN + "Novice Fisher", 1));
+ put(NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager
+ .getItemInformation()
+ .get("SILVER_HUNTER_HELMET")), Pair.of(EnumChatFormatting.BLUE + "Adept Fisher", 2));
+ put(NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager
+ .getItemInformation()
+ .get("GOLD_HUNTER_HELMET")), Pair.of(EnumChatFormatting.DARK_PURPLE + "Expert Fisher", 3));
+ put(NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager
+ .getItemInformation()
+ .get("DIAMOND_HUNTER_HELMET")), Pair.of(EnumChatFormatting.GOLD + "Master Fisher", 4));
+ }
+ };
+
+ private static Map<Integer, Pair<Integer, Integer>> slotLocations = new HashMap<Integer, Pair<Integer, Integer>>() {
+ {
+ put(0, Pair.of(277, 46));
+ put(1, Pair.of(253, 58));
+ put(2, Pair.of(301, 58));
+ put(3, Pair.of(229, 70));
+ put(4, Pair.of(325, 70));
+ put(5, Pair.of(277, 70));
+ put(6, Pair.of(253, 82));
+ put(7, Pair.of(301, 82));
+ put(8, Pair.of(229, 94));
+ put(9, Pair.of(325, 94));
+ put(10, Pair.of(253, 106));
+ put(11, Pair.of(301, 106));
+ put(12, Pair.of(277, 118));
+ put(13, Pair.of(229, 118));
+ put(14, Pair.of(325, 118));
+ put(15, Pair.of(253, 130));
+ put(16, Pair.of(301, 130));
+ put(17, Pair.of(277, 142));
+ }
+ };
+ private static long totalCount = 0;
+ private static int guiLeft;
+ private static int guiTop;
+
+ private static final ResourceLocation TROPHY_FISH_TEXTURE = new ResourceLocation(
+ "notenoughupdates:pv_trophy_fish_tab.png");
+ private static final Map<String, TrophyFish> trophyFishList = new HashMap<>();
+
+ private static final Map<String, Integer> total = new HashMap<>();
+
+ public static void renderPage(int mouseX, int mouseY) {
+ guiLeft = GuiProfileViewer.getGuiLeft();
+ guiTop = GuiProfileViewer.getGuiTop();
+ JsonObject trophyInformation = getTrophyInformation();
+ if (trophyInformation == null) {
+ Utils.drawStringCentered(EnumChatFormatting.RED + "No data found",
+ Minecraft.getMinecraft().fontRendererObj,
+ guiLeft + 431 / 2f,
+ guiTop + 101,
+ true,
+ 0
+ );
+ return;
+ }
+
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ int width = scaledResolution.getScaledWidth();
+ int height = scaledResolution.getScaledHeight();
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(TROPHY_FISH_TEXTURE);
+ Utils.drawTexturedRect(guiLeft, guiTop, 431, 202, GL11.GL_NEAREST);
+
+ GlStateManager.color(1, 1, 1, 1);
+ GlStateManager.disableLighting();
+ RenderHelper.enableGUIStandardItemLighting();
+
+ JsonObject stats = trophyInformation.get("stats").getAsJsonObject();
+
+ int thunderKills = 0;
+ if (stats.has("kills_thunder")) {
+ thunderKills = stats.getAsJsonObject().get("kills_thunder").getAsInt();
+ }
+ ItemStack thunder_sc = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager
+ .getItemInformation()
+ .get("THUNDER_SC"));
+ Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(thunder_sc, guiLeft + 16, guiTop + 108);
+
+ Utils.drawStringF(
+ EnumChatFormatting.AQUA + "Thunder Kills: §f" + thunderKills,
+ Minecraft.getMinecraft().fontRendererObj,
+ guiLeft + 36,
+ guiTop + 112,
+ true,
+ 0
+ );
+
+ ItemStack lord_jawbus_sc = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager
+ .getItemInformation()
+ .get("LORD_JAWBUS_SC"));
+ Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(lord_jawbus_sc, guiLeft + 16, guiTop + 120);
+ int jawbusKills = 0;
+ if (stats.has("kills_lord_jawbus")) {
+ jawbusKills = stats.getAsJsonObject().get("kills_lord_jawbus").getAsInt();
+ }
+
+ Utils.drawStringF(
+ EnumChatFormatting.AQUA + "Lord Jawbus Kills: §f" + jawbusKills,
+ Minecraft.getMinecraft().fontRendererObj,
+ guiLeft + 36,
+ guiTop + 124,
+ true,
+ 0
+ );
+
+ ItemStack fishing_rod = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager
+ .getItemInformation()
+ .get("FISHING_ROD"));
+ Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(fishing_rod, guiLeft + 20, guiTop + 21);
+
+ Utils.drawStringF(
+ EnumChatFormatting.AQUA + "Total Caught: §f" + totalCount,
+ Minecraft.getMinecraft().fontRendererObj,
+ guiLeft + 38,
+ guiTop + 25,
+ true,
+ 0
+ );
+
+ ArrayList<TrophyFish> arrayList = new ArrayList<>(trophyFishList.values());
+ arrayList.sort((c1, c2) -> {
+ if (c1.getTotal() > c2.getTotal()) return -1;
+ if (c1.getTotal() < c2.getTotal()) return 1;
+ return 0;
+ });
+
+ int x;
+ int y;
+ for (TrophyFish value : arrayList) {
+ RenderHelper.enableGUIStandardItemLighting();
+ x = guiLeft + slotLocations.get(arrayList.indexOf(value)).getLeft();
+ y = guiTop + slotLocations.get(arrayList.indexOf(value)).getRight();
+ Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(
+ getItem(value.getName()),
+ x,
+ y
+ );
+
+ if (mouseX >= x && mouseX < x + 24) {
+ if (mouseY >= y && mouseY <= y + 24) {
+ Utils.drawHoveringText(
+ getTooltip(value),
+ mouseX,
+ mouseY,
+ width,
+ height,
+ -1,
+ Minecraft.getMinecraft().fontRendererObj
+ );
+ }
+ }
+ }
+
+ if (arrayList.size() != internalTrophyFish.size()) {
+ List<String> clonedList = new ArrayList<>(internalTrophyFish.size());
+ clonedList.addAll(internalTrophyFish.keySet());
+ clonedList.removeAll(fixStringName(new ArrayList<>(trophyFishList.keySet())));
+ for (String difference : clonedList) {
+ RenderHelper.enableGUIStandardItemLighting();
+ x = guiLeft + slotLocations.get(clonedList.indexOf(difference) + (trophyFishList.keySet().size())).getLeft();
+ y = guiTop + slotLocations.get(clonedList.indexOf(difference) + (trophyFishList.keySet().size())).getRight();
+ ItemStack itemStack = new ItemStack(Items.dye, 1, 8);
+ Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(
+ itemStack,
+ x,
+ y
+ );
+ if (mouseX >= x && mouseX < x + 24) {
+ if (mouseY >= y && mouseY <= y + 24) {
+ Utils.drawHoveringText(
+ getTooltipIfNotFound(difference),
+ mouseX,
+ mouseY,
+ width,
+ height,
+ -1,
+ Minecraft.getMinecraft().fontRendererObj
+ );
+ }
+
+ }
+ }
+ }
+
+ int i = 0;
+ if (!trophyInformation.has("trophy_fish") &&
+ !trophyInformation.get("trophy_fish").getAsJsonObject().has("rewards")) {
+ return;
+ }
+
+ JsonArray rewards = trophyInformation.get("trophy_fish").getAsJsonObject().get("rewards").getAsJsonArray();
+ for (ItemStack itemStack : armorHelmets.keySet()) {
+ RenderHelper.enableGUIStandardItemLighting();
+ int integer = armorHelmets.get(itemStack).getRight();
+ x = guiLeft + 18;
+ y = guiTop + 50 + i;
+
+ Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(itemStack, x, y);
+ Utils.drawStringF(armorHelmets.get(itemStack).getLeft(), Minecraft.getMinecraft().fontRendererObj,
+ x + 20, y + 4, true, 0
+ );
+ try {
+ JsonElement jsonElement = rewards.get(integer - 1);
+ if (!jsonElement.isJsonNull()) {
+ Utils.drawStringF(check, Minecraft.getMinecraft().fontRendererObj,
+ x + 100, y + 2, true, 0
+ );
+ } else {
+ Utils.drawStringF(checkX, Minecraft.getMinecraft().fontRendererObj,
+ x + 100, y + 4, true, 0
+ );
+ }
+ } catch (IndexOutOfBoundsException exception) {
+ Utils.drawStringF(checkX, Minecraft.getMinecraft().fontRendererObj,
+ x + 100, y + 4, true, 0
+ );
+ }
+ i += 10;
+ }
+
+ GlStateManager.enableLighting();
+ }
+
+ private static List<String> getTooltip(TrophyFish fish) {
+ List<String> tooltip = new ArrayList<>();
+ tooltip.add(
+ internalTrophyFish.get(fish.getInternalName()) + WordUtils.capitalize(fish.getName().replace("_", " ")));
+ Map<TrophyFish.TrophyFishRarity, Integer> trophyFishRarityIntegerMap = fish.getTrophyFishRarityIntegerMap();
+ tooltip.add(" ");
+ tooltip.add(display(trophyFishRarityIntegerMap, TrophyFish.TrophyFishRarity.DIAMOND, EnumChatFormatting.AQUA));
+ tooltip.add(display(trophyFishRarityIntegerMap, TrophyFish.TrophyFishRarity.GOLD, EnumChatFormatting.GOLD));
+ tooltip.add(display(trophyFishRarityIntegerMap, TrophyFish.TrophyFishRarity.SILVER, EnumChatFormatting.GRAY));
+ tooltip.add(display(trophyFishRarityIntegerMap, TrophyFish.TrophyFishRarity.BRONZE, EnumChatFormatting.DARK_GRAY
+ ));
+ return tooltip;
+ }
+
+ private static List<String> getTooltipIfNotFound(String name) {
+ List<String> tooltip = new ArrayList<>();
+ tooltip.add(
+ internalTrophyFish.get(name.toLowerCase().replace(" ", "_")) + WordUtils.capitalize(name.replace("_", " ")));
+ tooltip.add(" ");
+ tooltip.add(EnumChatFormatting.RED + checkX + " Not Discovered");
+ tooltip.add(" ");
+ tooltip.add(display(null, TrophyFish.TrophyFishRarity.DIAMOND, EnumChatFormatting.AQUA));
+ tooltip.add(display(null, TrophyFish.TrophyFishRarity.GOLD, EnumChatFormatting.GOLD));
+ tooltip.add(display(null, TrophyFish.TrophyFishRarity.SILVER, EnumChatFormatting.GRAY));
+ tooltip.add(display(null, TrophyFish.TrophyFishRarity.BRONZE, EnumChatFormatting.DARK_GRAY));
+ return tooltip;
+ }
+
+ private static final String checkX = "§c✖";
+ private static final String check = "§a✔";
+
+ private static String display(
+ Map<TrophyFish.TrophyFishRarity, Integer> trophyFishRarityIntegerMap,
+ TrophyFish.TrophyFishRarity rarity, EnumChatFormatting color
+ ) {
+ String name = WordUtils.capitalize(rarity.name().toLowerCase());
+ if (trophyFishRarityIntegerMap == null) {
+ return color + name + ": " + checkX;
+ }
+
+ if (trophyFishRarityIntegerMap.containsKey(rarity)) {
+ return color + name + ": " + EnumChatFormatting.GOLD +
+ trophyFishRarityIntegerMap.get(rarity);
+ } else {
+ return color + name + ": " + checkX;
+ }
+ }
+
+ private static ItemStack getItem(String name) {
+ String repoName = name.toUpperCase().replace(" ", "_") + "_BRONZE";
+ JsonObject jsonItem = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(repoName);
+ return NotEnoughUpdates.INSTANCE.manager.jsonToStack(jsonItem);
+ }
+
+ private static JsonObject getTrophyInformation() {
+ trophyFishList.clear();
+
+ JsonObject trophyFishInformation = GuiProfileViewer.getProfile().getProfileInformation(GuiProfileViewer.getProfileId());
+ if (trophyFishInformation == null || !trophyFishInformation.has("trophy_fish")) {
+ return null;
+ }
+ JsonObject trophyObject = trophyFishInformation.get("trophy_fish").getAsJsonObject();
+ Map<String, List<Pair<TrophyFish.TrophyFishRarity, Integer>>> trophyFishRarityIntegerMap = new HashMap<>();
+ for (Map.Entry<String, JsonElement> stringJsonElementEntry : trophyObject.entrySet()) {
+ String key = stringJsonElementEntry.getKey();
+ if (key.equalsIgnoreCase("rewards") || key.equalsIgnoreCase("total_caught")) {
+ if (key.equalsIgnoreCase("total_caught")) {
+ totalCount = stringJsonElementEntry.getValue().getAsInt();
+ }
+ continue;
+ }
+
+ String[] s = key.split("_");
+ String type = s[s.length - 1];
+ TrophyFish.TrophyFishRarity trophyFishRarity;
+ int value = stringJsonElementEntry.getValue().getAsInt();
+
+ if (key.startsWith("golden_fish_")) {
+ type = s[2];
+ }
+ try {
+ trophyFishRarity = TrophyFish.TrophyFishRarity.valueOf(type.toUpperCase());
+ } catch (IllegalArgumentException ignored) {
+ total.put(WordUtils.capitalize(key), value);
+ continue;
+ }
+
+ String replace = key.replace("_" + type, "");
+ String name = WordUtils.capitalize(replace);
+ List<Pair<TrophyFish.TrophyFishRarity, Integer>> pairs;
+
+ if (trophyFishRarityIntegerMap.containsKey(name)) {
+ pairs = trophyFishRarityIntegerMap.get(name);
+ } else {
+ pairs = new ArrayList<>();
+ }
+ pairs.add(Pair.of(trophyFishRarity, value));
+ trophyFishRarityIntegerMap.put(name, pairs);
+ }
+
+ trophyFishRarityIntegerMap.forEach((name, pair) -> {
+ if (!TrophyFishingPage.trophyFishList.containsKey(name)) {
+ TrophyFish trophyFish = new TrophyFish(name, new HashMap<>());
+ trophyFish.addTotal(TrophyFishingPage.total.get(name));
+ for (Pair<TrophyFish.TrophyFishRarity, Integer> pair1 : pair) {
+
+ trophyFish.add(pair1.getKey(), pair1.getValue());
+ }
+ trophyFishList.put(name, trophyFish);
+ } else {
+ TrophyFish trophyFish = trophyFishList.get(name);
+ for (Pair<TrophyFish.TrophyFishRarity, Integer> pair1 : pair) {
+ trophyFish.add(pair1.getKey(), pair1.getValue());
+ }
+ }
+ });
+ return trophyFishInformation;
+ }
+
+ private static List<String> fixStringName(List<String> list) {
+ List<String> fixedList = new ArrayList<>();
+ for (String s : list) {
+ fixedList.add(s.toLowerCase().replace(" ", "_"));
+ }
+ return fixedList;
+ }
+}