aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorRoman / Linnea Gräf <roman.graef@gmail.com>2022-08-26 19:02:27 +0200
committerGitHub <noreply@github.com>2022-08-26 19:02:27 +0200
commitde15a18edab8d6e6b9e56090cbf3b82134e5c0a4 (patch)
tree15681f641c494ffe32b76f056952332ee7e1922b /src/main
parentedbb004ce82d6595b2f4fcc5a7090c359f371003 (diff)
parent5c53801209c25c9bc8ea0263a0aa579b1c2980a9 (diff)
downloadNotEnoughUpdates-warner.tar.gz
NotEnoughUpdates-warner.tar.bz2
NotEnoughUpdates-warner.zip
Merge branch 'master' into warnerwarner
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/BuildFlags.java72
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java15
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java15
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java7
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/misc/PronounsCommand.java94
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java11
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java42
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/Navigation.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NewApiKeyHelper.java43
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/updater/AutoUpdater.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java7
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Dungeons.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/NeuAuctionHouse.java11
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ProfileViewer.java15
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SkillOverlays.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java294
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java17
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java169
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/bestiary/BestiaryPage.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java24
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/AsyncDependencyLoader.java55
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/AsyncDependencyLoaderImpl.java59
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/MinecraftExecutor.java37
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/PronounDB.java221
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java23
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java19
-rw-r--r--src/main/resources/pronoundb.jksbin0 -> 1457 bytes
32 files changed, 1106 insertions, 203 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/BuildFlags.java b/src/main/java/io/github/moulberry/notenoughupdates/BuildFlags.java
new file mode 100644
index 00000000..d997d980
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/BuildFlags.java
@@ -0,0 +1,72 @@
+/*
+ * 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;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * For storage of compile-time configuration flags
+ */
+public class BuildFlags {
+
+ private static final Properties properties = new Properties();
+
+ static {
+ try {
+ properties.load(BuildFlags.class.getResourceAsStream("/buildflags.properties"));
+ } catch (IOException | NullPointerException e) {
+ System.out.println("Failed to load build properties: " + e);
+ }
+ }
+
+ private static boolean getBuildFlag(String flag) {
+ return Boolean.parseBoolean(properties.getProperty("neu.buildflags." + flag));
+ }
+
+ public static Map<String, Boolean> getAllFlags() {
+ return Holder.ALL_FLAGS;
+ }
+
+ public static final boolean ENABLE_PRONOUNS_IN_PV_BY_DEFAULT = getBuildFlag("pronouns");
+
+ private static class Holder {
+ static Map<String, Boolean> ALL_FLAGS = new HashMap<>();
+
+ static {
+ for (Field declaredField : BuildFlags.class.getDeclaredFields()) {
+ if (Boolean.TYPE.equals(declaredField.getType())
+ && (declaredField.getModifiers() & Modifier.STATIC) != 0) {
+ try {
+ declaredField.setAccessible(true);
+ ALL_FLAGS.put(declaredField.getName(), (Boolean) declaredField.get(null));
+ } catch (IllegalAccessException | ClassCastException | SecurityException e) {
+ System.err.println("Failed to access BuildFlag: " + e);
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index d22b93f5..dd4c01af 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -112,8 +112,8 @@ import java.util.Set;
public class NotEnoughUpdates {
public static final String MODID = "notenoughupdates";
public static final String VERSION = "2.1.0-REL";
- public static final int VERSION_ID = 20000;
- public static final int PRE_VERSION_ID = 1;
+ public static final int VERSION_ID = 20100;
+ public static final int PRE_VERSION_ID = 0;
public static final int HOTFIX_VERSION_ID = 0;
/**
* Registers the biomes for the crystal hollows here so optifine knows they exists
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
index 3fc34d10..c3999fb6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
@@ -59,6 +59,8 @@ import java.util.TreeMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Consumer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
public class APIManager {
private final NEUManager manager;
@@ -702,6 +704,16 @@ public class APIManager {
);
}
+ private static final Pattern BAZAAR_ENCHANTMENT_PATTERN = Pattern.compile("ENCHANTMENT_(\\D*)_(\\d+)");
+
+ public String transformHypixelBazaarToNEUItemId(String hypixelId) {
+ Matcher matcher = BAZAAR_ENCHANTMENT_PATTERN.matcher(hypixelId);
+ if (matcher.matches()) {
+ return matcher.group(1) + ";" + matcher.group(2);
+ }
+ return hypixelId.replace(":", "-");
+ }
+
public void updateBazaar() {
manager.hypixelApi.getHypixelApiAsync(
NotEnoughUpdates.INSTANCE.config.apiData.apiKey,
@@ -738,7 +750,7 @@ public class APIManager {
}
}
- bazaarJson.add(entry.getKey().replace(":", "-"), productInfo);
+ bazaarJson.add(transformHypixelBazaarToNEUItemId(entry.getKey()), productInfo);
}
}
GuiPriceGraph.addToCache(bazaarJson, true);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
index f0ef1ec6..7b4542d0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/CustomAH.java
@@ -133,6 +133,8 @@ public class CustomAH extends Gui {
public int guiLeft = -1;
public int guiTop = -1;
+ private String lastSearch = "";
+
private final Category CATEGORY_SWORD = new Category("sword", "Swords", "diamond_sword");
private final Category CATEGORY_ARMOR = new Category("armor", "Armor", "diamond_chestplate");
private final Category CATEGORY_BOWS = new Category("bow", "Bows", "bow");
@@ -275,7 +277,11 @@ public class CustomAH extends Gui {
}
public void setSearch(String search) {
- searchField.setText(search);
+ if (search == null) {
+ searchField.setText(lastSearch);
+ } else {
+ searchField.setText(search);
+ }
updateSearch();
}
@@ -1487,8 +1493,15 @@ public class CustomAH extends Gui {
auctionIdsNew.add(entry.getKey());
}
}
+ if (NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.saveLastSearch) {
+ lastSearch = "";
+ }
} else {
String query = searchField.getText();
+
+ if (NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.saveLastSearch) {
+ lastSearch = query;
+ }
Set<String> dontMatch = new HashSet<>();
HashSet<String> allMatch = new HashSet<>();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java
index 917185ab..fcb2aaf9 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/Commands.java
@@ -42,6 +42,7 @@ import io.github.moulberry.notenoughupdates.commands.misc.CalculatorCommand;
import io.github.moulberry.notenoughupdates.commands.misc.CalendarCommand;
import io.github.moulberry.notenoughupdates.commands.misc.CosmeticsCommand;
import io.github.moulberry.notenoughupdates.commands.misc.CustomizeCommand;
+import io.github.moulberry.notenoughupdates.commands.misc.PronounsCommand;
import io.github.moulberry.notenoughupdates.commands.misc.UpdateCommand;
import io.github.moulberry.notenoughupdates.commands.profile.CataCommand;
import io.github.moulberry.notenoughupdates.commands.profile.PeekCommand;
@@ -97,6 +98,7 @@ public class Commands {
ClientCommandHandler.instance.registerCommand(new CalculatorCommand());
ClientCommandHandler.instance.registerCommand(new CalendarCommand());
ClientCommandHandler.instance.registerCommand(new UpdateCommand(NotEnoughUpdates.INSTANCE));
+ ClientCommandHandler.instance.registerCommand(new PronounsCommand());
// Fairy Soul Commands
ClientCommandHandler.instance.registerCommand(new FairySouls.FairySoulsCommand());
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java
index 7cca9d3b..fdf59bb0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java
@@ -19,6 +19,7 @@
package io.github.moulberry.notenoughupdates.commands.dev;
+import io.github.moulberry.notenoughupdates.BuildFlags;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
import io.github.moulberry.notenoughupdates.core.config.GuiPositionEditor;
@@ -27,6 +28,7 @@ import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.Custom
import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.LocationChangeEvent;
import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.SpecialBlockZone;
import io.github.moulberry.notenoughupdates.miscgui.GuiPriceGraph;
+import io.github.moulberry.notenoughupdates.util.PronounDB;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
@@ -40,6 +42,7 @@ import net.minecraftforge.common.MinecraftForge;
import java.util.Arrays;
import java.util.List;
+import java.util.stream.Collectors;
public class DevTestCommand extends ClientCommandBase {
@@ -118,6 +121,14 @@ public class DevTestCommand extends ClientCommandBase {
" with the mode " +
gamemode));
}
+ if (args.length >= 1 && args[0].equalsIgnoreCase("buildflags")) {
+ Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
+ "BuildFlags: \n" +
+ BuildFlags.getAllFlags().entrySet().stream()
+ .map(it -> " + " + it.getKey() + " - " + it.getValue())
+ .collect(Collectors.joining("\n"))));
+ return;
+ }
if (args.length >= 1 && args[0].equalsIgnoreCase("pricetest")) {
if (args.length == 1) {
NotEnoughUpdates.INSTANCE.manager.auctionManager.updateBazaar();
@@ -163,6 +174,10 @@ public class DevTestCommand extends ClientCommandBase {
"I would never search"));
return;
}
+ if (args.length == 1 && args[0].equalsIgnoreCase("bluehair")) {
+ PronounDB.test();
+ return;
+ }
if (args.length == 2 && args[0].equalsIgnoreCase("openGui")) {
try {
NotEnoughUpdates.INSTANCE.openGui = (GuiScreen) Class.forName(args[1]).newInstance();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java
index 1cd6bcce..bd8abf1d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/AhCommand.java
@@ -50,8 +50,13 @@ public class AhCommand extends ClientCommandBase {
NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.clearSearch();
NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.updateSearch();
- if (args.length > 0)
+ if (args.length > 0) {
NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.setSearch(StringUtils.join(args, " "));
+ } else {
+ if (NotEnoughUpdates.INSTANCE.config.neuAuctionHouse.saveLastSearch) {
+ NotEnoughUpdates.INSTANCE.manager.auctionManager.customAH.setSearch(null);
+ }
+ }
}
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/PronounsCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/PronounsCommand.java
new file mode 100644
index 00000000..6d0ee88d
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/misc/PronounsCommand.java
@@ -0,0 +1,94 @@
+/*
+ * 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.commands.misc;
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
+import io.github.moulberry.notenoughupdates.util.MinecraftExecutor;
+import io.github.moulberry.notenoughupdates.util.PronounDB;
+import io.github.moulberry.notenoughupdates.util.Utils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.client.gui.GuiNewChat;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.util.ChatComponentText;
+
+import java.util.Optional;
+import java.util.Random;
+import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
+
+public class PronounsCommand extends ClientCommandBase {
+ public PronounsCommand() {
+ super("neupronouns");
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender sender) {
+ return "/neupronouns <username> [platform]";
+ }
+
+ @Override
+ public void processCommand(ICommandSender sender, String[] args) throws CommandException {
+ switch (args.length) {
+ case 1:
+ fetchPronouns("minecraft", args[0]);
+ break;
+ case 2:
+ fetchPronouns(args[1], args[0]);
+ break;
+ default:
+ sender.addChatMessage(new ChatComponentText("§4" + getCommandUsage(sender)));
+ }
+ }
+
+ private void fetchPronouns(String platform, String user) {
+ GuiNewChat nc = Minecraft.getMinecraft().ingameGUI.getChatGUI();
+ int id = new Random().nextInt();
+ nc.printChatMessageWithOptionalDeletion(new ChatComponentText("§e[NEU] Fetching Pronouns..."), id);
+
+ CompletableFuture<Optional<PronounDB.PronounChoice>> pronouns;
+ if ("minecraft".equals(platform)) {
+ CompletableFuture<UUID> c = new CompletableFuture<>();
+ NotEnoughUpdates.profileViewer.getPlayerUUID(user, uuidString -> {
+ if (uuidString == null) {
+ c.completeExceptionally(new NullPointerException());
+ } else {
+ c.complete(Utils.parseDashlessUUID(uuidString));
+ }
+ });
+ pronouns = c.thenApplyAsync(PronounDB::getPronounsFor);
+ } else {
+ pronouns = CompletableFuture.supplyAsync(() -> PronounDB.getPronounsFor(platform, user));
+ }
+ pronouns.handleAsync((pronounChoice, throwable) -> {
+ if (throwable != null || !pronounChoice.isPresent()) {
+ nc.printChatMessageWithOptionalDeletion(new ChatComponentText("§e[NEU] §4Failed to fetch pronouns."), id);
+ return null;
+ }
+ PronounDB.PronounChoice betterPronounChoice = pronounChoice.get();
+ nc.printChatMessageWithOptionalDeletion(new ChatComponentText("§e[NEU] Pronouns for §b" + user + " §eon §b" + platform + "§e:"), id);
+ betterPronounChoice.render().forEach(it -> nc.printChatMessage(new ChatComponentText("§e[NEU] §a" + it)));
+ return null;
+ }, MinecraftExecutor.INSTANCE);
+
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java
index d52f9ba1..ecb4cd8b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/StringUtils.java
@@ -23,6 +23,9 @@ import com.google.common.collect.Sets;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
import java.util.Set;
public class StringUtils {
@@ -63,4 +66,12 @@ public class StringUtils {
str = str.replace(",", "");
return Integer.parseInt(str);
}
+
+ public static String urlEncode(String something) {
+ try {
+ return URLEncoder.encode(something, StandardCharsets.UTF_8.name());
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e); // UTF 8 should always be present
+ }
+ }
}
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 31480016..3aeee590 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
@@ -23,6 +23,7 @@ import com.google.common.collect.Lists;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonPrimitive;
@@ -140,6 +141,7 @@ public class RenderListener {
private String correctingItem;
private boolean typing;
private HashMap<String, String> cachedDefinitions;
+ private boolean inDungeonPage = false;
public RenderListener(NotEnoughUpdates neu) {
this.neu = neu;
@@ -528,6 +530,12 @@ public class RenderListener {
x -= 25;
}
}
+ if (inDungeonPage) {
+ if (x + 10 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 &&
+ y < guiTop + 100) {
+ x += 185;
+ }
+ }
GlStateManager.color(1, 1, 1, 1f);
@@ -650,6 +658,13 @@ public class RenderListener {
}
}
+ if (inDungeonPage) {
+ if (x + 10 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 &&
+ y < guiTop + 100) {
+ x += 185;
+ }
+ }
+
if (x - guiLeft >= 85 && x - guiLeft <= 115 && y - guiTop >= 4 && y - guiTop <= 25) {
disableCraftingText = true;
}
@@ -697,7 +712,6 @@ public class RenderListener {
private void renderDungeonChestOverlay(GuiScreen gui) {
if (NotEnoughUpdates.INSTANCE.config.dungeons.profitDisplayLoc == 3) return;
-
if (gui instanceof GuiChest && NotEnoughUpdates.INSTANCE.config.dungeons.profitDisplayLoc != 2) {
try {
int xSize = ((AccessorGuiContainer) gui).getXSize();
@@ -709,8 +723,9 @@ public class RenderListener {
IInventory lower = cc.getLowerChestInventory();
ItemStack rewardChest = lower.getStackInSlot(31);
- if (rewardChest != null && rewardChest.getDisplayName().endsWith(
- EnumChatFormatting.GREEN + "Open Reward Chest")) {
+ this.inDungeonPage = rewardChest != null && rewardChest.getDisplayName().endsWith(
+ EnumChatFormatting.GREEN + "Open Reward Chest");
+ if (inDungeonPage) {
int chestCost = 0;
try {
String line6 = Utils.cleanColour(neu.manager.getLoreFromNBT(rewardChest.getTagCompound())[6]);
@@ -906,6 +921,21 @@ public class RenderListener {
160
);
}
+ JsonObject mayorJson = SBInfo.getInstance().getMayorJson();
+ JsonElement mayor = mayorJson.get("mayor");
+ if (mayorJson.has("mayor") && mayor != null && mayor.getAsJsonObject().has("name") &&
+ mayor.getAsJsonObject().get("name").getAsString().equals("Derpy")
+ && NotEnoughUpdates.INSTANCE.config.dungeons.shouldWarningDerpy) {
+ Utils.drawStringScaled(
+ EnumChatFormatting.RED + EnumChatFormatting.BOLD.toString() + "shMayor Derpy active!",
+ Minecraft.getMinecraft().fontRendererObj,
+ guiLeft + xSize + 4 + 10,
+ guiTop + 85,
+ true,
+ 0,
+ 1.3f
+ );
+ }
}
} catch (Exception e) {
e.printStackTrace();
@@ -1070,6 +1100,12 @@ public class RenderListener {
x -= 25;
}
}
+ if (inDungeonPage) {
+ if (x + 10 > guiLeft + xSize && x + 18 < guiLeft + xSize + 4 + 28 + 20 && y > guiTop - 180 &&
+ y < guiTop + 100) {
+ x += 185;
+ }
+ }
if (mouseX >= x && mouseX <= x + 18 && mouseY >= y && mouseY <= y + 18) {
if (Minecraft.getMinecraft().thePlayer.inventory.getItemStack() == null) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/Navigation.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/Navigation.java
index 9cc872b7..541a76e8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/Navigation.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/Navigation.java
@@ -390,7 +390,7 @@ public class Navigation {
&& NotEnoughUpdates.INSTANCE.config.misc.untrackCloseWaypoints
&& island.equals(SBInfo.getInstance().mode)) {
EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
- if (thePlayer.getDistanceSq(position) < 16)
+ if (thePlayer != null && thePlayer.getDistanceSq(position) < 16)
untrackWaypoint();
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NewApiKeyHelper.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NewApiKeyHelper.java
new file mode 100644
index 00000000..6036d93b
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/NewApiKeyHelper.java
@@ -0,0 +1,43 @@
+/*
+ * 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 net.minecraft.client.Minecraft;
+import net.minecraft.network.play.client.C01PacketChatMessage;
+import net.minecraft.util.ChatComponentText;
+
+public class NewApiKeyHelper {
+ private static final NewApiKeyHelper INSTANCE = new NewApiKeyHelper();
+
+ public static NewApiKeyHelper getInstance() {
+ return INSTANCE;
+ }
+
+ public void hookPacketChatMessage(C01PacketChatMessage packet) {
+ String message = packet.getMessage().toLowerCase();
+ if (message.equals("/api new")) return;
+
+ if (message.replace(" ", "").startsWith("/apinew")) {