aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorefefury <69400149+efefury@users.noreply.github.com>2022-07-10 16:04:00 +0200
committerGitHub <noreply@github.com>2022-07-11 00:04:00 +1000
commit04d6f54c067a5cdab61186eb37f67fef11affa57 (patch)
tree7fac9ce78eab682d64d4d0b69787636895247ee1
parent6e40cd5d2426eee681b091acc6e0822d4d7c45b5 (diff)
downloadNotEnoughUpdates-04d6f54c067a5cdab61186eb37f67fef11affa57.tar.gz
NotEnoughUpdates-04d6f54c067a5cdab61186eb37f67fef11affa57.tar.bz2
NotEnoughUpdates-04d6f54c067a5cdab61186eb37f67fef11affa57.zip
ah profit cool gui display (#178)
Co-authored-by: Lulonaut <lulonaut@tutanota.de> Co-authored-by: nopo <noahogno@gmail.com>
-rw-r--r--Update Notes/2.1.md3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dungeon/MapCommand.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/profile/PeekCommand.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java16
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java177
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AHTweaks.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ApiData.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java18
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java12
-rw-r--r--src/main/resources/assets/notenoughupdates/auction_profit.pngbin0 -> 595 bytes
18 files changed, 249 insertions, 11 deletions
diff --git a/Update Notes/2.1.md b/Update Notes/2.1.md
index 5ab5ec19..4d43844a 100644
--- a/Update Notes/2.1.md
+++ b/Update Notes/2.1.md
@@ -98,7 +98,8 @@
- Added an option to only search for Level 100 pets in the auction house search overlay - Lulonaut
- [Added an error if you have new tab list off](https://cdn.discordapp.com/attachments/896407218151366687/913681097605398528/unknown.png) - nopo
- Added Fishing Timer over bobber - nea89
-
+- [Auction Profit Viewer Overlay](https://cdn.discordapp.com/attachments/848901833119629332/993191851400101918/176946124-28ddf336-1ec7-460b-b22a-5fe2733b46a3.png)
+-
### **Bug Fixes:**
- Fixed wiki pages freezing the entire game - nea89
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index 59e7c392..3ef305f2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -33,6 +33,7 @@ import io.github.moulberry.notenoughupdates.listener.ItemTooltipListener;
import io.github.moulberry.notenoughupdates.listener.NEUEventListener;
import io.github.moulberry.notenoughupdates.listener.OldAnimationChecker;
import io.github.moulberry.notenoughupdates.listener.RenderListener;
+import io.github.moulberry.notenoughupdates.miscfeatures.AuctionProfit;
import io.github.moulberry.notenoughupdates.miscfeatures.CookieWarning;
import io.github.moulberry.notenoughupdates.miscfeatures.CrystalOverlay;
import io.github.moulberry.notenoughupdates.miscfeatures.CrystalWishingCompassSolver;
@@ -267,6 +268,7 @@ public class NotEnoughUpdates {
MinecraftForge.EVENT_BUS.register(new ItemCooldowns());
MinecraftForge.EVENT_BUS.register(new DwarvenMinesWaypoints());
MinecraftForge.EVENT_BUS.register(new FuelBar());
+ MinecraftForge.EVENT_BUS.register(new AuctionProfit());
MinecraftForge.EVENT_BUS.register(XPInformation.getInstance());
MinecraftForge.EVENT_BUS.register(OverlayManager.petInfoOverlay);
MinecraftForge.EVENT_BUS.register(OverlayManager.timersOverlay);
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 529f8e57..83db26bb 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
@@ -52,7 +52,7 @@ public class MapCommand extends ClientCommandBase {
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 "));
+ 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;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.java
index a52fcd1d..7655f561 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/help/HelpCommand.java
@@ -50,7 +50,6 @@ public class HelpCommand extends ClientCommandBase {
"\u00a76/neulinks \u00a7r\u00a77- Shows links to neu/moulberry.",
"\u00a76/neuoverlay \u00a7r\u00a77- Opens GUI Editor for quickcommands and searchbar.",
"\u00a76/neuah \u00a7r\u00a77- Opens neu's custom ah GUI.",
- "\u00a76/neumap \u00a7r\u00a77- Opens the dungeon map GUI.",
"\u00a76/neucalendar \u00a7r\u00a77- Opens neu's custom calendar GUI.",
"\u00a76/neucalc \u00a7r\u00a77- Run calculations.",
"",
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/PeekCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/PeekCommand.java
index 3133edf5..21afff87 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/PeekCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/profile/PeekCommand.java
@@ -102,6 +102,7 @@ public class PeekCommand extends ClientCommandBase {
boolean isMe = name.equalsIgnoreCase("moulberry");
PlayerStats.Stats stats = profile.getStats(null);
+ if (stats == null) return;
JsonObject skill = profile.getSkillInfo(null);
Minecraft.getMinecraft().ingameGUI
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
index aedca6e3..459a7231 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
@@ -35,6 +35,7 @@ import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper;
import io.github.moulberry.notenoughupdates.dungeons.DungeonWin;
import io.github.moulberry.notenoughupdates.itemeditor.NEUItemEditor;
import io.github.moulberry.notenoughupdates.miscfeatures.AuctionBINWarning;
+import io.github.moulberry.notenoughupdates.miscfeatures.AuctionProfit;
import io.github.moulberry.notenoughupdates.miscfeatures.BetterContainers;
import io.github.moulberry.notenoughupdates.miscfeatures.CrystalMetalDetectorSolver;
import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager;
@@ -501,6 +502,11 @@ public class RenderListener {
x += 80 + 28;
}
}
+ if (AuctionProfit.inAuctionPage()) {
+ if (x + 18 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 && y < guiTop + 56) {
+ x -= 68 - 200;
+ }
+ }
if (NEUOverlay.isRenderingArmorHud()) {
if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop && y < guiTop + 84) {
x -= 25;
@@ -608,6 +614,11 @@ public class RenderListener {
x += 80 + 28;
}
}
+ if (AuctionProfit.inAuctionPage()) {
+ if (x + 18 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 && y < guiTop + 56) {
+ x -= 68 - 200;
+ }
+ }
if (NEUOverlay.isRenderingArmorHud()) {
if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop && y < guiTop + 84) {
x -= 25;
@@ -1005,6 +1016,11 @@ public class RenderListener {
x += 80 + 28;
}
}
+ if (AuctionProfit.inAuctionPage()) {
+ if (x + 18 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 && y < guiTop + 56) {
+ x -= 68 - 200;
+ }
+ }
if (NEUOverlay.isRenderingArmorHud()) {
if (x < guiLeft + xSize - 150 && x > guiLeft + xSize - 200 && y > guiTop && y < guiTop + 84) {
x -= 25;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java
new file mode 100644
index 00000000..03f19bd8
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java
@@ -0,0 +1,177 @@
+/*
+ * 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.miscfeatures;
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.miscfeatures.entityviewer.InvisibleModifier;
+import io.github.moulberry.notenoughupdates.mixins.AccessorGuiContainer;
+import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ContainerChest;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.client.event.GuiScreenEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import org.lwjgl.opengl.GL11;
+
+public class AuctionProfit {
+
+ public static final ResourceLocation auctionProfitImage =
+ new ResourceLocation("notenoughupdates:auction_profit.png");
+
+ @SubscribeEvent
+ public void onDrawBackground(GuiScreenEvent.BackgroundDrawnEvent event) {
+ if(!inAuctionPage()) return;
+
+ Minecraft minecraft = Minecraft.getMinecraft();
+ Container inventoryContainer = minecraft.thePlayer.openContainer;
+
+ Gui gui = event.gui;
+ int xSize = ((AccessorGuiContainer) gui).getXSize();
+ int guiLeft = ((AccessorGuiContainer) gui).getGuiLeft();
+ int guiTop = ((AccessorGuiContainer) gui).getGuiTop();
+ minecraft.getTextureManager().bindTexture(auctionProfitImage);
+ GL11.glColor4f(1, 1, 1, 1);
+ GlStateManager.disableLighting();
+ Utils.drawTexturedRect(guiLeft + xSize + 4, guiTop, 180, 101, 0, 180 / 256f, 0, 101 / 256f, GL11.GL_NEAREST);
+
+ double coinsToCollect = 0;
+ double coinsIfAllSold = 0;
+ int expiredAuctions = 0;
+ int unclaimedAuctions = 0;
+ for (ItemStack itemStack : inventoryContainer.getInventory()) {
+ boolean isBin = false;
+ if (itemStack == null || !itemStack.hasTagCompound()) continue;
+
+ NBTTagCompound tag = itemStack.getTagCompound();
+ if (tag == null) continue;
+ NBTTagCompound display = tag.getCompoundTag("display");
+ if (!display.hasKey("Lore", 9)) continue;
+ NBTTagList lore = itemStack.getTagCompound().getCompoundTag("display").getTagList("Lore", 8);
+
+ int coinsToCheck = 0;
+ for (int i = 0; i < lore.tagCount(); i++) {
+ String line = lore.getStringTagAt(i);
+ if (line.contains("§7Buy it now")) {
+ isBin = true;
+ String s = line.split("§7Buy it now: ")[1];
+ String coinsString = s.split("coins")[0];
+ int coins = tryParse(EnumChatFormatting.getTextWithoutFormattingCodes(coinsString.trim()));
+ if (coins != 0) {
+ coinsToCheck += coins;
+ }
+ }
+
+ if (line.contains("§7Top bid: ")) {
+ String s = line.split("§7Top bid: ")[1];
+ String coinsString = s.split("coins")[0];
+ String textWithoutFormattingCodes = EnumChatFormatting.getTextWithoutFormattingCodes(coinsString.trim());
+ int coins = tryParse(textWithoutFormattingCodes);
+ if (coins != 0) {
+ coinsToCheck += coins;
+ }
+ }
+
+ if (line.contains("§7Sold for: ")) {
+ String s = line.split("§7Sold for: ")[1];
+ String coinsString = s.split("coins")[0];
+ int coins = tryParse(EnumChatFormatting.getTextWithoutFormattingCodes(coinsString.trim()));
+ if (coins != 0) {
+ if (coins > 1000000) {
+ coins /= 1.1;
+ }
+ coinsToCollect += coins;
+ }
+ }
+
+ if (line.contains("§7Status: §aSold!") || line.contains("§7Status: §aEnded!")) {
+ if (coinsToCheck != 0) {
+ if (coinsToCheck > 1000000) {
+ coinsToCheck /= 1.1;
+ }
+ coinsToCollect += coinsToCheck;
+ coinsToCheck = 0;
+ }
+ unclaimedAuctions++;
+ } else if (line.contains("§7Status: §cExpired!")) {
+ expiredAuctions++;
+ }
+
+ if (isBin && line.contains("§7Ends in") && coinsToCheck != 0) {
+ coinsIfAllSold += coinsToCheck;
+ coinsToCheck = 0;
+ }
+
+ }
+
+ }
+ int a = guiLeft + xSize + 4;
+ String unclaimedAuctionsStr = EnumChatFormatting.DARK_GREEN.toString()
+ + unclaimedAuctions + EnumChatFormatting.BOLD + EnumChatFormatting.DARK_GRAY + " Unclaimed auctions";
+ String expiredAuctionsStr =
+ EnumChatFormatting.RED.toString() + expiredAuctions + EnumChatFormatting.BOLD + EnumChatFormatting.DARK_GRAY +
+ " Expired auctions";
+
+ FontRenderer fontRendererObj = minecraft.fontRendererObj;
+ fontRendererObj.drawString(unclaimedAuctionsStr, a + 6, guiTop + 6, -1, false);
+ fontRendererObj.drawString(expiredAuctionsStr, a + 6, guiTop + 16, -1, false);
+
+ String coinsToCollectStr =
+ EnumChatFormatting.BOLD + EnumChatFormatting.DARK_GRAY.toString() + "Coins to collect: " +
+ EnumChatFormatting.RESET + EnumChatFormatting.DARK_GREEN + "" +
+ GuiProfileViewer.shortNumberFormat(coinsToCollect, 0);
+ String valueIfSoldStr = EnumChatFormatting.BOLD + EnumChatFormatting.DARK_GRAY.toString() + "Value if all sold: " +
+ EnumChatFormatting.RESET + EnumChatFormatting.DARK_GREEN + "" +
+ GuiProfileViewer.shortNumberFormat(coinsIfAllSold, 0);
+
+ fontRendererObj.drawString(coinsToCollectStr, a + 6, guiTop + 32, -1, false);
+ fontRendererObj.drawString(valueIfSoldStr, a + 6, guiTop + 42, -1, false);
+ }
+
+ public static Integer tryParse(String s) {
+ try {
+ return Integer.parseInt(s.replace(",", ""));
+ } catch (NumberFormatException exception) {
+ return 0;
+ }
+ }
+
+ public static boolean inAuctionPage() {
+ if (!NotEnoughUpdates.INSTANCE.config.ahTweaks.enableAhSellValue
+ || !NotEnoughUpdates.INSTANCE.isOnSkyblock()) return false;
+
+ Minecraft minecraft = Minecraft.getMinecraft();
+ if (minecraft == null || minecraft.thePlayer == null) return false;
+
+ Container inventoryContainer = minecraft.thePlayer.openContainer;
+ if (!(inventoryContainer instanceof ContainerChest)) return false;
+ ContainerChest containerChest = (ContainerChest) inventoryContainer;
+ return containerChest.getLowerChestInventory().getDisplayName()
+ .getUnformattedText().equalsIgnoreCase("Manage Auctions");
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java
index 9c2549b8..7fc8beba 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SunTzu.java
@@ -56,7 +56,8 @@ public class SunTzu {
"The wise warrior avoids the battle.",
"Great results, can be achieved with small forces.",
"Attack is the secret of defense; defense is the planning of an attack.",
- "Subscribe to Moulberry on YouTube."
+ "Subscribe to Moulberry on YouTube.",
+ "Technoblade never dies!"
};
public static void setEnabled(boolean enabled) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AHTweaks.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AHTweaks.java
index 7c8446b0..298ddeda 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AHTweaks.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/AHTweaks.java
@@ -137,4 +137,13 @@ public class AHTweaks {
@ConfigEditorBoolean
@ConfigAccordionId(id = 2)
public boolean enableSortWarning = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Enable AH Sell Value",
+ desc = "Display profit information (coins to collect, value if all sold, expired and unclaimed auctions)"
+ )
+ @ConfigEditorBoolean
+ public boolean enableAhSellValue = true;
+
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ApiData.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ApiData.java
index 3fc72db5..9ed09ac3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ApiData.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ApiData.java
@@ -62,7 +62,7 @@ public class ApiData {
public int setRepositoryToDefaultButton = 0;
@ConfigAccordionId(id = 1)
- @ConfigOption(name = "Use dangerous Repository", desc = "The latest, most up to date item list for the NEU prereleases.\n§4Use §lonly§r§4 with the prereleases.")
+ @ConfigOption(name = "Use pre-release repository", desc = "The latest, most up to date item list for the NEU pre-releases.\n§4Use §lonly§r§4 with the pre-releases.")
@ConfigEditorButton(runnableId = 24, buttonText = "Use")
public int setRepositoryToDangerousButton = 0;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java
index 1c825cdf..8f7bc15c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java
@@ -31,6 +31,7 @@ import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditor
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
public class Dungeons {
+ /*
@ConfigOption(
name = "Dungeon Map",
desc = ""
@@ -38,6 +39,8 @@ public class Dungeons {
@ConfigEditorAccordion(id = 0)
public boolean dungeonMapAccordion = false;
+ */
+
@Expose
@ConfigOption(
name = "\u00A7cWarning",
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
index 5510023c..411a56d8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
@@ -879,4 +879,3 @@ public class TimersOverlay extends TextOverlay {
ALWAYS,
}
}
-
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 457f7c34..87bab220 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
@@ -46,6 +46,7 @@ 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.enchantment.Enchantment;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EnumPlayerModelParts;
import net.minecraft.init.Blocks;
@@ -300,6 +301,11 @@ public class GuiProfileViewer extends GuiScreen {
private static JsonObject getPetInfo(String pet_name, String rarity) {
JsonObject petInfo = new JsonObject();
+ if (Constants.PETS == null) {
+ Utils.showOutdatedRepoNotification();
+ return null;
+ }
+
if (Constants.PETS.has("custom_pet_leveling") &&
Constants.PETS.getAsJsonObject("custom_pet_leveling").has(pet_name)) {
JsonObject pet = Constants.PETS.getAsJsonObject("custom_pet_leveling").getAsJsonObject(pet_name);
@@ -346,6 +352,9 @@ public class GuiProfileViewer extends GuiScreen {
public static PetLevel getPetLevel(String pet_name, String rarity, float exp) {
JsonObject petInfo = getPetInfo(pet_name, rarity);
+ if (petInfo == null) {
+ return null;
+ }
int offset = petInfo.get("offset").getAsInt();
int maxPetLevel = petInfo.get("max_level").getAsInt();
JsonArray levels = petInfo.getAsJsonArray("pet_levels");
@@ -4647,6 +4656,15 @@ public class GuiProfileViewer extends GuiScreen {
String locationStr = null;
if (profile.getUuid().equals("20934ef9488c465180a78f861586b4cf")) {
locationStr = "Ignoring DMs";
+ } else if(profile.getUuid().equals("b876ec32e396476ba1158438d83c67d4")) {
+ statusStr = EnumChatFormatting.LIGHT_PURPLE + "Long live Potato King";
+ ItemStack potato_crown = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager
+ .getItemInformation()
+ .get("POTATO_CROWN"));
+ potato_crown.addEnchantment(Enchantment.unbreaking, 1656638942); // this number may be useful
+ Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(new ItemStack(Items.potato), guiLeft + 35, guiTop + 160);
+ Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(potato_crown, guiLeft + 50, guiTop + 162);
+ Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(new ItemStack(Items.potato), guiLeft + 63, guiTop + 160);
} else {
locationStr = NotEnoughUpdates.INSTANCE.navigation.getNameForAreaModeOrUnknown(location);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java
index 8d24a082..19668019 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java
@@ -559,7 +559,7 @@ public class PlayerStats {
}
GuiProfileViewer.PetLevel levelObj = GuiProfileViewer.getPetLevel(petname, tier, exp);
-
+ if (levelObj == null) return null;
float level = levelObj.level;
float currentLevelRequirement = levelObj.currentLevelRequirement;
float maxXP = levelObj.maxXP;
@@ -702,6 +702,7 @@ public class PlayerStats {
}
Stats petBonus = getPetStatBonuses(petsInfo);
+ if (petBonus == null) return null;
stats = stats.add(passiveBonuses).add(armorBonuses).add(talismanBonuses).add(petBonus).add(hotmBonuses);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
index d8e47fa3..7ed3a799 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
@@ -1418,6 +1418,7 @@ public class ProfileViewer {
PlayerStats.getStats(getSkillInfo(profileId), getInventoryInfo(profileId), getCollectionInfo(profileId),
getPetsInfo(profileId), profileInfo
);
+ if (stats == null) return null;
this.stats.put(profileId, stats);
return stats;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
index 3745d72e..f45b840c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
@@ -1937,10 +1937,8 @@ public class Utils {
NotificationHandler.displayNotification(Lists.newArrayList(
EnumChatFormatting.RED + EnumChatFormatting.BOLD.toString() + "Missing repo data",
EnumChatFormatting.RED + "Data used for many NEU features is not up to date, this should normally not be the case.",
- EnumChatFormatting.RED + "You can try " + EnumChatFormatting.BOLD + "/neuresetrepo" + EnumChatFormatting.RESET +
- EnumChatFormatting.RED + " to see if that fixes the issue.",
- EnumChatFormatting.RED + "If the problem persists please join " + EnumChatFormatting.BOLD +
- "discord.gg/moulberry" +
+ EnumChatFormatting.RED + "You can try " + EnumChatFormatting.BOLD + "/neuresetrepo" + EnumChatFormatting.RESET + EnumChatFormatting.RED +" and restart your game" +
+ " to see if that fixes the issue.", EnumChatFormatting.RED + "If the problem persists please join " + EnumChatFormatting.BOLD + "discord.gg/moulberry" +
EnumChatFormatting.RESET + EnumChatFormatting.RED + " and message in " + EnumChatFormatting.BOLD +
"#neu-support" + EnumChatFormatting.RESET + EnumChatFormatting.RED + " to get support"
),
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java
index 158f9917..80027aff 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/XPInformation.java
@@ -249,9 +249,21 @@ public class XPInformation {
}
public double getPetLevel(String petId, double exp, String rarity) {
+ if (Constants.PETS == null || !Constants.PETS.has("pet_levels")) {
+ Utils.showOutdatedRepoNotification();
+ return 0;
+ }
Stream<JsonElement> pet_levels =
StreamSupport.stream(Constants.PETS.get("pet_levels").getAsJsonArray().spliterator(), false);
+ if (!Constants.PETS.has("pet_rarity_offset")) {
+ Utils.showOutdatedRepoNotification();
+ return 0;
+ }
int pet_rarity_offset = Constants.PETS.getAsJsonObject("pet_rarity_offset").get(rarity).getAsInt();
+ if (!Constants.PETS.has("custom_pet_leveling")) {
+ Utils.showOutdatedRepoNotification();
+ return 0;
+ }
JsonObject custom_pet_leveling = Constants.PETS.getAsJsonObject("custom_pet_leveling").getAsJsonObject(petId);
List<Integer> xpLevelsRequired =
pet_levels.skip(pet_rarity_offset).limit(100).map(JsonElement::getAsInt).collect(Collectors.toList());
diff --git a/src/main/resources/assets/notenoughupdates/auction_profit.png b/src/main/resources/assets/notenoughupdates/auction_profit.png
new file mode 100644
index 00000000..80e06c10
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/auction_profit.png
Binary files differ