aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorefefury <69400149+efefury@users.noreply.github.com>2023-07-19 12:15:58 +0200
committerGitHub <noreply@github.com>2023-07-19 20:15:58 +1000
commit27d5083b6c80036a5b69368fd20ae1d019036e1d (patch)
tree70bc873865386d4d732f1c343abc6ca6a148c3f3 /src
parent6c53c772c7f96da1775acf9314be10cc7df53f5b (diff)
downloadNotEnoughUpdates-27d5083b6c80036a5b69368fd20ae1d019036e1d.tar.gz
NotEnoughUpdates-27d5083b6c80036a5b69368fd20ae1d019036e1d.tar.bz2
NotEnoughUpdates-27d5083b6c80036a5b69368fd20ae1d019036e1d.zip
Rift Page in PV and several Level Page changes (#770)
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ProfileViewer.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java35
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java559
-rw-r--r--src/main/resources/assets/notenoughupdates/pv_rift.pngbin0 -> 3207 bytes
9 files changed, 627 insertions, 12 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index 16e513a9..6105ddb8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -246,6 +246,9 @@ public class NotEnoughUpdates {
if (config.profileViewer.pageLayout.size() == 11) {
config.profileViewer.pageLayout.add(11);
}
+ if (config.profileViewer.pageLayout.size() == 12) {
+ config.profileViewer.pageLayout.add(12);
+ }
// Remove after 2.1 ig
if ("dangerous".equals(config.apiData.repoBranch)) {
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 9064ea49..7e407298 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
@@ -76,10 +76,11 @@ public class ProfileViewer {
"\u00a7eBestiary",
"\u00a7eCrimson Isle",
"\u00a7eMuseum",
+ "\u00a7eRift"
},
allowDeleting = false
)
- public List<Integer> pageLayout = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11));
+ public List<Integer> pageLayout = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12));
@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 78c810a3..4df5a675 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
@@ -24,6 +24,7 @@ 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.profileviewer.bestiary.BestiaryPage;
+import io.github.moulberry.notenoughupdates.profileviewer.rift.RiftPage;
import io.github.moulberry.notenoughupdates.profileviewer.trophy.TrophyFishPage;
import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.DungeonsWeight;
import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.SkillsWeight;
@@ -212,6 +213,7 @@ public class GuiProfileViewer extends GuiScreen {
pages.put(ProfileViewerPage.BESTIARY, new BestiaryPage(this));
pages.put(ProfileViewerPage.CRIMSON_ISLE, new CrimsonIslePage(this));
pages.put(ProfileViewerPage.MUSEUM, new MuseumPage(this));
+ pages.put(ProfileViewerPage.RIFT, new RiftPage(this));
}
public static int getGuiLeft() {
@@ -1204,7 +1206,8 @@ public class GuiProfileViewer extends GuiScreen {
TROPHY_FISH(8, Items.fishing_rod, "§3Trophy Fish"),
BESTIARY(9, Items.iron_sword, "§cBestiary"),
CRIMSON_ISLE(10, Item.getItemFromBlock(Blocks.netherrack), "§4Crimson Isle"),
- MUSEUM(11, Items.leather_chestplate, "§6Museum");
+ MUSEUM(11, Items.leather_chestplate, "§6Museum"),
+ RIFT(12, Items.ender_eye, "§5Rift");
public final ItemStack stack;
public final int id;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java
index d8f7d17e..38e26a80 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java
@@ -110,6 +110,12 @@ public class ProfileViewerUtils {
// While there are several crab hats, only one of them counts towards the magical power
boolean countedCrabHat = false;
int powerAmount = 0;
+
+ if (profileInfo.has("rift") && profileInfo.getAsJsonObject("rift").has("access") && profileInfo.getAsJsonObject(
+ "rift").getAsJsonObject("access").has("consumed_prism")) { // should be true when existing ?
+ powerAmount += 11;
+ }
+
for (Map.Entry<String, Integer> entry : accessories.entrySet()) {
if (ignoredTalismans.contains(entry.getKey())) continue;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java
index de79c0b5..1633c593 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/CoreTaskLevel.java
@@ -133,26 +133,31 @@ public class CoreTaskLevel extends GuiTaskLevel {
}
int sbXpBankUpgrades = 0;
+ int sbXpTravelScroll = 0;
if (object.has("leveling") && object.getAsJsonObject("leveling").has("completed_tasks")) {
JsonArray completedTasks = object.getAsJsonObject("leveling").get("completed_tasks").getAsJsonArray();
JsonObject bankUpgradesXp = coreTask.getAsJsonObject("bank_upgrades_xp");
for (JsonElement completedTask : completedTasks) {
String name = completedTask.getAsString();
+ if (name.startsWith("FAST_TRAVEL_") && coreTask.has("fast_travel_unlocked_xp")) {
+ sbXpTravelScroll += coreTask.get("fast_travel_unlocked_xp").getAsInt();
+ }
if (bankUpgradesXp.has(name)) {
sbXpBankUpgrades += bankUpgradesXp.get(name).getAsInt();
}
}
}
+
List<String> lore = new ArrayList<>();
+ int totalXp = sbXpGainedSkillLVL + sbXpGainedFairy +
+ sbXpCollection + sbXpMinionTier + sbXpBankUpgrades + sbXpTravelScroll;
+
lore.add(levelPage.buildLore("Skill Level Up",
sbXpGainedSkillLVL, coreTask.get("skill_level_up").getAsInt(), false
));
- int totalXp = sbXpGainedSkillLVL + sbXpGainedFairy +
- sbXpCollection + sbXpMinionTier + sbXpBankUpgrades;
-
lore.add(levelPage.buildLore(
"Museum Progression",
0,
@@ -178,6 +183,9 @@ public class CoreTaskLevel extends GuiTaskLevel {
lore.add(levelPage.buildLore("Bank Upgrade",
sbXpBankUpgrades, coreTask.get("bank_upgrades").getAsInt(), false
));
+ lore.add(levelPage.buildLore("Fast Travel Scroll",
+ sbXpTravelScroll, coreTask.get("fast_travel_unlocked").getAsInt(), false
+ ));
levelPage.renderLevelBar(
"Core Task",
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java
index ee028683..f44e8af8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EventTaskLevel.java
@@ -69,6 +69,12 @@ public class EventTaskLevel extends GuiTaskLevel {
}
}
+ int sbXpUniqueMedals = 0;
+ if(object.has("jacob2") && object.getAsJsonObject("jacob2").has("unique_golds2")) {
+ int size = object.getAsJsonObject("jacob2").getAsJsonArray("unique_golds2").size();
+ sbXpUniqueMedals = size * eventTask.get("jacob_farming_contest_xp").getAsInt();
+ }
+
lore.add(levelPage.buildLore("Mining Fiesta", sbXpMiningFiesta, eventTask.get("mining_fiesta").getAsInt(), false));
lore.add(levelPage.buildLore(
"Fishing Festival",
@@ -77,6 +83,12 @@ public class EventTaskLevel extends GuiTaskLevel {
false
));
lore.add(levelPage.buildLore(
+ "Jacob's Farming Contest",
+ sbXpUniqueMedals,
+ eventTask.get("jacob_farming_contest").getAsInt(),
+ false
+ ));
+ lore.add(levelPage.buildLore(
"Spooky Festival",
sbXpSpookyFestival,
eventTask.get("spooky_festival").getAsInt(),
@@ -84,7 +96,7 @@ public class EventTaskLevel extends GuiTaskLevel {
));
int totalXp = sbXpMiningFiesta + sbXpSpookyFestival +
- sbXpFishingFestival;
+ sbXpFishingFestival + sbXpUniqueMedals;
levelPage.renderLevelBar(
"Event Task",
new ItemStack(Items.clock),
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java
index 3ce2a34d..992b2609 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java
@@ -69,8 +69,17 @@ public class MiscTaskLevel extends GuiTaskLevel {
}
int sbXpDojo = 0;
+ int sbXpRelays = 0;
if (object.has("nether_island_player_data")) {
JsonObject netherIslandPlayerData = object.getAsJsonObject("nether_island_player_data");
+ JsonObject abiphoneObject = netherIslandPlayerData.getAsJsonObject("abiphone");
+
+ if (abiphoneObject.has("operator_chip") &&
+ abiphoneObject.getAsJsonObject("operator_chip").has("repaired_index")) {
+ int repairedIndex = abiphoneObject.getAsJsonObject("operator_chip").get("repaired_index").getAsInt();
+ sbXpRelays += (repairedIndex + 1) * miscellaneousTask.get("unlocking_relays_xp").getAsInt();
+ }
+
if (netherIslandPlayerData.has("dojo")) {
JsonObject dojoScoresObj = netherIslandPlayerData.getAsJsonObject("dojo");
@@ -95,8 +104,7 @@ public class MiscTaskLevel extends GuiTaskLevel {
JsonArray completedTask = leveling.get("completed_tasks").getAsJsonArray();
Stream<JsonElement> stream = StreamSupport.stream(completedTask.spliterator(), true);
long activeContacts = stream.map(JsonElement::getAsString).filter(s -> s.startsWith("ABIPHONE_")).count();
- JsonObject abiphone = netherIslandPlayerData.getAsJsonObject("abiphone");
- if (abiphone.has("active_contacts")) {
+ if (abiphoneObject.has("active_contacts")) {
sbXpAbiphone = (int) activeContacts * miscellaneousTask.get("abiphone_contacts_xp").getAsInt();
}
}
@@ -112,7 +120,7 @@ public class MiscTaskLevel extends GuiTaskLevel {
for (JsonElement completedTask : completedTasks) {
String name = completedTask.getAsString();
String harpName = name.substring(0, name.lastIndexOf("_"));
- if(harpSongsNames.has(harpName))sbXpGainedHarp += harpSongsNames.get(harpName).getAsInt() / 4;
+ if (harpSongsNames.has(harpName)) sbXpGainedHarp += harpSongsNames.get(harpName).getAsInt() / 4;
}
}
@@ -157,6 +165,15 @@ public class MiscTaskLevel extends GuiTaskLevel {
}
}
+ int sbXpTimeCharm = 0;
+ if (object.has("rift") &&
+ object.getAsJsonObject("rift").has("gallery") &&
+ object.getAsJsonObject("rift").getAsJsonObject("gallery").has("secured_trophies")) {
+ JsonArray timeCharms = object.getAsJsonObject("rift").getAsJsonObject("gallery").getAsJsonArray(
+ "secured_trophies");
+ sbXpTimeCharm += timeCharms.size() * miscellaneousTask.get("timecharm_xp").getAsInt();
+ }
+
List<String> lore = new ArrayList<>();
lore.add(levelPage.buildLore("Accessory Bag Upgrades",
@@ -165,14 +182,16 @@ public class MiscTaskLevel extends GuiTaskLevel {
lore.add(levelPage.buildLore("Reaper Peppers",
sbXpReaperPeppers, miscellaneousTask.get("reaper_peppers").getAsInt(), false
));
+ lore.add(levelPage.buildLore("Timecharms",
+ sbXpTimeCharm, miscellaneousTask.get("timecharm").getAsInt(), false
+ ));
lore.add(levelPage.buildLore("Unlocking Powers",
sbXpUnlockedPowers, 0, true
));
lore.add(levelPage.buildLore("The Dojo",
sbXpDojo, miscellaneousTask.get("the_dojo").getAsInt(), false
));
- lore.add(levelPage.buildLore(
- "Harp Songs",
+ lore.add(levelPage.buildLore("Harp Songs",
sbXpGainedHarp, miscellaneousTask.get("harp_songs").getAsInt(), false
));
lore.add(levelPage.buildLore("Abiphone Contacts",
@@ -185,8 +204,12 @@ public class MiscTaskLevel extends GuiTaskLevel {
sbXpPersonalBank, miscellaneousTask.get("personal_bank_upgrades").getAsInt(), false
));
+ lore.add(levelPage.buildLore("Upgraded Relays",
+ sbXpRelays, miscellaneousTask.get("unlocking_relays").getAsInt(), false
+ ));
+
int totalXp = sbXpReaperPeppers + sbXpDojo + sbXpGainedHarp + sbXpAbiphone +
- sbXpCommunityUpgrade + sbXpPersonalBank;
+ sbXpCommunityUpgrade + sbXpPersonalBank + sbXpTimeCharm + sbXpRelays;
levelPage.renderLevelBar(
"Misc. Task",
new ItemStack(Items.map),
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java
new file mode 100644
index 00000000..0f2c4856
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java
@@ -0,0 +1,559 @@
+/*
+ * Copyright (C) 2023 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.rift;
+
+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.core.util.ArrowPagesUtils;
+import io.github.moulberry.notenoughupdates.core.util.StringUtils;
+import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay;
+import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
+import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewerPage;
+import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
+import io.github.moulberry.notenoughupdates.profileviewer.SkyblockProfiles;
+import io.github.moulberry.notenoughupdates.util.ItemUtils;
+import io.github.moulberry.notenoughupdates.util.PetLeveling;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.RenderHelper;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.CompressedStreamTools;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.opengl.GL11;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.Collections;
+import java.util.List;
+
+public class RiftPage extends GuiProfileViewerPage {
+
+ private static final ResourceLocation pv_rift = new ResourceLocation("notenoughupdates:pv_rift.png");
+
+ int pages = 0;
+
+ int onPage = 0;
+ private static final ResourceLocation CHEST_GUI_TEXTURE =
+ new ResourceLocation("textures/gui/container/generic_54.png");
+
+ boolean inInventory = true; // false = in enderchest
+
+ int guiLeft;
+ int guiTop;
+
+ private final ItemStack fillerStack = new ItemStack(Item.getItemFromBlock(Blocks.stained_glass_pane), 1, 15);
+
+ public RiftPage(GuiProfileViewer instance) {
+ super(instance);
+ }
+
+ @Override
+ public void drawPage(int mouseX, int mouseY, float partialTicks) {
+ guiLeft = GuiProfileViewer.getGuiLeft();
+ guiTop = GuiProfileViewer.getGuiTop();
+
+ Minecraft.getMinecraft().getTextureManager().bindTexture(pv_rift);
+ Utils.drawTexturedRect(guiLeft, guiTop, getInstance().sizeX, getInstance().sizeY, GL11.GL_NEAREST);
+
+ SkyblockProfiles.SkyblockProfile selectedProfile = getSelectedProfile();
+ if (selectedProfile == null) {
+ drawErrorMessage();
+ return;
+ }
+ JsonObject profileInfo = selectedProfile.getProfileJson();
+ if (!profileInfo.has("rift")) {
+ drawErrorMessage();
+ return;
+ }
+
+ JsonObject riftData = profileInfo.getAsJsonObject("rift");
+ JsonObject riftInventory = riftData.getAsJsonObject("inventory");
+ if (riftInventory == null) {
+ drawErrorMessage();
+ return;
+ }
+
+ JsonObject riftArmor = riftInventory.getAsJsonObject("inv_armor");
+ if (riftArmor != null && riftArmor.has("data")) {
+ List<JsonObject> armorData = readBase64(riftArmor.get("data").getAsString());
+ drawArmorAndEquipment(armorData, guiLeft, guiTop, 27, 64, mouseX, mouseY, true);
+ }
+
+ if (riftInventory.has("equippment_contents") &&
+ riftInventory.getAsJsonObject("equippment_contents").has("data")) {
+ List<JsonObject> equipmentData = readBase64(riftInventory
+ .getAsJsonObject("equippment_contents")
+ .get("data")
+ .getAsString());
+ drawArmorAndEquipment(equipmentData, guiLeft, guiTop, 46, 64, mouseX, mouseY, false);
+ }
+
+ // pet
+ Minecraft.getMinecraft().getTextureManager().bindTexture(GuiProfileViewer.pv_elements);
+ Utils.drawTexturedRect(guiLeft + 35, guiTop + 156, 20, 20, 0, 20 / 256f, 0, 20 / 256f, GL11.GL_NEAREST);
+
+ JsonObject deadCats = riftData.getAsJsonObject("dead_cats");
+ if (!deadCats.entrySet().isEmpty()) {
+ JsonArray foundCats = deadCats.getAsJsonArray("found_cats");
+
+ int size = foundCats.size();
+ int riftTime = size * 15;
+ int manaRegen = size * 2;
+
+ JsonObject montezuma = deadCats.getAsJsonObject("montezuma");
+ String montezumaType = montezuma.get("type").getAsString();
+
+ PetInfoOverlay.Pet pet = new PetInfoOverlay.Pet();
+ pet.petLevel = new PetLeveling.PetLevel(100, 100, 0, 0, 0, montezuma.get("exp").getAsInt());
+ pet.rarity = PetInfoOverlay.Rarity.valueOf(montezuma.get("tier").getAsString().toUpperCase());
+ pet.petType = montezumaType;
+ pet.candyUsed = montezuma.get("candyUsed").getAsInt();
+ ItemStack petItemstackFromPetInfo = ItemUtils.createPetItemstackFromPetInfo(pet);
+ Utils.drawItemStack(petItemstackFromPetInfo, guiLeft + 37, guiTop + 158, true);
+
+ if ((mouseX > guiLeft + 37 && mouseX < guiLeft + 37 + 20) &&
+ (mouseY > guiTop + 158 && mouseY < guiTop + 158 + 20)) {
+ List<String> tooltip = petItemstackFromPetInfo.getTooltip(Minecraft.getMinecraft().thePlayer, false);
+ tooltip.set(3, "§7Found: §9" + size + "/9 Soul Pieces");
+ tooltip.set(5, "§7Rift Time: §a+" + riftTime + "s");
+ tooltip.set(6, "§7Mana Regen: §a+" + manaRegen + "%");
+
+ getInstance().tooltipToDisplay = tooltip;
+ }
+ }
+
+ int motesPurse = 0;
+ if (profileInfo.has("motes_purse")) {
+ motesPurse = profileInfo.get("motes_purse").getAsInt();
+ }
+ Utils.drawStringCenteredScaledMaxWidth(
+ "§dMotes: §f" + Utils.shortNumberFormat(motesPurse, 0),
+ guiLeft + 45,
+ guiTop + 16,
+ true,
+ 84,
+ 0
+ );
+
+ if ((mouseX > guiLeft + 3 && mouseX < guiLeft + 90) &&
+ (mouseY > guiTop + 3 && mouseY < guiTop + 25)) {
+ JsonObject stats = profileInfo.get("stats").getAsJsonObject();
+ if (stats.has("rift_lifetime_motes_earned")) {
+ getInstance().tooltipToDisplay = Collections.singletonList(
+ "§dLifetime Motes: §f" + Utils.shortNumberFormat(stats.get("rift_lifetime_motes_earned").getAsInt(), 0));
+ }
+ }
+
+ // Timecharms
+
+ JsonObject gallery = riftData.getAsJsonObject("gallery");
+ JsonArray timecharm = gallery.getAsJsonArray("secured_trophies");
+ // 346, 16
+
+ if (timecharm != null) {
+ Utils.drawStringScaled(
+ EnumChatFormatting.RED + "Timecharms: §f" + timecharm.size() + "/7",
+ guiLeft + 336,
+ guiTop + 39,
+ true,
+ 0,
+ 1f
+ );
+
+ if ((mouseX > guiLeft + 336 && mouseX < guiLeft + 336 + 80) &&
+ (mouseY > guiTop + 39 && mouseY < guiTop + 39 + 15)) {
+
+ List<String> displayNames = new ArrayList<>();
+ for (JsonElement jsonElement : timecharm) {
+ String timecharmType = jsonElement.getAsJsonObject().get("type").getAsString();
+ String displayName = NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery().withKnownInternalName(
+ "RIFT_TROPHY_" + timecharmType.toUpperCase()).resolveToItemStack().getDisplayName();
+ displayNames.add(displayName + "§7: §a✔");
+ }
+ getInstance().tooltipToDisplay = displayNames;
+ }
+
+ renderItem("GLASS", 316, 36, guiLeft, guiTop);
+ }
+
+ JsonObject castleData = riftData.getAsJsonObject("castle");
+
+ int grubberStacks = 0;
+ if (castleData.has("grubber_stacks")) {
+ grubberStacks = castleData.get("grubber_stacks").getAsInt();
+ }
+
+ Utils.drawStringScaled(
+ EnumChatFormatting.GOLD + "Burger: §f" + grubberStacks + "/5",
+ guiLeft + 331,
+ guiTop + 87,
+ true,
+ 0,
+ 1f
+ );
+ renderItem("MCGRUBBER_BURGER", 314, +84, guiLeft, guiTop);
+
+ ProfileViewer.Level vampire = selectedProfile.getLevelingInfo().get("vampire");
+
+ Utils.renderAlignedString(
+ "§6Vampire",
+ EnumChatFormatting.WHITE.toString() + (int) vampire.level,
+ guiLeft + 336,
+ guiTop + 61,
+ 60
+ );
+
+ if (vampire.maxed) {
+ getInstance().renderGoldBar(guiLeft + 320, guiTop + 69, 90);
+ } else {
+ getInstance().renderBar(guiLeft + 320, guiTop + 69, 90, vampire.level % 1);
+ }
+
+ if (mouseX > guiLeft + 300 && mouseX < guiLeft + 410) {
+ if (mouseY > guiTop + 58 && mouseY < guiTop + 80) {
+ getInstance().tooltipToDisplay = new ArrayList<>();
+ List<String> tooltipToDisplay = getInstance().tooltipToDisplay;
+ tooltipToDisplay.add("§6Vampire Slayer");
+ if (vampire.maxed) {
+ tooltipToDisplay.add(
+ EnumChatFormatting.GRAY + "Progress: " + EnumChatFormatting.GOLD + "MAXED!");
+ } else {
+ int maxXp = (int) vampire.maxXpForLevel;
+ getInstance()
+ .tooltipToDisplay.add(
+ EnumChatFormatting.GRAY +
+ "Progress: " +
+ EnumChatFormatting.DARK_PURPLE +
+ StringUtils.shortNumberFormat(Math.round((vampire.level % 1) * maxXp)) +
+ "/" +
+ StringUtils.shortNumberFormat(maxXp));
+ }
+ }
+ }
+
+ JsonObject enigma = riftData.getAsJsonObject("enigma");
+ int foundSouls = 0;
+ if (enigma.has("found_souls")) {
+ foundSouls = enigma.getAsJsonArray("found_souls").size();
+ }
+
+ Utils.drawStringScaled(
+ EnumChatFormatting.DARK_PURPLE + "Enigma Souls: §f" + foundSouls + "/42",
+ guiLeft + 331,
+ guiTop + 110,
+ true,
+ 0,
+ 0.9f
+ );
+
+ renderItem("SKYBLOCK_ENIGMA_SOUL", 314, 106, guiLeft, guiTop);
+
+ // button
+
+ addInventoryButton(156, 16, guiLeft, guiTop, mouseX, mouseY, "§7Inventory", "CHEST");
+ addInventoryButton(222, 16, guiLeft, guiTop, mouseX, mouseY, "§7Ender Chest", "ENDER_CHEST");
+
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
+
+ int inventoryRows = inInventory ? 4 : 5;
+ int invSizeY = inventoryRows * 18 + 17 + 7;
+
+ int inventoryX = guiLeft + 203 - 176 / 2;
+ int inventoryY = guiTop + 130 - invSizeY / 2;
+ getInstance().drawTexturedModalRect(inventoryX, inventoryY, 0, 0, 176, inventoryRows * 18 + 17);
+ getInstance().drawTexturedModalRect(inventoryX, inventoryY + inventoryRows * 18 + 17, 0, 215, 176, 7);
+
+ Utils.drawStringF(
+ inInventory ? "Inventory" : "Ender Chest",
+ guiLeft + 122,
+ inInventory ? guiTop + 87 + 1 : guiTop + 79,
+ false,
+ 4210752
+ );
+
+ if (!inInventory) {
+ if (!riftInventory.has("ender_chest_contents")) {
+ drawErrorMessage();
+ return;
+ }
+ JsonObject enderChestContents = riftInventory.getAsJsonObject("ender_chest_contents");
+ String data = enderChestContents.get("data").getAsString();
+ List<JsonObject> jsonObjects = readBase64(data);
+ pages = (int) (Math.ceil(jsonObjects.size() / 45d));
+
+ drawArrows(onPage, pages, 190, 77);
+
+ for (int i = 0; i <= pages; i++) {
+ if (i != onPage) continue;
+
+ List<JsonObject> page = jsonObjects.subList(
+ Math.min(i == 0 ? 0 : i * 45, jsonObjects.size() - 45),
+ i == 0 ? 45 : jsonObjects.size()
+ ); // if anybody has an idea how to make this less hard coded on 2 pages (more pages) please do it for me, i am doing this at 4 am
+
+ int row = 0;
+ int slot = 0;
+
+ for (int j = 0; j < page.size(); j++) {
+ JsonObject jsonObject = page.get(j);
+ if (j % 9 == 0 && j > 0) {
+ slot = 0;
+ row++;
+ }
+
+ int x = (inventoryX - guiLeft) + 8 + (slot * 18);
+ int y = 91 + (row * 18);
+ slot++;
+ if (jsonObject != null) {
+ ItemStack itemStack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(jsonObject);
+
+ if ((mouseX >= guiLeft + x && mouseX <= guiLeft + x + 16) &&
+ (mouseY >= guiTop + y && mouseY <= guiTop + y + 16)) {
+ getInstance().tooltipToDisplay =
+ itemStack.getTooltip(
+ Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().gameSettings.advancedItemTooltips
+ );
+ }
+ renderItem(itemStack, x, y, guiLeft, guiTop);
+ }
+ }
+ }
+ } else {
+
+ if (riftInventory == null || !riftInventory.has("inv_contents")) {
+ drawErrorMessage();
+ return;
+ }
+ String invData = riftInventory.getAsJsonObject("inv_contents").get("data").getAsString();
+ List<JsonObject> jsonObjects = readBase64(invData);
+
+ List<JsonObject> hotbar = new ArrayList<>();
+ for (int i = 0; i < 9; i++) {
+ hotbar.add(jsonObjects.get(i));
+ }
+ jsonObjects.removeAll(hotbar);
+ int hotbarSlot = 0;
+ for (JsonObject jsonObject : hotbar) {
+ if (jsonObject != null) {
+ int drawX = 123 + (hotbarSlot * 18);
+ ItemStack itemStack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(jsonObject);
+
+ if ((mouseX >= guiLeft + drawX && mouseX <= guiLeft + drawX + 16) &&
+ (mouseY >= guiTop + 154 && mouseY <= guiTop + 154 + 16)) {
+ getInstance().tooltipToDisplay =
+ itemStack.getTooltip(
+ Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().gameSettings.advancedItemTooltips
+ );
+ }
+
+ renderItem(itemStack, drawX, 154, guiLeft, guiTop);
+ }
+ hotbarSlot++;
+
+ }
+
+ int row = 1;
+ int slot = 0;
+ for (int i = 0; i < jsonObjects.size(); i++) {
+ JsonObject jsonObject = jsonObjects.get(i);
+ if (i % 9 == 0 && i > 0) {
+ slot = 0;
+ row++;
+ }
+
+ if (jsonObject != null) {
+ ItemStack itemStack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(jsonObject);
+ int x1 = (inventoryX - guiLeft) + (slot * 18) + 8;
+ int y1 = (inventoryY - guiTop) + (row * 18);
+ if ((mouseX >= guiLeft + x1 && mouseX <= guiLeft + x1 + 16) &&
+ (mouseY >= guiTop + y1 && mouseY <= guiTop + y1 + 16)) {
+ getInstance().tooltipToDisplay =
+ itemStack.getTooltip(
+ Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().gameSettings.advancedItemTooltips
+ );
+ }
+ renderItem(itemStack, x1, y1, guiLeft, guiTop);
+ }
+ slot++;
+ }
+ }
+ }
+
+ private void drawArrows(int page, int maxPages, int x, int y) {
+ ArrowPagesUtils.onDraw(guiLeft, guiTop, new int[]{x, y}, page, maxPages);
+ }
+
+ @Override
+ public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
+ super.mouseClicked(mouseX, mouseY, mouseButton);
+ if ((mouseX >= guiLeft + 156 - 1 && mouseX <= guiLeft + 156 + 20) &&
+ (mouseY >= guiTop + 16 && mouseY <= guiTop + 16 + 20)) {
+ inInventory = true;
+ Utils.playPressSound();
+ }
+ ArrowPagesUtils.onPageSwitchMouse(
+ guiLeft,
+ guiTop,
+ new int[]{190, 77},
+ onPage,
+ pages,
+ pageChange -> {
+ onPage = pageChange;
+ }
+ );
+
+ if ((mouseX >= guiLeft + 222 - 1 && mouseX <= guiLeft + 222 + 20) &&
+ (mouseY >= guiTop + 16 && mouseY <= guiTop + 16 + 20)) {
+ inInventory = false;
+ Utils.playPressSound();
+ }
+ return false;
+ }
+
+ @Override
+ public void keyTyped(char typedChar, int keyCode) throws IOException {
+ super.keyTyped(typedChar, keyCode);
+
+ if (getInstance().playerNameTextField.getFocus()) return;
+ switch (keyCode) {
+ case Keyboard.KEY_1:
+ inInventory = true;
+ Utils.playPressSound();
+ break;
+ case Keyboard.KEY_2:
+ inInventory = false;
+ Utils.playPressSound();
+ break;
+ }
+ }
+
+ public void addInventoryButton(
+ int x,
+ int y,
+ int guiLeft,
+ int guiTop,
+ int mouseX,
+ int mouseY,
+ String title,
+ String internalNameForItem
+ ) {
+ Minecraft.getMinecraft().getTextureManager().bindTexture(GuiProfileViewer.pv_elements);
+ if (internalNameForItem.equals("CHEST") && inInventory) {
+ Utils.drawTexturedRect(guiLeft + x, guiTop + y, 20, 20, 20 / 256f, 0, 20 / 256f, 0, GL11.GL_NEAREST);
+ } else if (internalNameForItem.equals("ENDER_CHEST") && !inInventory) {
+ Utils.drawTexturedRect(guiLeft + x, guiTop + y, 20, 20, 20 / 256f, 0, 20 / 256f, 0, GL11.GL_NEAREST);
+ } else {
+ // should never happen
+ Utils.drawTexturedRect(guiLeft + x, guiTop + y, 20, 20, 0, 20 / 256f, 0, 20 / 256f, GL11.GL_NEAREST);
+ }
+ renderItem(internalNameForItem, x + 2, y + 2, guiLeft, guiTop);
+
+ if ((mouseX >= guiLeft + x - 1 && mouseX <= guiLeft + x + 20) &&
+ (mouseY >= guiTop + y && mouseY <= guiTop + y + 20)) {
+ getInstance().tooltipToDisplay = Collections.singletonList(title);
+ }
+ }
+
+ public void renderItem(String internalName, int x, int y, int guiLeft, int guiTop) {
+ ItemStack itemStack = NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery().withKnownInternalName(
+ internalName).resolveToItemStack();
+ renderItem(itemStack, x, y, guiLeft, guiTop);
+ }
+
+ public void renderItem(ItemStack itemStack, int x, int y, int guiLeft, int guiTop) {
+ GlStateManager.disableLighting();
+ RenderHelper.enableGUIStandardItemLighting();
+ Utils.drawItemStack(itemStack, guiLeft + x, guiTop + y);
+ GlStateManager.enableLighting();
+ RenderHelper.disableStandardItemLighting();
+ }
+
+ public void drawArmorAndEquipment(
+ List<JsonObject> jsonObjects,
+ int guiLeft,
+ int guiTop,
+ int x,
+ int y,
+ int mouseX,
+ int mouseY,
+ boolean reverse
+ ) {
+
+ ItemStack[] itemStacks = new ItemStack[4];
+ if (reverse) Collections.reverse(jsonObjects); // is this intensive??
+ for (int i = 0; i < jsonObjects.size(); i++) {
+ JsonObject json = jsonObjects.get(i);
+ if (json == null) continue;
+ ItemStack itemStack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(json, false);
+ if (itemStack == null) itemStack = fillerStack;
+ itemStacks[i] = itemStack;
+ }
+
+ for (int i = 0; i < itemStacks.length; i++) {
+ ItemStack stack = itemStacks[i];
+ if (stack == null) continue;
+ Utils.drawItemStack(stack, guiLeft + x, guiTop + y + (i * 18), true);
+ if (stack == fillerStack) continue;
+ if ((mouseX >= guiLeft + x - 1 && mouseX <= guiLeft + x + 16 + 1) &&
+ (mouseY >= guiTop + y + (i * 18) && mouseY <= guiTop + y + (i * 18) + 16)) {
+ getInstance().tooltipToDisplay =
+ stack.getTooltip(
+ Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().gameSettings.advancedItemTooltips
+ );
+ }
+ }
+ }
+
+ public List<JsonObject> readBase64(String data) {
+ List<JsonObject> itemStacks = new ArrayList<>();
+ try {
+ NBTTagList items = CompressedStreamTools.readCompressed(
+ new ByteArrayInputStream(Base64.getDecoder().decode(data))
+ ).getTagList("i", 10);
+ for (int j = 0; j < items.tagCount(); j++) {
+ JsonObject item = NotEnoughUpdates.INSTANCE.manager.getJsonFromNBTEntry(items.getCompoundTagAt(j));
+ itemStacks.add(item);
+ }
+ } catch (IOException ignored) {
+ }
+ return itemStacks;
+ }
+
+ public void drawErrorMessage() {
+ String message = EnumChatFormatting.RED + "No Rift data available!";
+ Utils.drawStringCentered(message, guiLeft + 431 / 2f, guiTop + 101, true, 0);
+ }
+}
diff --git a/src/main/resources/assets/notenoughupdates/pv_rift.png b/src/main/resources/assets/notenoughupdates/pv_rift.png
new file mode 100644
index 00000000..15199dbc
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/pv_rift.png
Binary files differ