aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/BuildFlags.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java45
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.java17
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/ChromaColour.java7
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementBoolean.java24
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java49
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorAccordion.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorBoolean.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorColour.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorKeybind.java20
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorSlider.java50
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorText.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java36
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/ConfigProcessor.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/hooks/ThreadDownloadImageHook.java40
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java52
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/loader/NEUDelegatingTweaker.java38
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java183
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WardrobeMouseButtons.kt59
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java21
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiScreen.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinThreadDownloadImageData.java48
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinThreadDownloadImageDataThread.java46
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/oneconfig/IOneConfigCompat.java52
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java21
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java7
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java85
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/LocationEdit.java12
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java17
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SkillOverlays.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/WardrobeKeybinds.java126
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingSkillOverlay.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/FuelBar.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java22
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java43
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java29
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CrimsonIslePage.java36
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java37
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java25
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/Ingredient.java12
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java7
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/StarCultCalculator.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java27
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/KatRecipe.kt2
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt24
-rw-r--r--src/main/resources/assets/notenoughupdates/pv_crimson_isle_page.pngbin3370 -> 3752 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/search_mode_button.pngbin0 -> 644 bytes
-rw-r--r--src/main/resources/mixins.notenoughupdates.json4
-rw-r--r--src/main/resources/neukeystore.jksbin101958 -> 104393 bytes
-rw-r--r--src/main/resources/neukeystore.txt2
70 files changed, 1077 insertions, 403 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/BuildFlags.java b/src/main/java/io/github/moulberry/notenoughupdates/BuildFlags.java
index d997d980..2091496d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/BuildFlags.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/BuildFlags.java
@@ -50,6 +50,7 @@ public class BuildFlags {
}
public static final boolean ENABLE_PRONOUNS_IN_PV_BY_DEFAULT = getBuildFlag("pronouns");
+ public static final boolean ENABLE_ONECONFIG_COMPAT_LAYER = getBuildFlag("oneconfig");
private static class Holder {
static Map<String, Boolean> ALL_FLAGS = new HashMap<>();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
index 5e9bb55c..3ecf73c0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
@@ -288,7 +288,7 @@ public class NEUManager {
public void loadItem(String internalName) {
itemstackCache.remove(internalName);
try {
- JsonObject json = getJsonFromFile(new File(new File(repoLocation, "items"), internalName + ".json"));
+ JsonObject json = getJsonFromFile(getItemFileForInternalName(internalName));
if (json == null) {
return;
}
@@ -971,6 +971,10 @@ public class NEUManager {
return getUUIDFromNBT(tag);
}
+ public File getItemFileForInternalName(String internalName) {
+ return new File(new File(repoLocation, "items"), internalName + ".json");
+ }
+
public void writeItemToFile(ItemStack stack) {
String internalname = getInternalNameForItem(stack);
@@ -984,7 +988,7 @@ public class NEUManager {
json.addProperty("modver", NotEnoughUpdates.VERSION);
try {
- writeJson(json, new File(new File(repoLocation, "items"), internalname + ".json"));
+ writeJson(json, getItemFileForInternalName(internalname));
} catch (IOException ignored) {
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
index cff83cca..7159ef89 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
@@ -46,6 +46,7 @@ import io.github.moulberry.notenoughupdates.util.LerpingFloat;
import io.github.moulberry.notenoughupdates.util.NotificationHandler;
import io.github.moulberry.notenoughupdates.util.SpecialColour;
import io.github.moulberry.notenoughupdates.util.Utils;
+import lombok.var;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
@@ -84,6 +85,7 @@ import org.lwjgl.opengl.GL14;
import org.lwjgl.util.vector.Vector2f;
import java.awt.*;
+import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Comparator;
@@ -110,6 +112,7 @@ public class NEUOverlay extends Gui {
"notenoughupdates:supersecretassets/lunar.png");
private static final ResourceLocation SEARCH_BAR = new ResourceLocation("notenoughupdates:search_bar.png");
private static final ResourceLocation SEARCH_BAR_GOLD = new ResourceLocation("notenoughupdates:search_bar_gold.png");
+ private static final ResourceLocation SEARCH_MODE_BUTTON = new ResourceLocation("notenoughupdates:search_mode_button.png");
private final NEUManager manager;
@@ -426,7 +429,7 @@ public class NEUOverlay extends Gui {
};
}
- private MBGuiElement createHelpButton(NEUOverlay overlay) {
+ private MBGuiElement createSearchModeButton() {
return new MBGuiElement() {
@Override
public int getWidth() {
@@ -443,14 +446,12 @@ public class NEUOverlay extends Gui {
@Override
public void mouseClick(float x, float y, int mouseX, int mouseY) {
- if (!NotEnoughUpdates.INSTANCE.config.toolbar.enableHelpButton) {
+ if (!NotEnoughUpdates.INSTANCE.config.toolbar.enableSearchModeButton) {
return;
}
if (Mouse.getEventButtonState()) {
- //displayInformationPane(HTMLInfoPane.createFromWikiUrl(overlay, manager, "Help",
- // "https://moulberry.github.io/files/neu_help.html"));
- //Minecraft.getMinecraft().displayGuiScreen(new HelpGUI());
- ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, "/neuhelp");
+ searchMode = !searchMode;
+ lastSearchMode = System.currentTimeMillis();
Utils.playPressSound();
}
}
@@ -463,7 +464,7 @@ public class NEUOverlay extends Gui {
int paddingUnscaled = getPaddingUnscaled();
int searchYSize = getSearchBarYSize();
- if (!NotEnoughUpdates.INSTANCE.config.toolbar.enableHelpButton) {
+ if (!NotEnoughUpdates.INSTANCE.config.toolbar.enableSearchModeButton) {
return;
}
@@ -473,7 +474,7 @@ public class NEUOverlay extends Gui {
searchYSize + paddingUnscaled * 2, searchYSize + paddingUnscaled * 2, GL11.GL_NEAREST
);
- Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.help);
+ Minecraft.getMinecraft().getTextureManager().bindTexture(SEARCH_MODE_BUTTON);
GlStateManager.color(1f, 1f, 1f, 1f);
Utils.drawTexturedRect((int) x + paddingUnscaled, (int) y + paddingUnscaled,
getSearchBarYSize(), getSearchBarYSize()
@@ -618,7 +619,7 @@ public class NEUOverlay extends Gui {
List<MBGuiElement> children = Lists.newArrayList(
createSettingsButton(this),
createSearchBar(),
- createHelpButton(this)
+ createSearchModeButton()
);
return new MBGuiGroupAligned(children, false) {
public int getPadding() {
@@ -1156,8 +1157,30 @@ public class NEUOverlay extends Gui {
manager.jsonToStack(item));
}
} else if (NotEnoughUpdates.INSTANCE.config.apiData.repositoryEditing &&
- Keyboard.getEventCharacter() == 'k') {
- Minecraft.getMinecraft().displayGuiScreen(new NEUItemEditor(internalname.get(), item));
+ keyPressed == Keyboard.KEY_K) {
+ if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ var externalEditorCommand = NotEnoughUpdates.INSTANCE.config.hidden.externalEditor;
+ if (externalEditorCommand == null) {
+ Utils.addChatMessage(
+ "§e[NEU] §3No external editor set! Run §b/neudevtest exteditor <editorcommand>§3 " +
+ "to set your external editor. Optionally use {} as a placeholder for the filename.");
+ } else {
+ var externalFileName = manager.getItemFileForInternalName(internalname.get()).getAbsolutePath();
+ if (externalEditorCommand.contains("{}")) {
+ externalEditorCommand = externalEditorCommand.replace("{}", externalFileName);
+ } else {
+ externalEditorCommand += " " + externalFileName;
+ }
+ try {
+ Runtime.getRuntime().exec(externalEditorCommand);
+ } catch (IOException e) {
+ Utils.addChatMessage("§e[NEU]§4 Could not open external editor.");
+ e.printStackTrace();
+ }
+ }
+ } else {
+ Minecraft.getMinecraft().displayGuiScreen(new NEUItemEditor(internalname.get(), item));
+ }
return true;
} else if (keyPressed == manager.keybindItemSelect.getKeyCode() &&
NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index 21dc32c6..6160ac8d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -63,6 +63,7 @@ import io.github.moulberry.notenoughupdates.miscfeatures.PowerStoneStatsDisplay;
import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking;
import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager;
import io.github.moulberry.notenoughupdates.miscfeatures.SunTzu;
+import io.github.moulberry.notenoughupdates.miscfeatures.WardrobeMouseButtons;
import io.github.moulberry.notenoughupdates.miscfeatures.WitherCloakChanger;
import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.CustomBiomes;
import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.CustomBlockSounds;
@@ -80,6 +81,7 @@ import io.github.moulberry.notenoughupdates.miscgui.SignCalculator;
import io.github.moulberry.notenoughupdates.miscgui.TrophyRewardOverlay;
import io.github.moulberry.notenoughupdates.miscgui.minionhelper.MinionHelperManager;
import io.github.moulberry.notenoughupdates.mixins.AccessorMinecraft;
+import io.github.moulberry.notenoughupdates.oneconfig.IOneConfigCompat;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
import io.github.moulberry.notenoughupdates.overlays.EquipmentOverlay;
import io.github.moulberry.notenoughupdates.overlays.FuelBar;
@@ -295,6 +297,8 @@ public class NotEnoughUpdates {
if (config.mining.powderGrindingTrackerResetMode == 2)
OverlayManager.powderGrindingOverlay.load();
+ IOneConfigCompat.getInstance().ifPresent(it -> it.initConfig(config, this::saveConfig));
+
MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(new NEUEventListener(this));
MinecraftForge.EVENT_BUS.register(new RecipeGenerator(this));
@@ -352,6 +356,7 @@ public class NotEnoughUpdates {
MinecraftForge.EVENT_BUS.register(AbiphoneContactHelper.getInstance());
MinecraftForge.EVENT_BUS.register(MuseumItemHighlighter.INSTANCE);
MinecraftForge.EVENT_BUS.register(MuseumCheapestItemOverlay.INSTANCE);
+ MinecraftForge.EVENT_BUS.register(new WardrobeMouseButtons());
if (Minecraft.getMinecraft().getResourceManager() instanceof IReloadableResourceManager) {
IReloadableResourceManager manager = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
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 53e72dc1..e606fc49 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java
@@ -27,6 +27,7 @@ import io.github.moulberry.notenoughupdates.NEUManager;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.miscgui.GuiPriceGraph;
import io.github.moulberry.notenoughupdates.recipes.Ingredient;
+import io.github.moulberry.notenoughupdates.recipes.ItemShopRecipe;
import io.github.moulberry.notenoughupdates.recipes.NeuRecipe;
import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.Utils;
@@ -902,6 +903,11 @@ public class APIManager {
if (recipes != null)
RECIPE_ITER:
for (NeuRecipe recipe : recipes) {
+ if (recipe instanceof ItemShopRecipe) {
+ if (vanillaItem) {
+ continue;
+ }
+ }
if (recipe.hasVariableCost() || !recipe.shouldUseForCraftCost()) continue;
float craftPrice = 0;
for (Ingredient i : recipe.getIngredients()) {
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 69033345..cf266dca 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,20 +19,17 @@
package io.github.moulberry.notenoughupdates.commands.dev;
-import com.google.gson.Gson;
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;
import io.github.moulberry.notenoughupdates.core.util.MiscUtils;
import io.github.moulberry.notenoughupdates.miscfeatures.FishingHelper;
-import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay;
import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.CustomBiomes;
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.miscgui.minionhelper.MinionHelperManager;
-import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
import io.github.moulberry.notenoughupdates.util.PronounDB;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.TabListUtils;
@@ -142,6 +139,16 @@ public class DevTestCommand extends ClientCommandBase {
.collect(Collectors.joining("\n"))));
return;
}
+ if (args.length >= 1 && args[0].equalsIgnoreCase("exteditor")) {
+ if (args.length > 1) {
+ NotEnoughUpdates.INSTANCE.config.hidden.externalEditor = String.join(
+ " ",
+ Arrays.copyOfRange(args, 1, args.length)
+ );
+ }
+ Utils.addChatMessage("§e[NEU] §fYour external editor is: §Z" + NotEnoughUpdates.INSTANCE.config.hidden.externalEditor);
+ return;
+ }
if (args.length >= 1 && args[0].equalsIgnoreCase("pricetest")) {
if (args.length == 1) {
NotEnoughUpdates.INSTANCE.manager.auctionManager.updateBazaar();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.java
index bc389ad4..bbabc172 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.java
@@ -29,11 +29,6 @@ import net.minecraft.event.ClickEvent;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
-import java.awt.*;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
public class FeaturesCommand extends ClientCommandBase {
public FeaturesCommand() {
super("neufeatures");
@@ -48,13 +43,11 @@ public class FeaturesCommand extends ClientCommandBase {
}
String url = Constants.MISC.get("featureslist").getAsString();
- Desktop desk = Desktop.getDesktop();
- try {
- desk.browse(new URI(url));
- Utils.addChatMessage( EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.BOLD + "NEU" + EnumChatFormatting.RESET +
- EnumChatFormatting.GOLD + "> Opening Feature List in browser.");
- } catch (URISyntaxException | IOException ignored) {
-
+ if (Utils.openUrl(url)) {
+ Utils.addChatMessage(
+ EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.BOLD + "NEU" + EnumChatFormatting.RESET +
+ EnumChatFormatting.GOLD + "> Opening Feature List in browser.");
+ } else {
ChatComponentText clickTextFeatures = new ChatComponentText(
EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.BOLD + "NEU" + EnumChatFormatting.RESET +
EnumChatFormatting.GOLD + "> Click here to open the Feature List in your browser.");
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/ChromaColour.java b/src/main/java/io/github/moulberry/notenoughupdates/core/ChromaColour.java
index 05a9a65e..fb7b2abe 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/ChromaColour.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/ChromaColour.java
@@ -38,7 +38,8 @@ public class ChromaColour {
return sb.toString();
}
- private static int[] decompose(String csv) {
+ @Deprecated
+ public static int[] decompose(String csv) {
String[] split = csv.split(":");
int[] arr = new int[split.length];
@@ -68,6 +69,10 @@ public class ChromaColour {
return (255 - speed) / 254f * (MAX_CHROMA_SECS - MIN_CHROMA_SECS) + MIN_CHROMA_SECS;
}
+ public static int getSpeedForSeconds(float seconds) {
+ return (int) (255 - (seconds - MIN_CHROMA_SECS) * 254f / (MAX_CHROMA_SECS - MIN_CHROMA_SECS));
+ }
+
private static final int MIN_CHROMA_SECS = 1;
private static final int MAX_CHROMA_SECS = 60;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementBoolean.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementBoolean.java
index 11547aaa..ab176933 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementBoolean.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementBoolean.java
@@ -28,11 +28,12 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Mouse;
import java.util.function.Consumer;
+import java.util.function.Supplier;
public class GuiElementBoolean extends GuiElement {
public int x;
public int y;
- private boolean value;
+ private Supplier<Boolean> value;
private final int clickRadius;
private final Consumer<Boolean> toggleCallback;
@@ -43,20 +44,20 @@ public class GuiElementBoolean extends GuiElement {
private static final int xSize = 48;
private static final int ySize = 14;
- public GuiElementBoolean(int x, int y, boolean value, Consumer<Boolean> toggleCallback) {
+ public GuiElementBoolean(int x, int y, Supplier<Boolean> value, Consumer<Boolean> toggleCallback) {
this(x, y, value, 0, toggleCallback);
}
- public GuiElementBoolean(int x, int y, boolean value, int clickRadius, Consumer<Boolean> toggleCallback) {
+ public GuiElementBoolean(int x, int y, Supplier<Boolean> value, int clickRadius, Consumer<Boolean> toggleCallback) {
this.x = x;
this.y = y;
this.value = value;
- this.previewValue = value;
+ this.previewValue = value.get();
this.clickRadius = clickRadius;
this.toggleCallback = toggleCallback;
this.lastMillis = System.currentTimeMillis();
- if (value) animation = 36;
+ if (previewValue) animation = 36;
}
@Override
@@ -70,7 +71,7 @@ public class GuiElementBoolean extends GuiElement {
long deltaMillis = currentMillis - lastMillis;
lastMillis = currentMillis;
boolean passedLimit = false;
- if (previewValue != value) {
+ if (previewValue != value.get()) {
if ((previewValue && animation > 12) ||
(!previewValue && animation < 24)) {
passedLimit = true;
@@ -83,7 +84,7 @@ public class GuiElementBoolean extends GuiElement {
}
lastMillis -= deltaMillis % 10;
- if (previewValue == value) {
+ if (previewValue == value.get()) {
animation = Math.max(0, Math.min(36, animation));
} else if (!passedLimit) {
if (previewValue) {
@@ -120,14 +121,13 @@ public class GuiElementBoolean extends GuiElement {
mouseY > y - clickRadius && mouseY < y + ySize + clickRadius) {
if (Mouse.getEventButton() == 0) {
if (Mouse.getEventButtonState()) {
- previewValue = !value;
- } else if (previewValue == !value) {
- value = !value;
- toggleCallback.accept(value);
+ previewValue = !value.get();
+ } else if (previewValue == !value.get()) {
+ toggleCallback.accept(!value.get());
}
}
} else {
- previewValue = value;
+ previewValue = value.get();
}
return false;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java
index 1f655aaf..1802a1a4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementColour.java
@@ -35,6 +35,7 @@ import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.function.Consumer;
+import java.util.function.Supplier;
public class GuiElementColour extends GuiElement {
public static final ResourceLocation colour_selector_dot = new ResourceLocation(
@@ -68,20 +69,20 @@ public class GuiElementColour extends GuiElement {
private final Consumer<String> colourChangedCallback;
private final Runnable closeCallback;
- private String colour;
+ private Supplier<String> colour;
private final boolean opacitySlider;
private final boolean valueSlider;
public GuiElementColour(
- int x, int y, String initialColour, Consumer<String> colourChangedCallback,
+ int x, int y, Supplier<String> colour, Consumer<String> colourChangedCallback,
Runnable closeCallback
) {
- this(x, y, initialColour, colourChangedCallback, closeCallback, true, true);
+ this(x, y, colour, colourChangedCallback, closeCallback, true, true);
}
public GuiElementColour(
- int x, int y, String initialColour, Consumer<String> colourChangedCallback,
+ int x, int y, Supplier<String> colour, Consumer<String> colourChangedCallback,
Runnable closeCallback, boolean opacitySlider, boolean valueSlider
) {
final ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
@@ -89,12 +90,12 @@ public class GuiElementColour extends GuiElement {
this.y = Math.max(10, Math.min(scaledResolution.getScaledHeight() - ySize - 10, y));
this.x = Math.max(10, Math.min(scaledResolution.getScaledWidth() - xSize - 10, x));
- this.colour = initialColour;
+ this.colour = colour;
this.colourChangedCallback = colourChangedCallback;
this.closeCallback = closeCallback;
- int colour = ChromaColour.specialToSimpleRGB(initialColour);
- Color c = new Color(colour);
+ int icolour = ChromaColour.specialToSimpleRGB(colour.get());
+ Color c = new Color(icolour);
float[] hsv = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
updateAngleAndRadius(hsv);
@@ -113,7 +114,7 @@ public class GuiElementColour extends GuiElement {
public void render() {
RenderUtils.drawFloatingRectDark(x, y, xSize, ySize);
- int currentColour = ChromaColour.specialToSimpleRGB(colour);
+ int currentColour = ChromaColour.specialToSimpleRGB(colour.get());
Color c = new Color(currentColour, true);
float[] hsv = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
@@ -200,8 +201,8 @@ public class GuiElementColour extends GuiElement {
RenderUtils.drawTexturedRect(x + 5 + 64 + 5 + valueOffset, y + 5, 10, 64, GL11.GL_NEAREST);
}
- int chromaSpeed = ChromaColour.getSpeed(colour);
- int currentColourChroma = ChromaColour.specialToChromaRGB(colour);
+ int chromaSpeed = ChromaColour.getSpeed(colour.get());
+ int currentColourChroma = ChromaColour.specialToChromaRGB(colour.get());
Color cChroma = new Color(currentColourChroma, true);
float[] hsvChroma = Color.RGBtoHSB(cChroma.getRed(), cChroma.getGreen(), cChroma.getBlue(), null);
@@ -343,7 +344,7 @@ public class GuiElementColour extends GuiElement {
}
}
- int chromaSpeed = ChromaColour.getSpeed(colour);
+ int chromaSpeed = ChromaColour.getSpeed(colour.get());
int xChroma = mouseX - (x + 5 + 64 + valueOffset + opacityOffset + 5);
if (xChroma > 0 && xChroma < 10) {
if (chromaSpeed > 0) {
@@ -351,10 +352,9 @@ public class GuiElementColour extends GuiElement {
clickedComponent = 3;
}
} else if (mouseY > this.y + 5 + 27 && mouseY < this.y + 5 + 37) {
- int currentColour = ChromaColour.specialToSimpleRGB(colour);
+ int currentColour = ChromaColour.specialToSimpleRGB(colour.get());
Color c = new Color(currentColour, true);
- colour = ChromaColour.special(200, c.getAlpha(), currentColour);
- colourChangedCallback.accept(colour);
+ colourChangedCallback.accept(ChromaColour.special(200, c.getAlpha(), currentColour));
}
}
} else {
@@ -364,7 +364,7 @@ public class GuiElementColour extends GuiElement {
}
}
if (Mouse.isButtonDown(0) && clickedComponent >= 0) {
- int currentColour = ChromaColour.specialToSimpleRGB(colour);
+ int currentColour = ChromaColour.specialToSimpleRGB(colour.get());
Color c = new Color(currentColour, true);
float[] hsv = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
@@ -381,8 +381,7 @@ public class GuiElementColour extends GuiElement {
this.wheelAngle = angle;
this.wheelRadius = (float) Math.pow(Math.min(1, radius), 1.5f);
int rgb = Color.getHSBColor(angle / 360f, wheelRadius, hsv[2]).getRGB();
- colour = ChromaColour.special(ChromaColour.getSpeed(colour), c.getAlpha(), rgb);
- colourChangedCallback.accept(colour);
+ colourChangedCallback.accept(ChromaColour.special(ChromaColour.getSpeed(colour.get()), c.getAlpha(), rgb));
return true;
}
@@ -392,22 +391,19 @@ public class GuiElementColour extends GuiElement {
if (clickedComponent == 1) {
int rgb = Color.getHSBColor(wheelAngle / 360, wheelRadius, 1 - y / 64f).getRGB();
- colour = ChromaColour.special(ChromaColour.getSpeed(colour), c.getAlpha(), rgb);
- colourChangedCallback.accept(colour);
+ colourChangedCallback.accept(ChromaColour.special(ChromaColour.getSpeed(colour.get()), c.getAlpha(), rgb));
return true;
}
if (clickedComponent == 2) {
- colour = ChromaColour.special(ChromaColour.getSpeed(colour),
+ colourChangedCallback.accept(ChromaColour.special(ChromaColour.getSpeed(colour.get()),
255 - Math.round(y / 64f * 255), currentColour
- );
- colourChangedCallback.accept(colour);
+ ));
return true;
}
if (clickedComponent == 3) {
- colour = ChromaColour.special(255 - Math.round(y / 64f * 255), c.getAlpha(), currentColour);
- colourChangedCallback.accept(colour);
+ colourChangedCallback.accept(ChromaColour.special(255 - Math.round(y / 64f * 255), c.getAlpha(), currentColour));
}
return true;
}
@@ -431,9 +427,8 @@ public class GuiElementColour extends GuiElement {
String text = hexField.getText().toLowerCase();
int rgb = Integer.parseInt(text, 16);
- int alpha = (ChromaColour.specialToSimpleRGB(colour) >> 24) & 0xFF;
- colour = ChromaColour.special(ChromaColour.getSpeed(colour), alpha, rgb);
- colourChangedCallback.accept(colour);
+ int alpha = (ChromaColour.specialToSimpleRGB(colour.get()) >> 24) & 0xFF;
+ colourChangedCallback.accept(ChromaColour.special(ChromaColour.getSpeed(colour.get()), alpha, rgb));
Color c = new Color(rgb);
float[] hsv = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorAccordion.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorAccordion.java
index dc1173ef..91515259 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorAccordion.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorAccordion.java
@@ -32,11 +32,9 @@ import org.lwjgl.opengl.GL11;
public class GuiOptionEditorAccordion extends GuiOptionEditor {
private final int accordionId;
- private boolean accordionToggled;
public GuiOptionEditorAccordion(ConfigProcessor.ProcessedOption option, int accordionId) {
super(option);
- this.accordionToggled = (boolean) option.get();
this.accordionId = accordionId;
}
@@ -50,7 +48,7 @@ public class GuiOptionEditorAccordion extends GuiOptionEditor {
}
public boolean getToggled() {
- return accordionToggled;
+ return (boolean) option.get();
}
@Override
@@ -65,7 +63,7 @@ public class GuiOptionEditorAccordion extends GuiOptionEditor {
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.color(1, 1, 1, 1);
worldrenderer.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION);
- if (accordionToggled) {
+ if (getToggled()) {
worldrenderer.pos((double) x + 6, (double) y + 6, 0.0D).endVertex();
worldrenderer.pos((double) x + 9.75f, (double) y + 13.5f, 0.0D).endVertex();
worldrenderer.pos((double) x + 13.5f, (double) y + 6, 0.0D).endVertex();
@@ -87,7 +85,7 @@ public class GuiOptionEditorAccordion extends GuiOptionEditor {
public boolean mouseInput(int x, int y, int width, int mouseX, int mouseY) {
if (Mouse.getEventButtonState() && mouseX > x && mouseX < x + width &&
mouseY > y && mouseY < y + getHeight()) {
- accordionToggled = !accordionToggled;
+ option.set(!getToggled());
return true;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorBoolean.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorBoolean.java
index d12ec8e7..00907e9e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorBoolean.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorBoolean.java
@@ -37,7 +37,7 @@ public class GuiOptionEditorBoolean extends GuiOptionEditor {
super(option);
this.config = config;
this.runnableId = runnableId;
- bool = new GuiElementBoolean(0, 0, (boolean) option.get(), 10, (value) -> onUpdate(option, value));
+ bool = new GuiElementBoolean(0, 0, () -> (boolean) option.get(), 10, (value) -> onUpdate(option, value));
}
@Override
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorColour.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorColour.java
index ca4087b5..359a3e27 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorColour.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorColour.java
@@ -30,13 +30,14 @@ import org.lwjgl.input.Mouse;
import static io.github.moulberry.notenoughupdates.util.GuiTextures.button_white;
public class GuiOptionEditorColour extends GuiOptionEditor {
- private String chromaColour;
private GuiElementColour colourElement = null;
public GuiOptionEditorColour(ConfigProcessor.ProcessedOption option) {
super(option);
+ }
- this.chromaColour = (String) option.get();
+ public String getChromaString() {
+ return (String) option.get();
}
@Override
@@ -44,7 +45,7 @@ public class GuiOptionEditorColour extends GuiOptionEditor {
super.render(x, y, width);
int height = getHeight();
- int argb = ChromaColour.specialToChromaRGB(chromaColour);
+ int argb = ChromaColour.specialToChromaRGB(getChromaString());
int r = (argb >> 16) & 0xFF;
int g = (argb >> 8) & 0xFF;
int b = argb & 0xFF;
@@ -72,10 +73,8 @@ public class GuiOptionEditorColour extends GuiOptionEditor {
if (Mouse.getEventButtonState() && Mouse.getEventButton() == 0 &&
mouseX > x + width / 6 - 24 && mouseX < x + width / 6 + 24 &&
mouseY > y + height - 7 - 14 && mouseY < y + height - 7 + 2) {
- colourElement = new GuiElementColour(mouseX, mouseY, (String) option.get(), (val) -> {
- option.set(val);
- chromaColour = val;
- }, () -> colourElement = null);
+ colourElement = new GuiElementColour(mouseX, mouseY, () -> (String) option.get(),
+ option::set, () -> colourElement = null);
}
return false;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java
index d3b9c04d..ef2a52bb 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorDraggableList.java
@@ -118,6 +118,7 @@ public class GuiOptionEditorDraggableList extends GuiOptionEditor {
int i = 0;
int yOff = 0;
for (int strIndex : activeText) {
+ if (strIndex >= exampleText.length) continue;
String str = exampleText[strIndex];
String[] multilines = str.split("\n");
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorKeybind.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorKeybind.java
index 6eb71d1e..b7d70db8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorKeybind.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorKeybind.java
@@ -35,16 +35,18 @@ import static io.github.moulberry.notenoughupdates.util.GuiTextures.button_tex;
public class GuiOptionEditorKeybind extends GuiOptionEditor {
private static final ResourceLocation RESET = new ResourceLocation("notenoughupdates:itemcustomize/reset.png");
- private int keyCode;
private final int defaultKeyCode;
private boolean editingKeycode;
- public GuiOptionEditorKeybind(ConfigProcessor.ProcessedOption option, int keyCode, int defaultKeyCode) {
+ public GuiOptionEditorKeybind(ConfigProcessor.ProcessedOption option, int defaultKeyCode) {
super(option);
- this.keyCode = keyCode;
this.defaultKeyCode = defaultKeyCode;
}
+ public int getKeyCode() {
+ return (int) option.get();
+ }
+
@Override
public void render(int x, int y, int width) {
super.render(x, y, width);
@@ -55,7 +57,7 @@ public class GuiOptionEditorKeybind extends GuiOptionEditor {
Minecraft.getMinecraft().getTextureManager().bindTexture(button_tex);
RenderUtils.drawTexturedRect(x + width / 6 - 24, y + height - 7 - 14, 48, 16);
- String keyName = KeybindHelper.getKeyName(keyCode);
+ String keyName = KeybindHelper.getKeyName(getKeyCode());
String text = editingKeycode ? "> " + keyName + " <" : keyName;
TextRenderUtils.drawStringCenteredScaledMaxWidth(text,
Minecraft.getMinecraft().fontRendererObj,
@@ -72,8 +74,7 @@ public class GuiOptionEditorKeybind extends GuiOptionEditor {
public boolean mouseInput(int x, int y, int width, int mouseX, int mouseY) {
if (Mouse.getEventButtonState() && Mouse.getEventButton() != -1 && editingKeycode) {
editingKeycode = false;
- keyCode = Mouse.getEventButton() - 100;
- option.set(keyCode);
+ option.set(Mouse.getEventButton() - 100);
return true;
}
@@ -86,8 +87,7 @@ public class GuiOptionEditorKeybind extends GuiOptionEditor {
}
if (mouseX > x + width / 6 - 24 + 48 + 3 && mouseX < x + width / 6 - 24 + 48 + 13 &&
mouseY > y + height - 7 - 14 + 3 && mouseY < y + height - 7 - 14 + 3 + 11) {
- keyCode = defaultKeyCode;
- option.set(keyCode);
+ option.set(defaultKeyCode);
return true;
}
}
@@ -99,13 +99,15 @@ public class GuiOptionEditorKeybind extends GuiOptionEditor {
public boolean keyboardInput() {
if (editingKeycode) {
editingKeycode = false;
+ int keyCode = -1;
if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
keyCode = 0;
} else if (Keyboard.getEventKey() != 0) {
keyCode = Keyboard.getEventKey();
}
if (keyCode > 256) keyCode = 0;
- option.set(keyCode);
+ if (keyCode != -1)
+ option.set(keyCode);
return true;
}
return false;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorSlider.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorSlider.java
index 7fceb92d..175dcdc0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorSlider.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorSlider.java
@@ -34,35 +34,35 @@ public class GuiOptionEditorSlider extends GuiOptionEditor {
super(option);
if (minStep < 0) minStep = 0.01f;
- float floatVal = ((Number) option.get()).floatValue();
- {
- String strVal;
- if (floatVal % 1 == 0) {
- strVal = Integer.toString((int) floatVal);
- } else {
- strVal = Float.toString(floatVal);
- }
- textField = new GuiElementTextField(
- strVal,
- GuiElementTextField.NO_SPACE | GuiElementTextField.NUM_ONLY | GuiElementTextField.SCALE_TEXT
- );
- }
+ float floatVal = getFloatValue();
+ textField = new GuiElementTextField(
+ getStringifiedFloatValue(),
+ GuiElementTextField.NO_SPACE | GuiElementTextField.NUM_ONLY | GuiElementTextField.SCALE_TEXT
+ );
slider = new GuiElementSlider(0, 0, 80, minValue, maxValue, minStep, floatVal, (val) -> {
option.set(val);
-
- String strVal;
- if (val % 1 == 0) {
- strVal = Integer.toString(val.intValue());
- } else {
- strVal = Float.toString(val);
- strVal = strVal.replaceAll("(\\.\\d\\d\\d)(?:\\d)+", "$1");
- strVal = strVal.replaceAll("0+$", "");
- }
- textField.setText(strVal);
+ textField.setText(getStringifiedFloatValue());
});
}
+ public String getStringifiedFloatValue() {
+ float floatVal = getFloatValue();
+ String strVal;
+ if (floatVal % 1 == 0) {
+ strVal = Integer.toString((int) floatVal);
+ } else {
+ strVal = Float.toString(floatVal);
+ strVal = strVal.replaceAll("(\\.\\d\\d\\d)\\d+", "$1");
+ strVal = strVal.replaceAll("0+$", "");
+ }
+ return strVal;
+ }
+
+ public float getFloatValue() {
+ return ((Number) option.get()).floatValue();
+ }
+
@Override
public void render(int x, int y, int width) {
super.render(x, y, width);
@@ -72,6 +72,9 @@ public class GuiOptionEditorSlider extends GuiOptionEditor {
int sliderWidth = (fullWidth - 5) * 3 / 4;
int textFieldWidth = (fullWidth - 5) / 4;
+ if (!Mouse.isButtonDown(0)) {
+ slider.setValue(getFloatValue());
+ }
slider.x = x + width / 6 - fullWidth / 2;
slider.y = y + height - 7 - 14;
slider.width = sliderWidth;
@@ -84,6 +87,7 @@ public class GuiOptionEditorSlider extends GuiOptionEditor {
16
);
} else {
+ textField.setText(getStringifiedFloatValue());
textField.setSize(textFieldWidth, 16);
textField.setOptions(
GuiElementTextField.NO_SPACE | GuiElementTextField.NUM_ONLY | GuiElementTextField.SCALE_TEXT);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorText.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorText.java
index ad2fa4db..48072fbe 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorText.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiOptionEditorText.java
@@ -47,6 +47,8 @@ public class GuiOptionEditorText extends GuiOptionEditor {
fullWidth,
Minecraft.getMinecraft().fontRendererObj.getStringWidth(textField.getText()) + 10
);
+ } else {
+ textField.setText((String) option.get());
}
textField.setSize(fullWidth, 16);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java
index 6fb8f353..1b71e3ce 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/gui/GuiPositionEditor.java
@@ -19,6 +19,7 @@
package io.github.moulberry.notenoughupdates.core.config.gui;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.notenoughupdates.overlays.OverlayManager;
import io.github.moulberry.notenoughupdates.overlays.TextOverlay;
@@ -27,6 +28,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.GlStateManager;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
@@ -45,10 +47,9 @@ public class GuiPositionEditor extends GuiScreen {
private int grabbedX = 0;
private int grabbedY = 0;
private int clickedPos = -1;
-
+ private int oldGuiScale = -1;
public static boolean renderDrill = false;
- private int guiScaleOverride = -1;
public GuiPositionEditor(
LinkedHashMap<TextOverlay, Position> overlayPositions,
@@ -83,6 +84,16 @@ public class GuiPositionEditor extends GuiScreen {
this.elementHeights = height;
this.positionChangedCallback = positionChangedCallback;
this.closedCallback = closedCallback;
+ int newGuiScale = NotEnoughUpdates.INSTANCE.config.locationedit.guiScale;
+ if (newGuiScale != 0) {
+ if (Minecraft.getMinecraft().gameSettings.guiScale != 0) {
+ this.oldGuiScale = Minecraft.getMinecraft().gameSettings.guiScale;
+ } else {
+ this.oldGuiScale = 4;
+ }
+ if (newGuiScale == 4) Minecraft.getMinecraft().gameSettings.guiScale = 0;
+ else Minecraft.getMinecraft().gameSettings.guiScale = NotEnoughUpdates.INSTANCE.config.locationedit.guiScale;
+ }
}
@Override
@@ -91,17 +102,14 @@ public class GuiPositionEditor extends GuiScreen {
closedCallback.run();
renderDrill = false;
clickedPos = -1;
+ if (this.oldGuiScale != -1) Minecraft.getMinecraft().gameSettings.guiScale = this.oldGuiScale;
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawScreen(mouseX, mouseY, partialTicks);
- ScaledResolution scaledResolution;
- if (guiScaleOverride >= 0) {
- scaledResolution = Utils.pushGuiScale(guiScaleOverride);
- } else {
- scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- }
+ GlStateManager.pushMatrix();
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
this.width = scaledResolution.getScaledWidth();
this.height = scaledResolution.getScaledHeight();
@@ -127,9 +135,6 @@ public class GuiPositionEditor extends GuiScreen {
if (position.isCenterY()) y -= elementHeight / 2;
Gui.drawRect(x, y, x + elementWidth, y + elementHeight, 0x80404040);
- Utils.pushGuiScale(-1);
-
- scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
Utils.drawStringCentered("Position Editor", Minecraft.getMinecraft().fontRendererObj,
scaledResolution.getScaledWidth() / 2, 8, true, 0xffffff
);
@@ -137,6 +142,7 @@ public class GuiPositionEditor extends GuiScreen {
scaledResolution.getScaledWidth() / 2, 18, true, 0xffffff
);
}
+ GlStateManager.popMatrix();
}
@Override
@@ -144,12 +150,7 @@ public class GuiPositionEditor extends GuiScreen {
super.mouseClicked(mouseX, mouseY, mouseButton);
if (mouseButton == 0) {
- ScaledResolution scaledResolution;
- if (guiScaleOverride >= 0) {
- scaledResolution = Utils.pushGuiScale(guiScaleOverride);
- } else {
- scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- }
+ ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth;
mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1;
for (int i = positions.size() - 1; i >= 0; i--) {
@@ -171,7 +172,6 @@ public class GuiPositionEditor extends GuiScreen {
}
}
- Utils.pushGuiScale(-1);
}
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/ConfigProcessor.java b/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/ConfigProcessor.java
index efdeab01..9a75ec19 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/ConfigProcessor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/core/config/struct/ConfigProcessor.java
@@ -152,7 +152,7 @@ public class ConfigProcessor {
if (optionType.isAssignableFrom(int.class) &&
optionField.isAnnotationPresent(ConfigEditorKeybind.class)) {
ConfigEditorKeybind configEditorAnnotation = optionField.getAnnotation(ConfigEditorKeybind.class);
- editor = new GuiOptionEditorKeybind(option, (int) option.get(), configEditorAnnotation.defaultKey());
+ editor = new GuiOptionEditorKeybind(option, configEditorAnnotation.defaultKey());
}
if (optionField.isAnnotationPresent(ConfigEditorButton.class)) {
ConfigEditorButton configEditorAnnotation = optionField.getAnnotation(ConfigEditorButton.class);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java
index 98d36f2b..025e11b2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/GuiDungeonMapEditor.java
@@ -744,7 +744,7 @@ public class GuiDungeonMapEditor extends GuiScreen {
ScaledResolution realRes = new ScaledResolution(Minecraft.getMinecraft());
mouseX = Mouse.getEventX() * realRes.getScaledWidth() / this.mc.displayWidth;
mouseY = realRes.getScaledHeight() - Mouse.getEventY() * realRes.getScaledHeight() / this.mc.displayHeight - 1;
- activeColourEditor = new GuiElementColour(mouseX, mouseY, options.dmBackgroundColour,
+ activeColourEditor = new GuiElementColour(mouseX, mouseY, () -> options.dmBackgroundColour,
(col) -> options.dmBackgroundColour = col, () -> activeColourEditor = null
);
}
@@ -753,7 +753,7 @@ public class GuiDungeonMapEditor extends GuiScreen {
ScaledResolution realRes = new ScaledResolution(Minecraft.getMinecraft());
mouseX = Mouse.getEventX() * realRes.getScaledWidth() / this.mc.displayWidth;
mouseY = realRes.getScaledHeight() - Mouse.getEventY() * realRes.getScaledHeight() / this.mc.displayHeight - 1;
- activeColourEditor = new GuiElementColour(mouseX, mouseY, options.dmBorderColour,
+ activeColourEditor = new GuiElementColour(mouseX, mouseY, () -> options.dmBorderColour,
(col) -> options.dmBorderColour = col, () -> activeColourEditor = null
);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/hooks/ThreadDownloadImageHook.java b/src/main/java/io/github/moulberry/notenoughupdates/hooks/ThreadDownloadImageHook.java
new file mode 100644
index 00000000..4fa57360
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/hooks/ThreadDownloadImageHook.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 Linnea Gräf
+ *
+ * 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.hooks;
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.util.ApiUtil;
+
+import javax.net.ssl.HttpsURLConnection;
+import java.net.HttpURLConnection;
+
+public class ThreadDownloadImageHook {
+ public static void hookThreadImageConnection(HttpURLConnection connection) {
+ if ((connection instanceof HttpsURLConnection) && NotEnoughUpdates.INSTANCE.config.misc.fixSteveSkulls) {
+ ApiUtil.patchHttpsRequest((HttpsURLConnection) connection);
+ }
+ }
+
+ public static String hookThreadImageLink(String originalLink) {
+ if (!NotEnoughUpdates.INSTANCE.config.misc.fixSteveSkulls || originalLink == null)
+ return originalLink;
+ return originalLink.replace("http://", "https://");
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java
index 54c378ec..31930b01 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java
@@ -38,6 +38,7 @@ import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
+import net.minecraft.util.StringUtils;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
@@ -54,12 +55,15 @@ import static io.github.moulberry.notenoughupdates.overlays.SlayerOverlay.timeSi
import static io.github.moulberry.notenoughupdates.overlays.SlayerOverlay.timeSinceLastBoss2;
public class ChatListener {
+
private final NotEnoughUpdates neu;
- private static final Pattern SLAYER_XP = Pattern.compile(
+
+ private static final Pattern SLAYER_EXP_PATTERN = Pattern.compile(
" (Spider|Zombie|Wolf|Enderman|Blaze) Slayer LVL (\\d) - (?:Next LVL in ([\\d,]+) XP!|LVL MAXED OUT!)");
+ private static final Pattern SKY_BLOCK_LEVEL_PATTERN = Pattern.compile("\\[(\\d{1,4})\\] .*");
+ private final Pattern PARTY_FINDER_PATTERN = Pattern.compile("§dParty Finder §r§f> (.*)§ejoined the dungeon group!");
- private static final Pattern SKYBLOCK_LVL_MESSAGE = Pattern.compile("\\[(\\d{1,4})\\] .*");
- AtomicBoolean missingRecipe = new AtomicBoolean(false);
+ private AtomicBoolean missingRecipe = new AtomicBoolean(false);
public ChatListener(NotEnoughUpdates neu) {
this.neu = neu;
@@ -147,15 +151,7 @@ public class ChatListener {
if (NotEnoughUpdates.INSTANCE.config.misc.replaceSocialOptions1 == 1) {
- ChatStyle pvClickStyle = Utils.createClickStyle(
- ClickEvent.Action.RUN_COMMAND,
- "/pv " + username,
- "" + EnumChatFormatting.YELLOW + "Click to open " + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD +
- username + EnumChatFormatting.RESET + EnumChatFormatting.YELLOW + "'s profile in " +
- EnumChatFormatting.DARK_PURPLE + EnumChatFormatting.BOLD + "NEU's" + EnumChatFormatting.RESET +
- EnumChatFormatting.YELLOW + " profile viewer."
- );
-
+ ChatStyle pvClickStyle = getPVChatStyle(username);
if (partyOrGuildChat) {
chatComponent.getSiblings().get(0).setChatStyle(pvClickStyle);
} else {
@@ -183,6 +179,17 @@ public class ChatListener {
return chatComponent;
}
+ private static ChatStyle getPVChatStyle(String username) {
+ return Utils.createClickStyle(
+ ClickEvent.Action.RUN_COMMAND,
+ "/pv " + username,
+ "" + EnumChatFormatting.YELLOW + "Click to open " + EnumChatFormatting.AQUA + EnumChatFormatting.BOLD +
+ username + EnumChatFormatting.RESET + EnumChatFormatting.YELLOW + "'s profile in " +
+ EnumChatFormatting.DARK_PURPLE + EnumChatFormatting.BOLD + "NEU's" + EnumChatFormatting.RESET +
+ EnumChatFormatting.YELLOW + " profile viewer."
+ );
+ }
+
/**
* 1) When receiving "You are playing on profile" messages, will set the current profile.
* 2) When a /viewrecipe command fails (i.e. player does not have recipe unlocked, will open the custom recipe GUI)
@@ -197,13 +204,16 @@ public class ChatListener {
return;
} else if (e.type == 0) {
e.message = replaceSocialControlsWithPV(e.message);
+ if (NotEnoughUpdates.INSTANCE.config.misc.dungeonGroupsPV) {
+ e.message = dungeonPartyJoinPV(e.message);
+ }
}
DungeonWin.onChatMessage(e);
String r = null;
String unformatted = Utils.cleanColour(e.message.getUnformattedText());
- Matcher matcher = SLAYER_XP.matcher(unformatted);
+ Matcher matcher = SLAYER_EXP_PATTERN.matcher(unformatted);
if (unformatted.startsWith("You are playing on profile: ")) {
SBInfo.getInstance().setCurrentProfile(unformatted
.substring("You are playing on profile: ".length())
@@ -298,7 +308,7 @@ public class ChatListener {
" You've earned a Crystal Loot Bundle!"))
OverlayManager.crystalHollowOverlay.message(unformatted);
- Matcher LvlMatcher = SKYBLOCK_LVL_MESSAGE.matcher(unformatted);
+ Matcher LvlMatcher = SKY_BLOCK_LEVEL_PATTERN.matcher(unformatted);
if (LvlMatcher.matches()) {
if (Integer.parseInt(LvlMatcher.group(1)) < NotEnoughUpdates.INSTANCE.config.misc.filterChatLevel &&
NotEnoughUpdates.INSTANCE.config.misc.filterChatLevel != 0) {
@@ -317,4 +327,18 @@ public class ChatListener {
if (unformatted.equals("ENDER NODE! You found Endermite Nest!"))
EnderNodes.displayEndermiteNotif();
}
+
+ private IChatComponent dungeonPartyJoinPV(IChatComponent message) {
+ String text = message.getFormattedText();
+ Matcher matcher = PARTY_FINDER_PATTERN.matcher(text);
+
+ if (matcher.find()) {
+ String name = StringUtils.stripControlCodes(matcher.group(1)).trim();
+ ChatComponentText componentText = new ChatComponentText(text);
+ componentText.setChatStyle(getPVChatStyle(name));
+ return componentText;
+ } else {
+ return message;
+ }
+ }
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java
index 2b7a9bef..d6d7087f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java
@@ -210,7 +210,8 @@ public class ItemTooltipRngListener {
dungeonData.clear();
JsonObject leveling = Constants.LEVELING;
- if (!leveling.has("slayer_boss_xp") ||
+ if (leveling == null ||
+ !leveling.has("slayer_boss_xp") ||
!leveling.has("slayer_highest_tier") ||
!leveling.has("slayer_tier_colors") ||
!leveling.has("rng_meter_dungeon_score")) {
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 e1fb8586..f15a26a7 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/RenderListener.java
@@ -965,7 +965,7 @@ public class RenderListener {
mayor.getAsJsonObject().get("name").getAsString().equals("Derpy")
&& NotEnoughUpdates.INSTANCE.config.dungeons.shouldWarningDerpy) {
Utils.drawStringScaled(
- EnumChatFormatting.RED + EnumChatFormatting.BOLD.toString() + "shMayor Derpy active!",
+ EnumChatFormatting.RED + EnumChatFormatting.BOLD.toString() + "Mayor Derpy active!",
Minecraft.getMinecraft().fontRendererObj,
guiLeft + xSize + 4 + 10,
guiTop + 85,
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/loader/NEUDelegatingTweaker.java b/src/main/java/io/github/moulberry/notenoughupdates/loader/NEUDelegatingTweaker.java
index 1d91ca76..d7759c9a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/loader/NEUDelegatingTweaker.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/loader/NEUDelegatingTweaker.java
@@ -19,14 +19,15 @@
package io.github.moulberry.notenoughupdates.loader;
+import io.github.moulberry.notenoughupdates.BuildFlags;
import io.github.moulberry.notenoughupdates.envcheck.EnvironmentScan;
import net.minecraft.launchwrapper.ITweaker;
+import net.minecraft.launchwrapper.Launch;
import net.minecraft.launchwrapper.LaunchClassLoader;
import org.spongepowered.asm.launch.MixinTweaker;
import java.io.File;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
/**
@@ -48,7 +49,7 @@ public class NEUDelegatingTweaker implements ITweaker {
EnvironmentScan.checkEnvironmentOnce();
}
- List<ITweaker> delegates = new ArrayList<>();
+ List<String> delegates = new ArrayList<>();
public NEUDelegatingTweaker() {
discoverTweakers();
@@ -56,45 +57,32 @@ public class NEUDelegatingTweaker implements ITweaker {
}
private void discoverTweakers() {
- delegates.add(new MixinTweaker());
- delegates.add(new ModLoadingTweaker());
- delegates.add(new KotlinLoadingTweaker());
+ if (BuildFlags.ENABLE_ONECONFIG_COMPAT_LAYER) {
+ delegates.add("cc.polyfrost.oneconfigwrapper.OneConfigWrapper");
+ }
+ delegates.add(MixinTweaker.class.getName());
+ delegates.add(ModLoadingTweaker.class.getName());
+ delegates.add(KotlinLoadingTweaker.class.getName());
}
@Override
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
- for (ITweaker delegate : delegates) {
- delegate.acceptOptions(args, gameDir, assetsDir, profile);
- }
+ List<String> tweakClasses = (List<String>) Launch.blackboard.get("TweakClasses");
+ tweakClasses.addAll(delegates);
}
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
- for (ITweaker delegate : delegates) {
- delegate.injectIntoClassLoader(classLoader);
- }
}
@Override
public String getLaunchTarget() {
- String target = null;
- for (ITweaker delegate : delegates) {
- String launchTarget = delegate.getLaunchTarget();
- if (launchTarget != null)
- target = launchTarget;
- }
- return target;
+ return null;
}
@Override
public String[] getLaunchArguments() {
- List<String> launchArguments = new ArrayList<>();
- for (ITweaker delegate : delegates) {
- String[] delegateLaunchArguments = delegate.getLaunchArguments();
- if (delegateLaunchArguments != null)
- launchArguments.addAll(Arrays.asList(delegateLaunchArguments));
- }
- return launchArguments.toArray(new String[0]);
+ return new String[0];
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java
index 88ca0cc8..82c392e4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AuctionProfit.java
@@ -104,7 +104,7 @@ public class AuctionProfit {
int coins = tryParse(EnumChatFormatting.getTextWithoutFormattingCodes(coinsString.trim()));
if (coins != 0) {
if (coins > 1000000) {
- coins /= 1.1;
+ coins /= 1.01;
}
coinsToCollect += coins;
}
@@ -113,7 +113,7 @@ public class AuctionProfit {
if (line.contains("§7Status: §aSold!") || line.contains("§7Status: §aEnded!")) {
if (coinsToCheck != 0) {
if (coinsToCheck > 1000000) {
- coinsToCheck /= 1.1;
+ coinsToCheck /= 1.01;
}
coinsToCollect += coinsToCheck;
coinsToCheck = 0;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java
index ad0b238a..dc7b0e15 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java
@@ -22,7 +22,6 @@ package io.github.moulberry.notenoughupdates.miscfeatures;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.events.SlotClickEvent;
-import io.github.moulberry.notenoughupdates.listener.RenderListener;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.renderer.GlStateManager;
@@ -90,7 +89,7 @@ public class BetterContainers {
public static void bindHook(TextureManager textureManager, ResourceLocation location) {
long currentMillis = System.currentTimeMillis();
- if (isChestOpen() && RenderListener.inventoryLoaded) {
+ if (isChestOpen()) {
int invHashcode = lastInvHashcode;
if (currentMillis - lastHashcodeCheck > 50) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java
index ab8c5e57..80751371 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java
@@ -30,6 +30,7 @@ import net.minecraft.util.EnumChatFormatting;
public class CookieWarning {
private static boolean hasNotified;
+ private static boolean hasErrorMessage;
public static void resetNotification() {
hasNotified = false;
@@ -74,7 +75,9 @@ public class CookieWarning {
return;
}
if (timeLine != null) {
- String[] digits = timeLine.replaceAll("(\u00a7.)", "").split(" ");
+ String clean = timeLine.replaceAll("(\u00a7.)", "");
+ clean = clean.replaceAll("(\\d)([smhdy])", "$1 $2");
+ String[] digits = clean.split(" ");
int minutes = 0;
try {
for (int i = 0; i < digits.length; i++) {
@@ -109,9 +112,12 @@ public class CookieWarning {
} // ignore seconds
}
} catch (NumberFormatException e) {
- e.printStackTrace();
- Utils.addChatMessage(EnumChatFormatting.RED +
- "NEU ran into an issue when retrieving the Booster Cookie Timer. Check the logs for details.");
+ if (!hasErrorMessage) {
+ e.printStackTrace();
+ Utils.addChatMessage(EnumChatFormatting.RED +
+ "NEU ran into an issue when retrieving the Booster Cookie Timer. Check the logs for details.");
+ hasErrorMessage = true;
+ }
hasNotified = true;
}
if (minutes < NotEnoughUpdates.INSTANCE.config.notifications.boosterCookieWarningMins && !hasNotified) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java
index e3afc73d..a7c22b93 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java
@@ -148,7 +148,7 @@ public class FishingHelper {
int ticksExisted = hook.ticksExisted;
float seconds = ticksExisted / 20F;
int color;
- if (seconds >= 30) {
+ if (seconds >= 20) {
color = ChromaColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.fishing.fishingTimerColor30SecPlus);
if (NotEnoughUpdates.INSTANCE.config.fishing.fishingSound30Sec && !playedSound) {
ISound sound = new PositionedSound(new ResourceLocation("random.orb")) {{
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java
index ee5eef9e..e5ee40d0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java
@@ -37,9 +37,24 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ItemCooldowns {
+
+ private static final Pattern COOLDOWN_LORE = Pattern.compile("\\u00a78Cooldown: \\u00a7a(\\d+)s");
+
+ private static final Pattern PICKAXE_ABILITY_ACTIVATION =
+ Pattern.compile("\\u00a7r\\u00a7aYou used your \\u00a7r\\u00a7..+ \\u00a7r\\u00a7aPickaxe Ability!\\u00a7r");
+
+ private static final Pattern BONZO_ABILITY_ACTIVATION =
+ Pattern.compile("\\u00a7r\\u00a7aYour \\u00a7r\\u00a7[9|5](\\u269A )*Bonzo's Mask \\u00a7r\\u00a7asaved your life!\\u00a7r");
+
+ private static final Pattern SPIRIT_ABILITY_ACTIVATION =
+ Pattern.compile("\\u00a7r\\u00a76Second Wind Activated\\u00a7r\\u00a7a! \\u00a7r\\u00a7aYour Spirit Mask saved your life!\\u00a7r");
+
private static final Map<ItemStack, Float> durabilityOverrideMap = new HashMap<>();
+
public static long pickaxeUseCooldownMillisRemaining = -1;
private static long treecapitatorCooldownMillisRemaining = -1;
+ private static long bonzomaskCooldownMillisRemaining = -1;
+ private static long spiritMaskCooldownMillisRemaining = -1;
public static boolean firstLoad = true;
public static long firstLoadMillis = 0;
@@ -47,17 +62,27 @@ public class ItemCooldowns {
private static long lastMillis = 0;
public static long pickaxeCooldown = -1;
+ private static long bonzoMaskCooldown = -1;
+ private static long spiritMaskCooldown = -1;
public static TreeMap<Long, BlockPos> blocksClicked = new TreeMap<>();
private static int tickCounter = 0;
+ enum Item {
+ PICKAXES,
+ BONZO_MASK,
+ SPIRIT_MASK
+ }
+
@SubscribeEvent
public void tick(TickEvent.ClientTickEvent event) {
if (event.phase == TickEvent.Phase.END && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) {
if (tickCounter++ >= 20 * 10) {
tickCounter = 0;
pickaxeCooldown = -1;
+ bonzoMaskCooldown = -1;
+ spiritMaskCooldown = -1;
}
long currentTime = System.currentTimeMillis();
@@ -66,7 +91,6 @@ public class ItemCooldowns {
firstLoad = false;
}
-
Long key;
while ((key = blocksClicked.floorKey(currentTime - 1500)) != null) {
blocksClicked.remove(key);
@@ -83,6 +107,12 @@ public class ItemCooldowns {
if (treecapitatorCooldownMillisRemaining >= 0) {
treecapitatorCooldownMillisRemaining -= millisDelta;
}
+ if (bonzomaskCooldownMillisRemaining >= 0) {
+ bonzomaskCooldownMillisRemaining -= millisDelta;
+ }
+ if (spiritMaskCooldownMillisRemaining >= 0) {
+ spiritMaskCooldownMillisRemaining -= millisDelta;
+ }
}
}
@@ -121,14 +151,14 @@ public class ItemCooldowns {
if (blocksClicked.containsValue(pos)) {
IBlockState oldState = Minecraft.getMinecraft().theWorld.getBlockState(pos);
if (oldState.getBlock() != packetIn.getBlockState().getBlock()) {
- onBlockMined(pos);
+ onBlockMined();
}
}
}
- public static void onBlockMined(BlockPos pos) {
+ public static void onBlockMined() {
ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem();
- String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held);
+ String internalname = NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery().withItemStack(held).resolveInternalName();
if (internalname != null) {
if (treecapitatorCooldownMillisRemaining < 0 &&
(internalname.equals("TREECAPITATOR_AXE") || internalname.equals("JUNGLE_AXE"))) {
@@ -137,11 +167,6 @@ public class ItemCooldowns {
}
}
- private static final Pattern PICKAXE_ABILITY_REGEX = Pattern.compile("\\u00a7r\\u00a7aYou used your " +
- "\\u00a7r\\u00a7..+ \\u00a7r\\u00a7aPickaxe Ability!\\u00a7r");
-
- private static final Pattern PICKAXE_COOLDOWN_LORE_REGEX = Pattern.compile("\\u00a78Cooldown: \\u00a7a(\\d+)s");
-
private static boolean isPickaxe(String internalname) {
if (internalname == null) return false;
@@ -153,36 +178,69 @@ public class ItemCooldowns {
} else return internalname.equals("GEMSTONE_GAUNTLET") || internalname.equals("PICKONIMBUS") || internalname.equals("DIVAN_DRILL");
}
- private static void updatePickaxeCooldown() {
- if (pickaxeCooldown == -1 && NotEnoughUpdates.INSTANCE.config.itemOverlays.pickaxeAbility) {
- for (ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) {
- if (stack != null && stack.hasTagCompound()) {
- String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack);
- if (isPickaxe(internalname)) {
- for (String line : NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound())) {
- Matcher matcher = PICKAXE_COOLDOWN_LORE_REGEX.matcher(line);
- if (matcher.find()) {
- try {
- pickaxeCooldown = Integer.parseInt(matcher.group(1));
- return;
- } catch (Exception ignored) {
- }
- }
- }
- }
+ @SubscribeEvent
+ public void onChatMessage(ClientChatReceivedEvent event) {
+ if (PICKAXE_ABILITY_ACTIVATION.matcher(event.message.getFormattedText()).matches() &&
+ NotEnoughUpdates.INSTANCE.config.itemOverlays.pickaxeAbility && pickaxeCooldown != 0) {
+ findCooldownInTooltip(Item.PICKAXES);
+ pickaxeUseCooldownMillisRemaining = pickaxeCooldown * 1000;
+ }
+
+ if (BONZO_ABILITY_ACTIVATION.matcher(event.message.getFormattedText()).matches() &&
+ NotEnoughUpdates.INSTANCE.config.itemOverlays.bonzoAbility && bonzoMaskCooldown != 0) {
+ findCooldownInTooltip(Item.BONZO_MASK);
+ bonzomaskCooldownMillisRemaining = bonzoMaskCooldown * 1000;
+ }
+
+ if (SPIRIT_ABILITY_ACTIVATION.matcher(event.message.getFormattedText()).matches() &&
+ NotEnoughUpdates.INSTANCE.config.itemOverlays.spiritAbility && spiritMaskCooldown != 0) {
+ findCooldownInTooltip(Item.SPIRIT_MASK);
+ spiritMaskCooldownMillisRemaining = spiritMaskCooldown * 1000;
+ }
+ }
+
+ private static void findCooldownInTooltip(Item item) {
+ for (ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) {
+ setSpecificCooldown(stack, item);
+ }
+
+ // Check helmet slot for items that can also be equipped as a helmet
+ ItemStack stack = Minecraft.getMinecraft().thePlayer.inventory.armorInventory[3];
+ setSpecificCooldown(stack, item);
+ }
+
+ private static void setSpecificCooldown(ItemStack stack, Item item) {
+ if (stack != null && stack.hasTagCompound()) {
+
+ String internalname = NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery().withItemStack(stack).resolveInternalName();
+
+ if (internalname != null) {
+ switch (item) {
+ case PICKAXES:
+ if (isPickaxe(internalname)) pickaxeCooldown = setCooldown(stack);
+ break;
+ case BONZO_MASK:
+ if (internalname.equals("BONZO_MASK") || internalname.equals("STARRED_BONZO_MASK")) bonzoMaskCooldown = setCooldown(stack);
+ break;
+ case SPIRIT_MASK:
+ if (internalname.equals("SPIRIT_MASK")) spiritMaskCooldown = setCooldown(stack);
+ break;
}
}
- pickaxeCooldown = 0;
}
}
- @SubscribeEvent
- public void onChatMessage(ClientChatReceivedEvent event) {
- if (pickaxeCooldown != 0 && PICKAXE_ABILITY_REGEX.matcher(event.message.getFormattedText()).matches() &&
- NotEnoughUpdates.INSTANCE.config.itemOverlays.pickaxeAbility) {
- updatePickaxeCooldown();
- pickaxeUseCooldownMillisRemaining = pickaxeCooldown * 1000;
+ private static int setCooldown(ItemStack stack) {
+ for (String line : NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound())) {
+ Matcher matcher = COOLDOWN_LORE.matcher(line);
+ if (matcher.find()) {
+ try {
+ return Integer.parseInt(matcher.group(1));
+ } catch (Exception ignored) {
+ }
+ }
}
+ return -1;
}
public static float getDurabilityOverride(ItemStack stack) {
@@ -193,27 +251,20 @@ public class ItemCooldowns {
return durabilityOverrideMap.get(stack);
}
- String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack);
+ String internalname = NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery().withItemStack(stack).resolveInternalName();
if (internalname == null) {
durabilityOverrideMap.put(stack, -1f);
return -1;
}
- if (isPickaxe(internalname)) {
- updatePickaxeCooldown();
-
- if (pickaxeUseCooldownMillisRemaining < 0) {
- durabilityOverrideMap.put(stack, -1f);
- return -1;
- }
+ // Pickaxes
+ if (isPickaxe(internalname) && NotEnoughUpdates.INSTANCE.config.itemOverlays.pickaxeAbility) {
+ findCooldownInTooltip(Item.PICKAXES);
- if (pickaxeUseCooldownMillisRemaining > pickaxeCooldown * 1000) {
- return stack.getItemDamage();
- }
- float dura = (float) (pickaxeUseCooldownMillisRemaining / (pickaxeCooldown * 1000.0));
- durabilityOverrideMap.put(stack, dura);
- return dura;
- } else if (internalname.equals("TREECAPITATOR_AXE") || internalname.equals("JUNGLE_AXE")) {
+ return durabilityOverride(pickaxeUseCooldownMillisRemaining, pickaxeCooldown, stack);
+ }
+ // Treecapitator / Jungle Axe
+ if (internalname.equals("TREECAPITATOR_AXE") || internalname.equals("JUNGLE_AXE")) {
if (treecapitatorCooldownMillisRemaining < 0) {
durabilityOverrideMap.put(stack, -1f);
return -1;
@@ -222,12 +273,42 @@ public class ItemCooldowns {
if (treecapitatorCooldownMillisRemaining > getTreecapCooldownWithPet()) {
return stack.getItemDamage();
}
- float dura = (treecapitatorCooldownMillisRemaining / (float) getTreecapCooldownWithPet());
- durabilityOverrideMap.put(stack, dura);
- return dura;
+
+ float durability = treecapitatorCooldownMillisRemaining / (float) getTreecapCooldownWithPet();
+ durabilityOverrideMap.put(stack, durability);
+
+ return durability;
+ }
+ // Bonzo Mask
+ if ((internalname.equals("BONZO_MASK") || internalname.equals("STARRED_BONZO_MASK")) && NotEnoughUpdates.INSTANCE.config.itemOverlays.bonzoAbility) {
+ findCooldownInTooltip(Item.BONZO_MASK);
+
+ return durabilityOverride(bonzomaskCooldownMillisRemaining, bonzoMaskCooldown, stack);
+ }
+ // Spirit Mask
+ if (internalname.equals("SPIRIT_MASK") && NotEnoughUpdates.INSTANCE.config.itemOverlays.spiritAbility) {
+ findCooldownInTooltip(Item.SPIRIT_MASK);
+
+ return durabilityOverride(spiritMaskCooldownMillisRemaining, spiritMaskCooldown, stack);
}
durabilityOverrideMap.put(stack, -1f);
return -1;
}
+
+ private static float durabilityOverride(float millisRemaining, long cooldown, ItemStack stack) {
+ if (millisRemaining < 0) {
+ durabilityOverrideMap.put(stack, -1f);
+ return -1;
+ }
+
+ if (millisRemaining > cooldown * 1000) {
+ return stack.getItemDamage();
+ }
+
+ float durability = (float) (millisRemaining / (cooldown * 1000.0));
+ durabilityOverrideMap.put(stack, durability);
+
+ return durability;
+ }
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java
index 61ebf7b5..37cb14b5 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java
@@ -496,7 +496,7 @@ public class PetInfoOverlay extends TextOverlay {
DecimalFormat df = new DecimalFormat("#.#", DecimalFormatSymbols.getInstance(Locale.ENGLISH));
if (pet == null) return 0;
try {
- return Float.parseFloat(df.format(pet.petLevel.getPercentageToNextLevel() * 100f));
+ return Float.parseFloat(df.format(Math.min(pet.petLevel.getPercentageToNextLevel() * 100f, 100f)));
} catch (Exception ignored) {
return 0;
}
@@ -516,7 +516,8 @@ public class PetInfoOverlay extends TextOverlay {
roundFloat(currentPet.petLevel.getExpRequiredForNextLevel())
+ EnumChatFormatting.YELLOW + " (" + getLevelPercent(currentPet) + "%)";
- String lvlString = EnumChatFormatting.AQUA + "" + Utils.shortNumberFormat(levelXp, 0) + "/" +
+ String lvlString = EnumChatFormatting.AQUA + "" +
+ Utils.shortNumberFormat(Math.min(levelXp, currentPet.petLevel.getExpRequiredForNextLevel()), 0) + "/" +
Utils.shortNumberFormat(currentPet.petLevel.getExpRequiredForNextLevel(), 0)
+ EnumChatFormatting.YELLOW + " (" + getLevelPercent(currentPet) + "%)";
@@ -661,7 +662,7 @@ public class PetInfoOverlay extends TextOverlay {
JsonObject petItem = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ROCK;0");
if (petItem != null) {
- Vector2f position = getPosition(overlayWidth, overlayHeight);
+ Vector2f position = getPosition(overlayWidth, overlayHeight, false);
int x = (int) position.x;
int y = (int) position.y;
@@ -700,16 +701,18 @@ public class PetInfoOverlay extends TextOverlay {
}
if (petItem != null) {
- Vector2f position = getPosition(overlayWidth, overlayHeight);
+ Vector2f position = getPosition(overlayWidth, overlayHeight, true);
int x = (int) position.x;
int y = (int) position.y;
ItemStack stack = NotEnoughUpdates.INSTANCE.manager.jsonToStack(petItem);
GlStateManager.enableDepth();
GlStateManager.pushMatrix();
+ Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.locationedit.guiScale);
GlStateManager.translate(x - 2, y - 2, 0);
GlStateManager.scale(2, 2, 1);
Utils.drawItemStack(stack, 0, 0);
+ Utils.pushGuiScale(0);
GlStateManager.popMatrix();
}
@@ -718,7 +721,7 @@ public class PetInfoOverlay extends TextOverlay {
JsonObject petItem2 = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(
currentPet2.skin != null ? currentPet2.skin : (currentPet2.petType + ";" + currentPet2.rarity.petId));
if (petItem2 != null) {
- Vector2f position = getPosition(overlayWidth, overlayHeight);
+ Vector2f position = getPosition(overlayWidth, overlayHeight, false);
int x = (int) position.x;
int y = (int) position.y + NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayText.size() * 10 + 10;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WardrobeMouseButtons.kt b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WardrobeMouseButtons.kt
new file mode 100644
index 00000000..4e99f5a7
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WardrobeMouseButtons.kt
@@ -0,0 +1,59 @@
+/*
+ * 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.core.config.KeybindHelper
+import io.github.moulberry.notenoughupdates.util.Utils
+import net.minecraft.client.gui.inventory.GuiChest
+import net.minecraftforge.client.event.GuiScreenEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class WardrobeMouseButtons {
+
+ private val keybinds: List<Int> get() = listOf(
+ NotEnoughUpdates.INSTANCE.config.wardrobeKeybinds.wardrobeSlot1,
+ NotEnoughUpdates.INSTANCE.config.wardrobeKeybinds.wardrobeSlot2,
+ NotEnoughUpdates.INSTANCE.config.wardrobeKeybinds.wardrobeSlot3,
+ NotEnoughUpdates.INSTANCE.config.wardrobeKeybinds.wardrobeSlot4,
+ NotEnoughUpdates.INSTANCE.config.wardrobeKeybinds.wardrobeSlot5,
+ NotEnoughUpdates.INSTANCE.config.wardrobeKeybinds.wardrobeSlot6,
+ NotEnoughUpdates.INSTANCE.config.wardrobeKeybinds.wardrobeSlot7,
+ NotEnoughUpdates.INSTANCE.config.wardrobeKeybinds.wardrobeSlot8,
+ NotEnoughUpdates.INSTANCE.config.wardrobeKeybinds.wardrobeSlot9,
+ )
+ private var lastClick = -1L
+
+ @SubscribeEvent
+ fun onGui(event: GuiScreenEvent) {
+ if (!NotEnoughUpdates.INSTANCE.config.wardrobeKeybinds.enableWardrobeKeybinds) return
+ val gui = event.gui as? GuiChest ?: return
+ if (!Utils.getOpenChestName().contains("Wardrobe")) return
+
+ for (i in keybinds.indices) {
+ if (KeybindHelper.isKeyDown(keybinds[i])) {
+ if (System.currentTimeMillis() - lastClick > 300) {
+ Utils.sendLeftMouseClick(gui.inventorySlots.windowId, 36 + i)
+ lastClick = System.currentTimeMillis()
+ }
+ break
+ }
+ }
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java
index 7d541296..129699da 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java
@@ -92,7 +92,7 @@ public class GuiItemCustomize extends GuiScreen {
((ItemArmor) stack.getItem()).getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER;
enchantGlintCustomColourAnimation.setValue(enchantGlint ? 17 : 0);
- this.enchantGlintButton = new GuiElementBoolean(0, 0, enchantGlint, (bool) -> {
+ this.enchantGlintButton = new GuiElementBoolean(0, 0, () -> enchantGlint, (bool) -> {
enchantGlint = bool;
updateData();
});
@@ -221,7 +221,7 @@ public class GuiItemCustomize extends GuiScreen {
tooltipToDisplay = Lists.newArrayList(
EnumChatFormatting.AQUA + "Set a custom name for the item",
EnumChatFormatting.GREEN + "",
- EnumChatFormatting.GREEN + "Type \"&&\" to use colour codes",
+ EnumChatFormatting.GREEN + "Type \"&&\" for \u00B6",
EnumChatFormatting.GREEN + "Type \"**\" for \u272A",
EnumChatFormatting.GREEN + "Type \"*1-9\" for \u278A-\u2792",
EnumChatFormatting.GREEN + "",
@@ -443,7 +443,7 @@ public class GuiItemCustomize extends GuiScreen {
editor = new GuiElementColour(
mouseX,
mouseY,
- customGlintColour == null ? ItemCustomizeManager.DEFAULT_GLINT_COLOR : customGlintColour,
+ () -> customGlintColour == null ? ItemCustomizeManager.DEFAULT_GLINT_COLOR : customGlintColour,
(colour) -> {
customGlintColour = colour;
updateData();
@@ -464,7 +464,7 @@ public class GuiItemCustomize extends GuiScreen {
updateData();
} else {
editor = new GuiElementColour(mouseX, mouseY,
- customLeatherColour == null ? getChromaStrFromLeatherColour() : customLeatherColour,
+ () -> customLeatherColour == null ? getChromaStrFromLeatherColour() : customLeatherColour,
(colour) -> {
customLeatherColour = colour;
updateData();
@@ -473,19 +473,6 @@ public class GuiItemCustomize extends GuiScreen {
}
}
- /*if(mouseX >= xCenter-90 && mouseX <= xCenter+90 &&
- mouseY >= belowEnchGlint+65 && mouseY <= belowEnchGlint+80) {
- if(true) {
- String userName = Minecraft.getMinecraft().thePlayer.getName();
- String serverId = "1872398172739";
- try {
- Desktop.getDesktop().browse(new URL("https://moulberry.codes/purchaseitemtag?uniqueId="+serverId+"&username="+userName).toURI());
- } catch(Exception ignored) {}
- } else {
-
- }
- }*/
-
super.mouseClicked(mouseX, mouseY, mouseButton);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
index e4b4269d..aa977413 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
@@ -232,7 +232,7 @@ public class GuiItemRecipe extends GuiScreen {
int row = i / hotbarSize;
int col = i % hotbarSize;
if (row == 0)
- slots.add(new RecipeSlot(HOTBAR_SLOT_X + i * SLOT_SPACING, HOTBAR_SLOT_Y, item));
+ slots.add(new RecipeSlot(HOTBAR_SLOT_X + i * SLOT_SPACING, HOTBAR_SLOT_Y + 1, item));
else
slots.add(new RecipeSlot(
PLAYER_INVENTORY_X + col * SLOT_SPACING,
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiScreen.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiScreen.java
index b978b433..8baa2bef 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiScreen.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiScreen.java
@@ -20,16 +20,26 @@
package io.github.moulberry.notenoughupdates.mixins;
import io.github.moulberry.notenoughupdates.util.SBInfo;
+import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.gui.GuiScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import java.net.URI;
+
@Mixin(GuiScreen.class)
public class MixinGuiScreen {
@Inject(method = "sendChatMessage(Ljava/lang/String;Z)V", at = @At("HEAD"))
public void onSendChatMessage(String message, boolean addToChat, CallbackInfo ci) {
SBInfo.getInstance().onSendChatMessage(message);
}
+
+ @Inject(method = "openWebLink", at = @At("HEAD"), cancellable = true)
+ public void onOpenWebLink(URI url, CallbackInfo ci) {
+ if (Utils.openUrl(url.toString())) {
+ ci.cancel();
+ }
+ }
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinThreadDownloadImageData.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinThreadDownloadImageData.java
new file mode 100644
index 00000000..c6d25a9e
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinThreadDownloadImageData.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2022 Linnea Gräf
+ *
+ * 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.mixins;
+
+import io.github.moulberry.notenoughupdates.hooks.ThreadDownloadImageHook;
+import net.minecraft.client.renderer.ThreadDownloadImageData;
+import org.spongepowered.asm.lib.Opcodes;
+import org.spongepowered.asm.mixin.Final;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Mutable;
+import org.spongepowered.asm.mixin.Shadow;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Redirect;
+
+@Mixin(ThreadDownloadImageData.class)
+public class MixinThreadDownloadImageData {
+ @Mutable
+ @Shadow
+ @Final
+ private String imageUrl;
+
+ @Redirect(
+ method = "<init>",
+ at = @At(
+ value = "FIELD",
+ target = "Lnet/minecraft/client/renderer/ThreadDownloadImageData;imageUrl:Ljava/lang/String;",
+ opcode = Opcodes.PUTFIELD))
+ public void useHttpsDownloadLinks(ThreadDownloadImageData instance, String value) {
+ this.imageUrl = ThreadDownloadImageHook.hookThreadImageLink(value);
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinThreadDownloadImageDataThread.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinThreadDownloadImageDataThread.java
new file mode 100644
index 00000000..aea52378
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinThreadDownloadImageDataThread.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 Linnea Gräf
+ *
+ * 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.mixins;
+
+import io.github.moulberry.notenoughupdates.hooks.ThreadDownloadImageHook;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
+
+import java.net.HttpURLConnection;
+
+@Mixin(targets = "net.minecraft.client.renderer.ThreadDownloadImageData$1")
+public class MixinThreadDownloadImageDataThread {
+
+ @Inject(
+ method = "run",
+ at = @At(
+ value = "INVOKE",
+ target = "Ljava/net/HttpURLConnection;setDoOutput(Z)V"
+ ),
+ locals = LocalCapture.CAPTURE_FAILSOFT
+ )
+ public void patchHttpConnection(CallbackInfo ci, HttpURLConnection httpURLConnection) {
+ ThreadDownloadImageHook.hookThreadImageConnection(httpURLConnection);
+ }
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/oneconfig/IOneConfigCompat.java b/src/main/java/io/github/moulberry/notenoughupdates/oneconfig/IOneConfigCompat.java
new file mode 100644
index 00000000..7afceab9
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/oneconfig/IOneConfigCompat.java
@@ -0,0 +1,52 @@
+/*
+ * 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.oneconfig;
+
+import io.github.moulberry.notenoughupdates.core.config.Config;
+import net.minecraftforge.fml.common.Loader;
+
+import java.util.Optional;
+
+public abstract class IOneConfigCompat {
+ private static final Object sentinelFailure = new Object();
+ private static final Object lock = new Object();
+ private static Object INSTANCE = null;
+
+ public static Optional<IOneConfigCompat> getInstance() {
+ if (INSTANCE == null && Loader.isModLoaded("oneconfig")) {
+ synchronized (lock) {
+ if (INSTANCE == null)
+ try {
+ Class<?> aClass = Class.forName("io.github.moulberry.notenoughupdates.compat.oneconfig.OneConfigCompat");
+ INSTANCE = aClass.newInstance();
+ } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
+ System.err.println("Critical failure in OneConfigCompat initialization");
+ e.printStackTrace();
+ INSTANCE = sentinelFailure;
+ }
+ }
+ }
+ if (INSTANCE == sentinelFailure) return Optional.empty();
+ return Optional.ofNullable((IOneConfigCompat) INSTANCE);
+ }
+
+ public abstract void initConfig(Config moulConfig, Runnable saveCallback);
+
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
index 63a58fb1..6822ab75 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
@@ -34,7 +34,6 @@ import io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour;
import io.github.moulberry.notenoughupdates.miscgui.GuiInvButtonEditor;
import io.github.moulberry.notenoughupdates.miscgui.NEUOverlayPlacements;
import io.github.moulberry.notenoughupdates.options.customtypes.NEUDebugFlag;
-import io.github.moulberry.notenoughupdates.options.seperateSections.WorldConfig;
import io.github.moulberry.notenoughupdates.options.seperateSections.AHGraph;
import io.github.moulberry.notenoughupdates.options.seperateSections.AHTweaks;
import io.github.moulberry.notenoughupdates.options.seperateSections.AccessoryBag;
@@ -66,12 +65,16 @@ import io.github.moulberry.notenoughupdates.options.seperateSections.StorageGUI;
import io.github.moulberry.notenoughupdates.options.seperateSections.Toolbar;
import io.github.moulberry.notenoughupdates.options.seperateSections.TooltipTweaks;
import io.github.moulberry.notenoughupdates.options.seperateSections.TradeMenu;
+import io.github.moulberry.notenoughupdates.options.seperateSections.WardrobeKeybinds;
+import io.github.moulberry.notenoughupdates.options.seperateSections.WorldConfig;
import io.github.moulberry.notenoughupdates.overlays.MiningOverlay;
import io.github.moulberry.notenoughupdates.overlays.OverlayManager;
import io.github.moulberry.notenoughupdates.overlays.TextOverlay;
import io.github.moulberry.notenoughupdates.util.NotificationHandler;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.client.ClientCommandHandler;
import java.util.ArrayList;
@@ -87,10 +90,11 @@ public class NEUConfig extends Config {
for (TextOverlay overlay : OverlayManager.textOverlays) {
overlayPositions.put(overlay, overlay.getPosition());
}
+ GuiScreen savedGui = Minecraft.getMinecraft().currentScreen;
Minecraft.getMinecraft().displayGuiScreen(new GuiPositionEditor(overlayPositions, () -> {
}, () -> {
}, () -> {
- NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper(NEUConfigEditor.editor);
+ NotEnoughUpdates.INSTANCE.openGui = savedGui;
}));
}
@@ -108,8 +112,9 @@ public class NEUConfig extends Config {
case -1:
return;
case 0:
+ GuiScreen savedGui = Minecraft.getMinecraft().currentScreen;
NotEnoughUpdates.INSTANCE.openGui = new GuiDungeonMapEditor(() -> {
- NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper(NEUConfigEditor.editor);
+ NotEnoughUpdates.INSTANCE.openGui = savedGui;
});
return;
case 1:
@@ -360,6 +365,13 @@ public class NEUConfig extends Config {
@Expose
@Category(
+ name = "Wardrobe Keybinds",
+ desc = "Keybinds for your wardrobe"
+ )
+ public WardrobeKeybinds wardrobeKeybinds = new WardrobeKeybinds();
+
+ @Expose
+ @Category(
name = "Accessory Bag Overlay",
desc = "Accessory Bag Overlay"
)
@@ -456,6 +468,9 @@ public class NEUConfig extends Config {
@Expose
public boolean hasOpenedWaypointMenu = false;
+ @Expose
+ public String externalEditor = null;
+
}
public static ArrayList<String> createDefaultEnchantColours() {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
index e3881f44..fe1f0af4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfigEditor.java
@@ -44,8 +44,6 @@ import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
-import java.awt.*;
-import java.net.URI;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
@@ -737,10 +735,7 @@ public class NEUConfigEditor extends GuiElement {
if (mouseX >= socialLeft && mouseX <= socialLeft + 16 &&
mouseY >= y + 6 && mouseY <= y + 23) {
- try {
- Desktop.getDesktop().browse(new URI(socialsLink[socialIndex]));
- } catch (Exception ignored) {
- }
+ Utils.openUrl(socialsLink[socialIndex]);
return true;
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java
index 10a4de0e..9d7a0775 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Fishing.java
@@ -263,8 +263,8 @@ public class Fishing {
@Expose
@ConfigOption(
- name = "Fishing timer colour (30s)",
- desc = "Colour of the fishing timer after 30 seconds or more have passed",
+ name = "Fishing timer colour (20s)",
+ desc = "Colour of the fishing timer after 20 seconds or more have passed",
searchTags = "color"
)
@ConfigEditorColour
@@ -273,8 +273,8 @@ public class Fishing {
@Expose
@ConfigOption(
- name = "Fishing timer ping (30s)",
- desc = "Play a sound after 30 seconds passed"
+ name = "Fishing timer ping (20s)",
+ desc = "Play a sound after 20 seconds passed"
)
@ConfigEditorBoolean
@ConfigAccordionId(id = 6)
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java
index 84bce030..081fd4b3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java
@@ -24,7 +24,6 @@ import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigAccordionId;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorAccordion;
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.ConfigEditorColour;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDraggableList;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDropdown;
@@ -121,7 +120,7 @@ public class ItemOverlays {
name = "Block Zapper Overlay",
desc = ""
)
- @ConfigEditorAccordion(id = 6)
+ @ConfigEditorAccordion(id = 2)
public boolean zapperAccordion = false;
@Expose
@@ -130,7 +129,7 @@ public class ItemOverlays {
desc = "Show which blocks will be destroyed when using the Block Zapper"
)
@ConfigEditorBoolean
- @ConfigAccordionId(id = 6)
+ @ConfigAccordionId(id = 2)
public boolean enableZapperOverlay = true;
@Expose
@@ -140,14 +139,14 @@ public class ItemOverlays {
searchTags = "color"
)
@ConfigEditorColour
- @ConfigAccordionId(id = 6)
+ @ConfigAccordionId(id = 2)
public String zapperOverlayColour = "0:102:171:5:0";
@ConfigOption(
name = "Smooth AOTE/AOTV/Hyp",
desc = ""
)
- @ConfigEditorAccordion(id = 2)
+ @ConfigEditorAccordion(id = 3)
public boolean aoteAccordion = false;
@Expose
@@ -156,7 +155,7 @@ public class ItemOverlays {
desc = "Teleport smoothly to your destination when using AOTE or AOTV"
)
@ConfigEditorBoolean
- @ConfigAccordionId(id = 2)
+ @ConfigAccordionId(id = 3)
public boolean enableSmoothAOTE = true;
@Expose
@@ -165,7 +164,7 @@ public class ItemOverlays {
desc = "Teleport smoothly to your destination when using Hyperion"
)
@ConfigEditorBoolean
- @ConfigAccordionId(id = 2)
+ @ConfigAccordionId(id = 3)
public boolean enableSmoothHyperion = true;
@Expose
@@ -178,7 +177,7 @@ public class ItemOverlays {
maxValue = 500,
minStep = 25
)
- @ConfigAccordionId(id = 2)
+ @ConfigAccordionId(id = 3)
public int smoothTpMillis = 125;
@Expose
@@ -191,7 +190,7 @@ public class ItemOverlays {
maxValue = 500,
minStep = 25
)
- @ConfigAccordionId(id = 2)
+ @ConfigAccordionId(id = 3)
public int smoothTpMillisEtherwarp = 50;
@Expose
@@ -200,14 +199,14 @@ public class ItemOverlays {
desc = "Remove the explosion effect when using a hyperion"
)
@ConfigEditorBoolean
- @ConfigAccordionId(id = 2)
+ @ConfigAccordionId(id = 3)
public boolean disableHyperionParticles = true;
@ConfigOption(
name = "Etherwarp",
desc = ""
)
- @ConfigEditorAccordion(id = 3)
+ @ConfigEditorAccordion(id = 4)
public boolean etherwarpAccordion = false;
@Expose
@@ -216,7 +215,7 @@ public class ItemOverlays {
desc = "Zoom in on targeted blocks with etherwarp, making it easier to adjust at a distance"
)
@ConfigEditorBoolean
- @ConfigAccordionId(id = 3)
+ @ConfigAccordionId(id = 4)
public boolean etherwarpZoom = true;
@Expose
@@ -225,7 +224,7 @@ public class ItemOverlays {
desc = "Display an overlay which tells you if the etherwarp will fail."
)
@ConfigEditorBoolean
- @ConfigAccordionId(id = 3)
+ @ConfigAccordionId(id = 4)
public boolean enableEtherwarpHelperOverlay = true;
@Expose
@@ -234,7 +233,7 @@ public class ItemOverlays {
desc = "Display an overlay that tells you what block you will TP to."
)
@ConfigEditorBoolean
- @ConfigAccordionId(id = 3)
+ @ConfigAccordionId(id = 4)
public boolean enableEtherwarpBlockOverlay = true;
@Expose
@@ -243,7 +242,7 @@ public class ItemOverlays {
desc = "Don't display the etherwarp block overlay when you can't TP to the block"
)
@ConfigEditorBoolean
- @ConfigAccordionId(id = 3)
+ @ConfigAccordionId(id = 4)
public boolean disableOverlayWhenFailed = false;
@Expose
@@ -253,14 +252,14 @@ public class ItemOverlays {
searchTags = "color"
)
@ConfigEditorColour
- @ConfigAccordionId(id = 3)
+ @ConfigAccordionId(id = 4)
public String etherwarpHighlightColour = "00:70:156:8:96";
@ConfigOption(
name = "Bonemerang Overlay",
desc = ""
)
- @ConfigEditorAccordion(id = 4)
+ @ConfigEditorAccordion(id = 5)
public boolean bonemerangAccordion = false;
@Expose
@@ -269,7 +268,7 @@ public class ItemOverlays {
desc = "Shows info about the bonemerang while holding it."
)
@ConfigEditorBoolean
- @ConfigAccordionId(id = 4)
+ @ConfigAccordionId(id = 5)
public boolean enableBonemerangOverlay = true;
@Expose
@@ -278,7 +277,7 @@ public class ItemOverlays {
desc = "Highlight entities that will be hit by your bonemerang"
)
@ConfigEditorBoolean
- @ConfigAccordionId(id = 4)
+ @ConfigAccordionId(id = 5)
public boolean highlightTargeted = true;
@Expose
@@ -296,7 +295,7 @@ public class ItemOverlays {
"\u00a77Targets: \u00a76\u00a7l10"
}
)
- @ConfigAccordionId(id = 4)
+ @ConfigAccordionId(id = 5)
public List<Integer> bonemerangOverlayText = new ArrayList<>(Arrays.asList(0, 1));
@Expose
@@ -307,7 +306,7 @@ public class ItemOverlays {
@ConfigEditorDropdown(
values = {"Background", "No Shadow", "Shadow Only", "Full Shadow"}
)
- @ConfigAccordionId(id = 4)
+ @ConfigAccordionId(id = 5)
public int bonemerangOverlayStyle = 0;
@Expose
@ConfigOption(
@@ -316,14 +315,14 @@ public class ItemOverlays {
"Might cause some lag."
)
@ConfigEditorBoolean
- @ConfigAccordionId(id = 4)
+ @ConfigAccordionId(id = 5)
public boolean bonemerangFastUpdate = false;
@ConfigOption(
name = "Minion Crystal Radius Overlay",
desc = ""
)
- @ConfigEditorAccordion(id = 5)
+ @ConfigEditorAccordion(id = 6)
public boolean crystalAccordion = false;
@Expose
@@ -332,7 +331,7 @@ public class ItemOverlays {
desc = "Show a block overlay for the effective radius of minion crystals (farming, mining, etc)."
)
@ConfigEditorBoolean
- @ConfigAccordionId(id = 5)
+ @ConfigAccordionId(id = 6)
public boolean enableCrystalOverlay = true;
@Expose
@@ -341,14 +340,14 @@ public class ItemOverlays {
desc = "Show the crystal overlay, even when a minion crystal is not being held."
)
@ConfigEditorBoolean
- @ConfigAccordionId(id = 5)
+ @ConfigAccordionId(id = 6)
public boolean alwaysShowCrystal = false;
@ConfigOption(
name = "Farming Overlays",
desc = ""
)
- @ConfigEditorAccordion(id = 6)
+ @ConfigEditorAccordion(id = 7)
public boolean farmingAccordion = false;
@Expose
@@ -357,7 +356,7 @@ public class ItemOverlays {
desc = "Show a block overlay for the effected blocks of prismapump's ability."
)
@ConfigEditorBoolean
- @ConfigAccordionId(id = 6)
+ @ConfigAccordionId(id = 7)
public boolean enablePrismapumpOverlay = true;
@Expose
@@ -366,7 +365,7 @@ public class ItemOverlays {
desc = "Show a block overlay for the effected blocks of the hoe of tilling's ability."
)
@ConfigEditorBoolean
- @ConfigAccordionId(id = 6)
+ @ConfigAccordionId(id = 7)
public boolean enableHoeOverlay = true;
@Expose
@@ -375,18 +374,18 @@ public class ItemOverlays {
desc = "Show a block overlay for the effected blocks of dirt wand's ability."
)
@ConfigEditorBoolean
- @ConfigAccordionId(id = 6)
+ @ConfigAccordionId(id = 7)
public boolean enableDirtWandOverlay = true;
@ConfigOption(
name="Custom Wither Cloak",
desc = ""
)
- @ConfigEditorAccordion(id = 7)
+ @ConfigEditorAccordion(id = 8)
public boolean customWitherCloakAccordion = false;
@Expose
- @ConfigAccordionId(id = 7)
+ @ConfigAccordionId(id = 8)
@ConfigOption(
name = "Enable Custom Wither Cloak",
desc = "Replaces Hypixel Wither Cloak with custom shields due to the Hypixel Wither Cloak being difficult to see through"
@@ -395,7 +394,7 @@ public class ItemOverlays {
public boolean customWitherCloakToggle = true;
@Expose
- @ConfigAccordionId(id = 7)
+ @ConfigAccordionId(id = 8)
@ConfigOption(
name = "Shield Count",
desc = "The amount of shields circling the player\n0 = No shields"
@@ -408,7 +407,7 @@ public class ItemOverlays {
public int customWitherCloakCount = 6;
@Expose
- @ConfigAccordionId(id = 7)
+ @ConfigAccordionId(id = 8)
@ConfigOption(
name = "Shield Speed",
desc = "How fast they circle the player\n0 = Not moving\nNegative = Spinning opposite direction"
@@ -437,7 +436,7 @@ public class ItemOverlays {
*/
@Expose
- @ConfigAccordionId(id = 7)
+ @ConfigAccordionId(id = 8)
@ConfigOption(
name = "Shield Distance From Player",
desc = "How far (in blocks) each shield is from the player\n" +
@@ -451,7 +450,7 @@ public class ItemOverlays {
public float customWitherCloakDistance = 1.2f;
@Expose
- @ConfigAccordionId(id = 7)
+ @ConfigAccordionId(id = 8)
@ConfigOption(
name = "\u00A7aInspiration:",
desc = "\u00A76u/Sori0612 \u00A77on \u00A7cReddit\n\n\u00A78https://tinyurl.com/creeperveil"
@@ -469,4 +468,20 @@ public class ItemOverlays {
@ConfigEditorBoolean
public boolean pickaxeAbility = true;
+ @Expose
+ @ConfigOption(
+ name = "Bonzo Mask Ability Cooldown",
+ desc = "Show the cooldown duration of a bonzo mask ability as the durability."
+ )
+ @ConfigEditorBoolean
+ public boolean bonzoAbility = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Spirit Mask Ability Cooldown",
+ desc = "Show the cooldown duration of the spirit mask ability as the durability."
+ )
+ @ConfigEditorBoolean
+ public boolean spiritAbility = true;
+
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/LocationEdit.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/LocationEdit.java
index fdfb6f93..52fd0c4a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/LocationEdit.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/LocationEdit.java
@@ -19,10 +19,12 @@
package io.github.moulberry.notenoughupdates.options.seperateSections;
+import com.google.gson.annotations.Expose;
import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigAccordionId;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorAccordion;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorButton;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDropdown;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
public class LocationEdit {
@@ -37,6 +39,16 @@ public class LocationEdit {
)
public Position positions = new Position(-1, -1);
+ @Expose
+ @ConfigOption(
+ name = "Edit Gui Scale",
+ desc = "Change the size of NEU's overlays"
+ )
+ @ConfigEditorDropdown(
+ values = {"Default", "Small", "Normal", "Large", "Auto"}
+ )
+ public int guiScale = 0;
+
@ConfigOption(
name = "Edit Dungeon Map",
desc = "The NEU dungeon map has it's own editor (/neumap).\n" +
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java
index 3a7d0b81..b72610b8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java
@@ -55,6 +55,14 @@ public class Misc {
@ConfigEditorBoolean
public boolean streamerMode = false;
+ @Expose
+ @ConfigOption(
+ name = "Fix Steve skulls",
+ desc = "Fix some skulls and skins not downloading on old java versions. May require restart."
+ )
+ @ConfigEditorBoolean
+ public boolean fixSteveSkulls = true;
+
@ConfigOption(
name = "Fairy Soul Waypoints",
desc = ""
@@ -294,4 +302,13 @@ public class Misc {
)
@ConfigEditorBoolean
public boolean abiphoneFavourites = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Dungeon Groups PV",
+ desc = "View another player's profile by clicking on the chat message when they join in a dungeon group."
+ )
+ @ConfigEditorBoolean
+ public boolean dungeonGroupsPV = true;
+
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SkillOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SkillOverlays.java
index db0a0e94..f9dbe69e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SkillOverlays.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SkillOverlays.java
@@ -24,7 +24,6 @@ import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigAccordionId;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorAccordion;
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.ConfigEditorDropdown;
import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorFSR;
@@ -303,7 +302,7 @@ public class SkillOverlays {
)
@ConfigEditorBoolean
@ConfigAccordionId(id = 4)
- public boolean combatSkillOverlay = true;
+ public boolean combatSkillOverlay = false;
@Expose
@ConfigOption(
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java
index 2d88544e..d8fe91d5 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java
@@ -64,12 +64,12 @@ public class Toolbar {
@Expose
@ConfigOption(
- name = "Show a help settings button",
- desc = "Show quick settings button in the NEU toolbar"
+ name = "Show an inventory search button",
+ desc = "Show button to enable inventory searching in the NEU toolbar"
)
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
- public boolean enableHelpButton = true;
+ public boolean enableSearchModeButton = true;
@Expose
@ConfigOption(
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java
index 5c320db1..8539c3c4 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java
@@ -227,7 +227,7 @@ public class TooltipTweaks {
@Expose
@ConfigOption(
name = "Abiphone NPC Location",
- desc = "Click on an NPC to set an marker at the location"
+ desc = "Click on an NPC to set a marker at the location"
)
@ConfigEditorBoolean
public boolean abiphoneContactMarker = true;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/WardrobeKeybinds.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/WardrobeKeybinds.java
new file mode 100644
index 00000000..48d1b434
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/WardrobeKeybinds.java
@@ -0,0 +1,126 @@
+/*
+ * 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.options.seperateSections;
+
+import com.google.gson.annotations.Expose;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigAccordionId;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorAccordion;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorKeybind;
+import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption;
+import org.lwjgl.input.Keyboard;
+
+public class WardrobeKeybinds {
+
+ @Expose
+ @ConfigOption(
+ name = "Enable Wardrobe Keybinds",
+ desc = "Lets you use your number keys to quickly change your wardrobe"
+ )
+ @ConfigEditorBoolean
+ public boolean enableWardrobeKeybinds = false;
+
+ @ConfigOption(
+ name = "Wardrobe Keybinds",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 2)
+ public boolean wardrobeKeybindAccordion = false;
+ @Expose
+ @ConfigOption(
+ name = "Slot 1",
+ desc = "Keybind to toggle the first set in your wardrobe"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_1)
+ @ConfigAccordionId(id = 2)
+ public int wardrobeSlot1 = Keyboard.KEY_1;
+
+ @Expose
+ @ConfigOption(
+ name = "Slot 2",
+ desc = "Keybind to toggle the second set in your wardrobe"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_2)
+ @ConfigAccordionId(id = 2)
+ public int wardrobeSlot2 = Keyboard.KEY_2;
+
+ @Expose
+ @ConfigOption(
+ name = "Slot 3",
+ desc = "Keybind to toggle the third set in your wardrobe"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_3)
+ @ConfigAccordionId(id = 2)
+ public int wardrobeSlot3 = Keyboard.KEY_3;
+
+ @Expose
+ @ConfigOption(
+ name = "Slot 4",
+ desc = "Keybind to toggle the fourth set in your wardrobe"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_4)
+ @ConfigAccordionId(id = 2)
+ public int wardrobeSlot4 = Keyboard.KEY_4;
+
+ @Expose
+ @ConfigOption(
+ name = "Slot 5",
+ desc = "Keybind to toggle the fifth set in your wardrobe"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_5)
+ @ConfigAccordionId(id = 2)
+ public int wardrobeSlot5 = Keyboard.KEY_5;
+
+ @Expose
+ @ConfigOption(
+ name = "Slot 6",
+ desc = "Keybind to toggle the sixth set in your wardrobe"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_6)
+ @ConfigAccordionId(id = 2)
+ public int wardrobeSlot6 = Keyboard.KEY_6;
+
+ @Expose
+ @ConfigOption(
+ name = "Slot 7",
+ desc = "Keybind to toggle the seventh set in your wardrobe"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_7)
+ @ConfigAccordionId(id = 2)
+ public int wardrobeSlot7 = Keyboard.KEY_7;
+
+ @Expose
+ @ConfigOption(
+ name = "Slot 8",
+ desc = "Keybind to toggle the eighth set in your wardrobe"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_8)
+ @ConfigAccordionId(id = 2)
+ public int wardrobeSlot8 = Keyboard.KEY_8;
+
+ @Expose
+ @ConfigOption(
+ name = "Slot 9",
+ desc = "Keybind to toggle the ninth set in your wardrobe"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_9)
+ @ConfigAccordionId(id = 2)
+ public int wardrobeSlot9 = Keyboard.KEY_9;
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingSkillOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingSkillOverlay.java
index 08cbb189..51f3d351 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingSkillOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingSkillOverlay.java
@@ -167,6 +167,9 @@ public class FarmingSkillOverlay extends TextOverlay {
//Set default skilltype to Farming and get BZprice config value
boolean useBZPrice = NotEnoughUpdates.INSTANCE.config.skillOverlays.useBZPrice;
skillType = "Farming";
+ Farming = 1;
+ Alch = 0;
+ Foraging = 0;
//WARTS
if (internalname.startsWith("THEORETICAL_HOE_WARTS")) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FuelBar.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FuelBar.java
index a70035f1..f2e485f2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FuelBar.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FuelBar.java
@@ -100,7 +100,8 @@ public class FuelBar {
fuelAmount = .3f;
}
if (event.type == RenderGameOverlayEvent.ElementType.ALL) {
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ GlStateManager.pushMatrix();
+ ScaledResolution scaledResolution = Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.locationedit.guiScale);
Position position = NotEnoughUpdates.INSTANCE.config.mining.drillFuelBarPosition;
int x = position.getAbsX(scaledResolution, NotEnoughUpdates.INSTANCE.config.mining.drillFuelBarWidth);
@@ -139,6 +140,8 @@ public class FuelBar {
Minecraft.getMinecraft().fontRendererObj.drawString(str,
x + 2, y, 0xffffff, false
);
+ Utils.pushGuiScale(0);
+ GlStateManager.popMatrix();
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java
index 7884b2ac..2fbbe27d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextOverlay.java
@@ -19,6 +19,7 @@
package io.github.moulberry.notenoughupdates.overlays;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -120,12 +121,15 @@ public abstract class TextOverlay {
return new Vector2f();
}
- protected Vector2f getPosition(int overlayWidth, int overlayHeight) {
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ protected Vector2f getPosition(int overlayWidth, int overlayHeight, boolean scaled) {
+ GlStateManager.pushMatrix();
+ ScaledResolution scaledResolution;
+ if (!scaled) scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
+ else scaledResolution = Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.locationedit.guiScale);
int x = position.getAbsX(scaledResolution, overlayWidth);
int y = position.getAbsY(scaledResolution, overlayHeight);
-
+ GlStateManager.popMatrix();
return new Vector2f(x, y);
}
@@ -138,17 +142,19 @@ public abstract class TextOverlay {
private void render(List<String> strings, boolean dummy) {
if (strings == null) return;
-
+ if (!dummy) {
+ GlStateManager.pushMatrix();
+ Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.locationedit.guiScale);
+ }
Vector2f size = getSize(strings);
overlayHeight = (int) size.y;
overlayWidth = (int) size.x;
- Vector2f position = getPosition(overlayWidth, overlayHeight);
+ Vector2f position = getPosition(overlayWidth, overlayHeight, !dummy);
int x = (int) position.x;
int y = (int) position.y;
TextOverlayStyle style = styleSupplier.get();
-
if (style == TextOverlayStyle.BACKGROUND) Gui.drawRect(x, y, x + overlayWidth, y + overlayHeight, 0x80000000);
GlStateManager.enableBlend();
@@ -204,5 +210,9 @@ public abstract class TextOverlay {
}
}
}
+ if (!dummy) {
+ Utils.pushGuiScale(0);
+ GlStateManager.popMatrix();
+ }
}
}
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 7edbee6b..419c9785 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
@@ -37,7 +37,6 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import org.lwjgl.input.Keyboard;
import org.lwjgl.util.vector.Vector2f;
import java.time.ZoneId;
@@ -302,10 +301,14 @@ public class TimersOverlay extends TextTabOverlay {
boolean foundCookieBuffText = false;
boolean foundGodPotText = false;
+ boolean foundEffectsText = false;
if (SBInfo.getInstance().getLocation() != null && !SBInfo.getInstance().getLocation().equals("dungeon") &&
SBInfo.getInstance().footer != null) {
String formatted = SBInfo.getInstance().footer.getFormattedText();
for (String line : formatted.split("\n")) {
+ if (line.contains("Active Effects")) {
+ foundEffectsText = true;
+ }
Matcher activeEffectsMatcher = PATTERN_ACTIVE_EFFECTS.matcher(line);
if (activeEffectsMatcher.matches()) {
foundGodPotText = true;
@@ -341,9 +344,9 @@ public class TimersOverlay extends TextTabOverlay {
}
}
} catch (Exception e) {
- e.printStackTrace();
if (!hasErrorMessage) {
Utils.addChatMessage(EnumChatFormatting.YELLOW + "[NEU] Unable to work out your god pot timer");
+ e.printStackTrace();
hasErrorMessage = true;
}
break;
@@ -355,8 +358,10 @@ public class TimersOverlay extends TextTabOverlay {
foundCookieBuffText = true;
} else if (foundCookieBuffText) {
String clean = line.replaceAll("(\u00a7.)", "");
+ clean = clean.replaceAll("(\\d)([smhdy])", "$1 $2");
String[] cleanSplit = clean.split(" ");
hidden.cookieBuffRemaining = 0;
+ if (line.contains("Not")) break;
for (int i = 0; i + 1 < cleanSplit.length; i++) {
if (i % 2 == 1) continue;
@@ -410,7 +415,7 @@ public class TimersOverlay extends TextTabOverlay {
}
}
- if (!foundGodPotText) {
+ if (!foundGodPotText && foundEffectsText) {
hidden.godPotionDuration = 0;
}
@@ -721,7 +726,7 @@ public class TimersOverlay extends TextTabOverlay {
// Daily Mithril Powder display
long mithrilPowderCompleted = hidden.dailyMithrilPowerCompleted + 1000 * 60 * 60 * 24 - currentTime;
- if (hidden.dailyMithrilPowerCompleted < midnightReset) {
+ if (hidden.dailyMithrilPowerCompleted < catacombsReset) {
map.put(
7,
DARK_AQUA + "Mithril Powder: " +
@@ -729,29 +734,29 @@ public class TimersOverlay extends TextTabOverlay {
);
} else if (
NotEnoughUpdates.INSTANCE.config.miscOverlays.dailyMithrilPowderDisplay >= DISPLAYTYPE.VERYSOON.ordinal() &&
- (hidden.dailyMithrilPowerCompleted < (midnightReset - TimeEnums.HALFANHOUR.time))) {
+ (hidden.dailyMithrilPowerCompleted < (catacombsReset - TimeEnums.HALFANHOUR.time))) {
map.put(
7,
DARK_AQUA + "Mithril Powder: " +
EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour] +
- Utils.prettyTime(timeDiffMidnightNow)
+ Utils.prettyTime(catacombsDiffNow)
);
} else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.dailyMithrilPowderDisplay >= DISPLAYTYPE.SOON.ordinal() &&
- (hidden.dailyMithrilPowerCompleted < (midnightReset - TimeEnums.HOUR.time))) {
+ (hidden.dailyMithrilPowerCompleted < (catacombsReset - TimeEnums.HOUR.time))) {
map.put(
7,
DARK_AQUA + "Mithril Powder: " +
EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour] +
- Utils.prettyTime(timeDiffMidnightNow)
+ Utils.prettyTime(catacombsDiffNow)
);
} else if (
NotEnoughUpdates.INSTANCE.config.miscOverlays.dailyMithrilPowderDisplay >= DISPLAYTYPE.KINDASOON.ordinal() &&
- (hidden.dailyMithrilPowerCompleted < (midnightReset - (TimeEnums.HOUR.time * 3)))) {
+ (hidden.dailyMithrilPowerCompleted < (catacombsReset - (TimeEnums.HOUR.time * 3)))) {
map.put(
7,
DARK_AQUA + "Mithril Powder: " +
EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour] +
- Utils.prettyTime(timeDiffMidnightNow)
+ Utils.prettyTime(catacombsDiffNow)
);
} else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.dailyMithrilPowderDisplay >=
DISPLAYTYPE.ALWAYS.ordinal()) {
@@ -759,12 +764,12 @@ public class TimersOverlay extends TextTabOverlay {
7,
DARK_AQUA + "Mithril Powder: " +
EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour] +
- Utils.prettyTime(timeDiffMidnightNow)
+ Utils.prettyTime(catacombsDiffNow)
);
}
// Daily Gemstone Powder Display
- if (hidden.dailyGemstonePowderCompleted < midnightReset) {
+ if (hidden.dailyGemstonePowderCompleted < catacombsReset) {
map.put(
8,
DARK_AQUA + "Gemstone Powder: " +
@@ -772,29 +777,29 @@ public class TimersOverlay extends TextTabOverlay {
);
} else if (
NotEnoughUpdates.INSTANCE.config.miscOverlays.dailyGemstonePowderDisplay >= DISPLAYTYPE.VERYSOON.ordinal() &&
- (hidden.dailyGemstonePowderCompleted < (midnightReset - TimeEnums.HALFANHOUR.time))) {
+ (hidden.dailyGemstonePowderCompleted < (catacombsReset - TimeEnums.HALFANHOUR.time))) {
map.put(
8,
DARK_AQUA + "Gemstone Powder: " +
EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour] +
- Utils.prettyTime(timeDiffMidnightNow)
+ Utils.prettyTime(catacombsDiffNow)
);
} else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.dailyGemstonePowderDisplay >= DISPLAYTYPE.SOON.ordinal() &&
- (hidden.dailyGemstonePowderCompleted < (midnightReset - TimeEnums.HOUR.time))) {
+ (hidden.dailyGemstonePowderCompleted < (catacombsReset - TimeEnums.HOUR.time))) {
map.put(
8,
DARK_AQUA + "Gemstone Powder: " +
EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour] +
- Utils.prettyTime(timeDiffMidnightNow)
+ Utils.prettyTime(catacombsDiffNow)
);
} else if (
NotEnoughUpdates.INSTANCE.config.miscOverlays.dailyGemstonePowderDisplay >= DISPLAYTYPE.KINDASOON.ordinal() &&
- (hidden.dailyGemstonePowderCompleted < (midnightReset - (TimeEnums.HOUR.time * 3)))) {
+ (hidden.dailyGemstonePowderCompleted < (catacombsReset - (TimeEnums.HOUR.time * 3)))) {
map.put(
8,
DARK_AQUA + "Gemstone Powder: " +
EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour] +
- Utils.prettyTime(timeDiffMidnightNow)
+ Utils.prettyTime(catacombsDiffNow)
);
} else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.dailyGemstonePowderDisplay >=
DISPLAYTYPE.ALWAYS.ordinal()) {
@@ -802,7 +807,7 @@ public class TimersOverlay extends TextTabOverlay {
8,
DARK_AQUA + "Gemstone Powder: " +
EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour] +
- Utils.prettyTime(timeDiffMidnightNow)
+ Utils.prettyTime(catacombsDiffNow)
);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java
index 30ac269b..873ee9f2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java
@@ -265,6 +265,16 @@ public class BasicPage extends GuiProfileViewerPage {
networth = profile.getNetWorth(profileId);
}
+ //Networth is under 0
+ //If = -1 -> an error occurred
+ //If = -2 -> still loading networth
+ String stateStr = EnumChatFormatting.RED + "An error occurred";
+ if (networth == -2) {
+ stateStr = EnumChatFormatting.YELLOW + "Loading...";
+ } else if (networth == -1) {
+ networth = profile.getNetWorth(profileId);
+ }
+
if (networth > 0) {
Utils.drawStringCentered(
EnumChatFormatting.GREEN + "Net Worth: " + EnumChatFormatting.GOLD +
@@ -302,16 +312,16 @@ public class BasicPage extends GuiProfileViewerPage {
EnumChatFormatting.GOLD +
networthIRLMoney
);
- getInstance().tooltipToDisplay.add("");
if (NotEnoughUpdates.INSTANCE.config.profileViewer.useSoopyNetworth
&& profile.getSoopyNetworthLeaderboardPosition() >= 0
&& profile.isProfileMaxSoopyWeight(profile, profileId)) {
-
+ getInstance().tooltipToDisplay.add("");
String lbPosStr =
EnumChatFormatting.DARK_GREEN + "#" + EnumChatFormatting.GOLD + GuiProfileViewer.numberFormat.format(
profile.getSoopyNetworthLeaderboardPosition());
- getInstance().tooltipToDisplay.add(lbPosStr + EnumChatFormatting.GREEN + " on soopy's networth leaderboard!");
+ getInstance().tooltipToDisplay.add(
+ lbPosStr + EnumChatFormatting.GREEN + " on soopy's networth leaderboard!");
}
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
@@ -336,15 +346,6 @@ public class BasicPage extends GuiProfileViewerPage {
}
}
} else {
- //Networth is under 0
- //If = -1 -> an error occured
- //If = -2 -> still loading networth
-
- String stateStr = EnumChatFormatting.RED + "An error occured";
- if (networth == -2) {
- stateStr = EnumChatFormatting.YELLOW + "Loading...";
- }
-
Utils.drawStringCentered(
EnumChatFormatting.GREEN + "Net Worth: " + stateStr,
fr,
@@ -886,14 +887,14 @@ public class BasicPage extends GuiProfileViewerPage {
EnumChatFormatting.DARK_GREEN + "#" + EnumChatFormatting.GOLD + GuiProfileViewer.numberFormat.format(
profile.getSoopyWeightLeaderboardPosition());
getInstance().tooltipToDisplay.add("");
- String stateStr = EnumChatFormatting.RED + "An error occured";
+ String stateStr = EnumChatFormatting.RED + "An error occurred";
if (weight == -2) {
stateStr = EnumChatFormatting.YELLOW + "Loading";
}
if (weight > 0)
getInstance().tooltipToDisplay.add(lbPosStr + EnumChatFormatting.GREEN + " on soopy's weight leaderboard!");
else
- getInstance().tooltipToDisplay.add(stateStr + " soopy's weight leaderboard");
+ getInstance().tooltipToDisplay.add(stateStr + " on soopy's weight leaderboard");
}
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CrimsonIslePage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CrimsonIslePage.java
index f9d91935..95009b1d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CrimsonIslePage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/CrimsonIslePage.java
@@ -32,6 +32,7 @@ import org.lwjgl.opengl.GL11;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.LinkedHashMap;
@@ -129,7 +130,7 @@ public class CrimsonIslePage extends GuiProfileViewerPage {
drawDojoStats(netherIslandPlayerData, guiLeft, guiTop);
// Kuudra stats
- drawKuudraStats(netherIslandPlayerData, guiLeft, guiTop);
+ drawKuudraStats(netherIslandPlayerData, guiLeft, guiTop, mouseX, mouseY);
// Last matriarch attempt
drawLastMatriarchAttempt(netherIslandPlayerData, guiLeft, guiTop);
@@ -138,7 +139,7 @@ public class CrimsonIslePage extends GuiProfileViewerPage {
drawFactionReputation(netherIslandPlayerData, guiLeft, guiTop);
}
- public void drawKuudraStats(JsonObject data, int guiLeft, int guiTop) {
+ public void drawKuudraStats(JsonObject data, int guiLeft, int guiTop, int mouseX, int mouseY) {
Utils.drawStringCentered(
EnumChatFormatting.RED + "Kuudra Stats",
Minecraft.getMinecraft().fontRendererObj,
@@ -161,26 +162,48 @@ public class CrimsonIslePage extends GuiProfileViewerPage {
int completions =
kuudraCompletedTiers.has(kuudraTiers[i]) ? kuudraCompletedTiers.get(kuudraTiers[i]).getAsInt() : 0;
+ // Get the highest wave for this tier of kuudra if they have completed a run
+ // since infernal kuudra was released
+ int highestWaveCompleted = kuudraCompletedTiers.has("highest_wave_" + kuudraTiers[i]) ?
+ kuudraCompletedTiers.get("highest_wave_" + kuudraTiers[i]).getAsInt() : 0;
+
Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(
KUUDRA_KEYS[i],
guiLeft + 8,
- guiTop + 25 + (i * 12)
+ guiTop + 30 + (i * 30)
);
Utils.renderAlignedString(
EnumChatFormatting.RED + KUUDRA_TIERS[i] + ": ",
EnumChatFormatting.WHITE + String.valueOf(completions),
guiLeft + 23,
- guiTop + 30 + (i * 12),
+ guiTop + 30 + (i * 30),
+ 110
+ );
+
+ Utils.renderAlignedString(
+ EnumChatFormatting.RED + "Highest Wave: ",
+ EnumChatFormatting.WHITE + (highestWaveCompleted != 0 ? String.valueOf(highestWaveCompleted) : "N/A"),
+ guiLeft + 23,
+ guiTop + 42 + (i * 30),
110
);
+
+ if (highestWaveCompleted == 0) {
+ if (mouseX > guiLeft + 23 && mouseX < guiLeft + 133 && mouseY < guiTop + 50 + (i*30) && mouseY > guiTop + 42 + (i*30)) {
+ getInstance().tooltipToDisplay = new ArrayList<>();
+ getInstance().tooltipToDisplay.add(EnumChatFormatting.RED + "N/A will only show for highest wave");
+ getInstance().tooltipToDisplay.add(EnumChatFormatting.RED + "if you have not completed a run for");
+ getInstance().tooltipToDisplay.add(EnumChatFormatting.RED + "this tier since Infernal tier was released.");
+ }
+ }
}
Utils.renderAlignedString(
- EnumChatFormatting.RED + "Total: ",
+ EnumChatFormatting.RED + "Total runs: ",
EnumChatFormatting.WHITE + String.valueOf(getTotalKuudraRuns(kuudraCompletedTiers)),
guiLeft + 23,
- guiTop + 40 + (5 * 12),
+ guiTop + 30 + (5 * 30),
110
);
}
@@ -188,6 +211,7 @@ public class CrimsonIslePage extends GuiProfileViewerPage {
public int getTotalKuudraRuns(JsonObject completedRuns) {
int totalRuns = 0;
for (Map.Entry<String, JsonElement> runs : completedRuns.entrySet()) {
+ if (runs.getKey().startsWith("highest_wave")) continue;
totalRuns += runs.getValue().getAsInt();
}
return totalRuns;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java
index 21ccc683..59c78dda 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java
@@ -39,6 +39,7 @@ import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
@@ -50,7 +51,7 @@ import java.util.TimeZone;
import java.util.TreeMap;
public class ExtraPage extends GuiProfileViewerPage {
-
+// Hehe
private static final ResourceLocation pv_extra = new ResourceLocation("notenoughupdates:pv_extra.png");
private TreeMap<Integer, Set<String>> topKills = null;
private TreeMap<Integer, Set<String>> topDeaths = null;
@@ -108,7 +109,9 @@ public class ExtraPage extends GuiProfileViewerPage {
float xStart,
float yStartTop,
float xOffset,
- float yOffset
+ float yOffset,
+ float mouseX,
+ float mouseY
) {
int guiLeft = GuiProfileViewer.getGuiLeft();
int guiTop = GuiProfileViewer.getGuiTop();
@@ -143,6 +146,28 @@ public class ExtraPage extends GuiProfileViewerPage {
guiTop + yStartTop + (yOffset - 1) * i,
76
);
+ if (Constants.ESSENCESHOPS == null) return;
+ JsonObject essenceShops = Constants.ESSENCESHOPS;
+ if (mouseX >= guiLeft + xStart + xOffset && mouseX <= guiLeft + xStart + xOffset + 76 &&
+ mouseY >= guiTop + yStartTop + (yOffset - 1) * i &&
+ mouseY <= guiTop + yStartTop + (yOffset - 1) * i + 10) {
+ getInstance().tooltipToDisplay = new ArrayList<>();
+ if (essenceShops.get(essenceName) == null) continue;
+
+ for (Map.Entry<String, JsonElement> entry : essenceShops.get(essenceName).getAsJsonObject().entrySet()) {
+ int perkTier =
+ (profileInfo.has("perks") && profileInfo.get("perks").getAsJsonObject().has(entry.getKey()) ? profileInfo
+ .get("perks")
+ .getAsJsonObject()
+ .get(entry.getKey())
+ .getAsInt() : 0);
+ int max = entry.getValue().getAsJsonObject().get("costs").getAsJsonArray().size();
+ EnumChatFormatting formatting = perkTier == max ? EnumChatFormatting.GREEN : EnumChatFormatting.AQUA;
+ String name = entry.getValue().getAsJsonObject().get("name").getAsString();
+ getInstance().tooltipToDisplay.add(EnumChatFormatting.GOLD + name + ": " + formatting + perkTier + "/" + max);
+ }
+
+ }
}
}
@@ -414,7 +439,7 @@ public class ExtraPage extends GuiProfileViewerPage {
76
);
- drawEssence(profileInfo, xStart, yStartTop, xOffset, yOffset);
+ drawEssence(profileInfo, xStart, yStartTop, xOffset, yOffset, mouseX, mouseY);
if (topKills == null) {
topKills = new TreeMap<>();
@@ -565,4 +590,10 @@ public class ExtraPage extends GuiProfileViewerPage {
}
return null;
}
+
+ @Override
+ public void resetCache() {
+ topDeaths = null;
+ topKills = null;
+ }
}
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 63717093..4bf65cc6 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java
@@ -20,19 +20,16 @@
package io.github.moulberry.notenoughupdates.profileviewer;
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.StringUtils;
import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager;
import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField;
-import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay;
import io.github.moulberry.notenoughupdates.profileviewer.bestiary.BestiaryPage;
import io.github.moulberry.notenoughupdates.profileviewer.trophy.TrophyFishPage;
import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.DungeonsWeight;
import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.SkillsWeight;
import io.github.moulberry.notenoughupdates.util.AsyncDependencyLoader;
-import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.PronounDB;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
@@ -58,8 +55,6 @@ import org.lwjgl.opengl.GL20;
import java.awt.*;
import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
@@ -843,21 +838,11 @@ public class GuiProfileViewer extends GuiScreen {
profileId != null
) {
if (mouseY > guiTop + sizeY + 3 && mouseY < guiTop + sizeY + 23) {
- try {
- Desktop desk = Desktop.getDesktop();
- desk.browse(
- new URI(
- "https://sky.shiiyu.moe/stats/" + profile.getHypixelProfile().get("displayname").getAsString() + "/" +
- profileId
- )
- );
- Utils.playPressSound();
- return;
- } catch (UnsupportedOperationException | IOException | URISyntaxException ignored) {
- //no idea how this sounds, but ya know just in case
- Utils.playSound(new ResourceLocation("game.player.hurt"), true);
- return;
- }
+ String url = "https://sky.shiiyu.moe/stats/" + profile.getHypixelProfile().get("displayname").getAsString() + "/" +
+ profileId;
+ Utils.openUrl(url);
+ Utils.playPressSound();
+ return;
}
}
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 5337a99c..63c2435a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
@@ -36,7 +36,6 @@ import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumChatFormatting;
-import org.luaj.vm2.ast.Str;
import javax.annotation.Nullable;
import java.io.ByteArrayInputStream;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/Ingredient.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/Ingredient.java
index c973f8c0..38d2447b 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/Ingredient.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/Ingredient.java
@@ -32,7 +32,7 @@ import java.util.Set;
public class Ingredient {
public static final String SKYBLOCK_COIN = "SKYBLOCK_COIN";
- private final int count;
+ private final double count;
private final String internalItemId;
private final NEUManager manager;
private ItemStack itemStack;
@@ -42,7 +42,7 @@ public class Ingredient {
String[] parts = ingredientIdentifier.split(":");
internalItemId = parts[0];
if (parts.length == 2) {
- count = Integer.parseInt(parts[1]);
+ count = Double.parseDouble(parts[1]);
} else if (parts.length == 1) {
count = 1;
} else {
@@ -50,13 +50,13 @@ public class Ingredient {
}
}
- public Ingredient(NEUManager manager, String internalItemId, int count) {
+ public Ingredient(NEUManager manager, String internalItemId, double count) {
this.manager = manager;
this.count = count;
this.internalItemId = internalItemId;
}
- private Ingredient(NEUManager manager, int coinValue) {
+ private Ingredient(NEUManager manager, double coinValue) {
this.manager = manager;
this.internalItemId = SKYBLOCK_COIN;
this.count = coinValue;
@@ -82,7 +82,7 @@ public class Ingredient {
return "SKYBLOCK_COIN".equals(internalItemId);
}
- public int getCount() {
+ public double getCount() {
return count;
}
@@ -97,7 +97,7 @@ public class Ingredient {
}
JsonObject itemInfo = manager.getItemInformation().get(internalItemId);
itemStack = manager.jsonToStack(itemInfo);
- itemStack.stackSize = count;
+ itemStack.stackSize = (int) count;
return itemStack;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java
index e84c1c43..c86ac84f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ApiUtil.java
@@ -162,8 +162,7 @@ public class ApiUtil {
try {
conn = url.openConnection();
if (conn instanceof HttpsURLConnection && ctx != null) {
- HttpsURLConnection sslConn = (HttpsURLConnection) conn;
- sslConn.setSSLSocketFactory(ctx.getSocketFactory());
+ patchHttpsRequest((HttpsURLConnection) conn);
}
if (conn instanceof HttpURLConnection) {
((HttpURLConnection) conn).setRequestMethod(method);
@@ -221,6 +220,10 @@ public class ApiUtil {
}
+ public static void patchHttpsRequest(HttpsURLConnection connection) {
+ connection.setSSLSocketFactory(ctx.getSocketFactory());
+ }
+
public Request request() {
return new Request();
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java
index e7674aa9..0105ba1f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java
@@ -77,6 +77,7 @@ public class Constants {
public static JsonObject WEIGHT;
public static JsonObject RNGSCORE;
public static JsonObject ABIPHONE;
+ public static JsonObject ESSENCESHOPS;
private static final ReentrantLock lock = new ReentrantLock();
@@ -100,6 +101,7 @@ public class Constants {
WEIGHT = Utils.getConstant("weight", gson);
RNGSCORE = Utils.getConstant("rngscore", gson);
ABIPHONE = Utils.getConstant("abiphone", gson);
+ ESSENCESHOPS = Utils.getConstant("essenceshops", gson);
parseEssenceCosts();
} catch (Exception ex) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java
index 2ff9692d..bc44f656 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java
@@ -42,13 +42,12 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
import java.util.function.BiFunction;
public class ItemUtils {
- public static ItemStack getCoinItemStack(long coinAmount) {
+ public static ItemStack getCoinItemStack(double coinAmount) {
String uuid = "2070f6cb-f5db-367a-acd0-64d39a7e5d1b";
String texture =
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTM4MDcxNzIxY2M1YjRjZDQwNmNlNDMxYTEzZjg2MDgzYTg5NzNlMTA2NGQyZjg4OTc4Njk5MzBlZTZlNTIzNyJ9fX0=";
@@ -63,7 +62,7 @@ public class ItemUtils {
"ewogICJ0aW1lc3RhbXAiIDogMTYzNTk1NzQ4ODQxNywKICAicHJvZmlsZUlkIiA6ICJmNThkZWJkNTlmNTA0MjIyOGY2MDIyMjExZDRjMTQwYyIsCiAgInByb2ZpbGVOYW1lIiA6ICJ1bnZlbnRpdmV0YWxlbnQiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2I5NTFmZWQ2YTdiMmNiYzIwMzY5MTZkZWM3YTQ2YzRhNTY0ODE1NjRkMTRmOTQ1YjZlYmMwMzM4Mjc2NmQzYiIsCiAgICAgICJtZXRhZGF0YSIgOiB7CiAgICAgICAgIm1vZGVsIiA6ICJzbGltIgogICAgICB9CiAgICB9CiAgfQp9";
}
ItemStack skull = Utils.createSkull(
- "\u00A7r\u00A76" + NumberFormat.getInstance(Locale.US).format(coinAmount) + " Coins",
+ "§r§6" + NumberFormat.getInstance().format(coinAmount) + " Coins",
uuid,
texture
);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/StarCultCalculator.java b/src/main/java/io/github/moulberry/notenoughupdates/util/StarCultCalculator.java
index 02ec5ad3..4c4fe02d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/StarCultCalculator.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/StarCultCalculator.java
@@ -101,7 +101,7 @@ public class StarCultCalculator {
}
if (active && activeTill != 0) {
- return "Active!";
+ return "Active! (" + Utils.prettyTime(activeTill - System.currentTimeMillis()) + ")";
}
return Utils.prettyTime(cultStart.toEpochMilli() - l);
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 a3f2296c..571a43f9 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
@@ -71,10 +71,13 @@ import java.awt.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
+import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.math.BigInteger;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.nio.FloatBuffer;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
@@ -2037,4 +2040,28 @@ public class Utils {
System.out.println(message);
}
}
+
+ public static boolean openUrl(String url) {
+ try {
+ Desktop desk = Desktop.getDesktop();
+ desk.browse(new URI(url));
+ return true;
+ } catch (UnsupportedOperationException | IOException | URISyntaxException ignored) {
+ Runtime runtime = Runtime.getRuntime();
+ try {
+ runtime.exec("xdg-open " + url);
+ return true;
+ } catch (IOException e) {
+ Utils.playSound(new ResourceLocation("game.player.hurt"), true);
+ return false;
+ }
+ }
+ }
+
+ public static void sendLeftMouseClick(int windowId, int slot) {
+ Minecraft.getMinecraft().playerController.windowClick(
+ windowId,
+ slot, 0, 0, Minecraft.getMinecraft().thePlayer
+ );
+ }
}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/KatRecipe.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/KatRecipe.kt
index c4b64969..e6dc0abc 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/KatRecipe.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/KatRecipe.kt
@@ -161,4 +161,6 @@ data class KatRecipe(
override fun getBackground(): ResourceLocation {
return ResourceLocation("notenoughupdates:textures/gui/katting_tall.png")
}
+
+ override fun shouldUseForCraftCost() = false
}
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt
index e7d29642..200aa3fa 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt
@@ -91,21 +91,29 @@ object PetLeveling {
}
}
+ val stubExpLadder by lazy {
+ Utils.showOutdatedRepoNotification()
+ ExpLadder(listOf(1, 1))
+ }
+
internal fun getPetLevelingForPet0(petIdWithoutRarity: String, rarity: Rarity): ExpLadder {
- val petConstants = this.petConstants ?: Constants.PETS
- var levels = petConstants["pet_levels"].asJsonArray.map { it.asLong }.toMutableList()
- val customLeveling = petConstants["custom_pet_leveling"].asJsonObject[petIdWithoutRarity]
- val offset = petConstants["pet_rarity_offset"].asJsonObject[rarity.name].asInt
+ val petConstants = this.petConstants ?: Constants.PETS ?: return stubExpLadder
+ var levels = petConstants["pet_levels"]?.asJsonArray?.map { it.asLong }?.toMutableList() ?: return stubExpLadder
+ val customLeveling = petConstants["custom_pet_leveling"]?.asJsonObject?.get(petIdWithoutRarity)
+ var rarityOffsets = petConstants["pet_rarity_offset"]?.asJsonObject
var maxLevel = 100
if (customLeveling is JsonObject) {
- val customLevels by lazy { customLeveling["pet_levels"].asJsonArray.map { it.asLong } }
+ val customLevels by lazy { customLeveling["pet_levels"]?.asJsonArray?.map { it.asLong } }
when (customLeveling["type"]?.asInt ?: 0) {
- 1 -> levels.addAll(customLevels)
- 2 -> levels = customLevels.toMutableList()
+ 1 -> levels.addAll(customLevels ?: return stubExpLadder)
+ 2 -> levels = customLevels?.toMutableList() ?: return stubExpLadder
}
maxLevel = customLeveling["max_level"]?.asInt ?: maxLevel
+ rarityOffsets = customLeveling["rarity_offset"]?.asJsonObject ?: rarityOffsets
}
- return ExpLadder(levels.drop(offset).take(maxLevel))
+ val offset = rarityOffsets?.get(rarity.name)?.asInt ?: return stubExpLadder
+
+ return ExpLadder(levels.drop(offset).take(maxLevel - 1))
}
}
diff --git a/src/main/resources/assets/notenoughupdates/pv_crimson_isle_page.png b/src/main/resources/assets/notenoughupdates/pv_crimson_isle_page.png
index b08c0057..7ea7af0e 100644
--- a/src/main/resources/assets/notenoughupdates/pv_crimson_isle_page.png
+++ b/src/main/resources/assets/notenoughupdates/pv_crimson_isle_page.png
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/search_mode_button.png b/src/main/resources/assets/notenoughupdates/search_mode_button.png
new file mode 100644
index 00000000..416d26f7
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/search_mode_button.png
Binary files differ
diff --git a/src/main/resources/mixins.notenoughupdates.json b/src/main/resources/mixins.notenoughupdates.json
index 028a9e65..d080d7f5 100644
--- a/src/main/resources/mixins.notenoughupdates.json
+++ b/src/main/resources/mixins.notenoughupdates.json
@@ -54,6 +54,8 @@
"AccessorMinecraft",
"MixinEntityChargedCreeper",
"MixinGuiEditSign",
- "MixinGuiTextField"
+ "MixinGuiTextField",
+ "MixinThreadDownloadImageData",
+ "MixinThreadDownloadImageDataThread"
]
}
diff --git a/src/main/resources/neukeystore.jks b/src/main/resources/neukeystore.jks
index 3a5a23b6..b71185af 100644
--- a/src/main/resources/neukeystore.jks
+++ b/src/main/resources/neukeystore.jks
Binary files differ
diff --git a/src/main/resources/neukeystore.txt b/src/main/resources/neukeystore.txt
index 5616f69b..a64accd0 100644
--- a/src/main/resources/neukeystore.txt
+++ b/src/main/resources/neukeystore.txt
@@ -13,5 +13,7 @@ Please keep a list of added aliases below:
- ISRGROOTX1 (Let's Encrypt)
- ISRGROOTX2 (Let's Encrypt)
+ - MSRSAROOT (Microsoft Root CA 2017)
+ - DIGIROOTG2 (DigiCert Global Root G2)