aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java200
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/BazaarTweaks.java8
3 files changed, 0 insertions, 210 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index b06f2ab2..efd45b3c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -36,7 +36,6 @@ import io.github.moulberry.notenoughupdates.listener.NEUEventListener;
import io.github.moulberry.notenoughupdates.listener.OldAnimationChecker;
import io.github.moulberry.notenoughupdates.listener.RenderListener;
import io.github.moulberry.notenoughupdates.miscfeatures.AuctionProfit;
-import io.github.moulberry.notenoughupdates.miscfeatures.BazaarSacksProfit;
import io.github.moulberry.notenoughupdates.miscfeatures.CrystalOverlay;
import io.github.moulberry.notenoughupdates.miscfeatures.CrystalWishingCompassSolver;
import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects;
@@ -298,7 +297,6 @@ public class NotEnoughUpdates {
MinecraftForge.EVENT_BUS.register(new SignCalculator());
MinecraftForge.EVENT_BUS.register(TrophyRewardOverlay.getInstance());
MinecraftForge.EVENT_BUS.register(PowerStoneStatsDisplay.getInstance());
- MinecraftForge.EVENT_BUS.register(BazaarSacksProfit.getInstance());
MinecraftForge.EVENT_BUS.register(navigation);
if (Minecraft.getMinecraft().getResourceManager() instanceof IReloadableResourceManager) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java
deleted file mode 100644
index 9ab85390..00000000
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BazaarSacksProfit.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * 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 com.google.gson.JsonObject;
-import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
-import io.github.moulberry.notenoughupdates.core.util.StringUtils;
-import io.github.moulberry.notenoughupdates.miscgui.TrophyRewardOverlay;
-import io.github.moulberry.notenoughupdates.util.ItemUtils;
-import net.minecraft.client.Minecraft;
-import net.minecraft.inventory.Container;
-import net.minecraft.inventory.ContainerChest;
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.client.event.GuiOpenEvent;
-import net.minecraftforge.event.entity.player.ItemTooltipEvent;
-import net.minecraftforge.fml.common.eventhandler.EventPriority;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import org.lwjgl.input.Keyboard;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-public class BazaarSacksProfit {
-
- private static BazaarSacksProfit INSTANCE = null;
- private boolean showSellOrderPrice = false;
- private boolean pressedShiftLast = false;
-
- public static BazaarSacksProfit getInstance() {
- if (INSTANCE == null) {
- INSTANCE = new BazaarSacksProfit();
- }
- return INSTANCE;
- }
-
- private final Map<String, Integer> prices = new HashMap<>();
- private final Map<String, String> names = new HashMap<>();
- private final List<String> invalidNames = new ArrayList<>();
- private boolean dirty = true;
-
- @SubscribeEvent
- public void onGuiOpen(GuiOpenEvent event) {
- showSellOrderPrice = false;
- dirty = true;
- }
-
- @SubscribeEvent(priority = EventPriority.LOW)
- public void onItemTooltipLow(ItemTooltipEvent event) {
- if (!NotEnoughUpdates.INSTANCE.config.bazaarTweaks.bazaarSacksProfit) return;
- if (!inBazaar()) return;
-
- ItemStack itemStack = event.itemStack;
- String displayName = itemStack.getDisplayName();
- if (!displayName.equals("§bSell Sacks Now")) return;
-
- boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
- if (!pressedShiftLast && shift) {
- showSellOrderPrice = !showSellOrderPrice;
- }
- pressedShiftLast = shift;
-
- if (dirty) {
- dirty = false;
- prices.clear();
- names.clear();
- invalidNames.clear();
-
- out:
- for (String line : ItemUtils.getLore(itemStack)) {
-
- if (line.equals("§8Loading...")) {
- dirty = true;
- return;
- }
- if (line.contains("§7x ")) {
- String[] split = line.split("§7x ");
- String rawAmount = StringUtils.cleanColour(split[0]).replace(",", "").substring(1);
- int amount = Integer.parseInt(rawAmount);
- String bazaarName = split[1].split(" §7for")[0];
- for (Map.Entry<String, JsonObject> entry : NotEnoughUpdates.INSTANCE.manager
- .getItemInformation()
- .entrySet()) {
- String internalName = entry.getKey();
-
- // Ignoring builder melon, builder clay and builder cactus
- if (NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalName) == null) continue;
-
- JsonObject object = entry.getValue();
- if (object.has("displayname")) {
- String name = object.get("displayname").getAsString();
- if (name.equals(bazaarName)) {
- prices.put(internalName, amount);
- names.put(internalName, bazaarName);
- continue out;
- }
- }
- }
- System.err.println("no bazaar item in repo found for '" + bazaarName + "'");
- invalidNames.add(bazaarName);
- }
- }
- }
-
- event.toolTip.removeIf(line -> line.contains("§7x ") || line.contains("You earn:"));
-
- Map<String, Float> map = new HashMap<>();
- DecimalFormat formatter = (DecimalFormat) NumberFormat.getNumberInstance(Locale.ENGLISH);
- formatter.applyPattern("#,##0");
- double totalPrice = 0;
- for (Map.Entry<String, Integer> entry : prices.entrySet()) {
- String internalName = entry.getKey();
- int amount = entry.getValue();
- String name = names.get(internalName);
-
- JsonObject bazaarInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalName);
-
- float price = 0;
- if (bazaarInfo != null) {
-
- if (showSellOrderPrice) {
- if (bazaarInfo.has("curr_buy")) {
- price = bazaarInfo.get("curr_buy").getAsFloat();
- } else {
- System.err.println("curr_sell does not exist for '" + internalName + "'");
- }
- } else {
- if (bazaarInfo.has("curr_sell")) {
- price = bazaarInfo.get("curr_sell").getAsFloat();
- } else {
- System.err.println("curr_sell does not exist for '" + internalName + "'");
- }
- }
- }
- float extraPrice = price * amount;
- String priceFormat = formatter.format(extraPrice);
- totalPrice += extraPrice;
- map.put("§a" + formatter.format(amount) + "§7x §f" + name + " §7for §6" + priceFormat + " coins", extraPrice);
- }
-
- event.toolTip.add(4, "");
- if (showSellOrderPrice) {
- event.toolTip.add(4, "§7Sell order price: §6" + formatter.format(totalPrice));
- } else {
- event.toolTip.add(4, "§7Instant sell price: §6" + formatter.format(totalPrice));
- }
-
- event.toolTip.add(4, "");
- event.toolTip.removeIf(line -> line.equals("§5§o"));
- int index = 4;
- for (String name : invalidNames) {
- index++;
- event.toolTip.add(4, name + " §c[NEU] Missing Repo data!");
- }
- for (String text : TrophyRewardOverlay.sortByValue(map).keySet()) {
- index++;
- event.toolTip.add(4, text);
- }
- event.toolTip.add(index, "");
-
- if (!showSellOrderPrice) {
- event.toolTip.add("§8[Press SHIFT to show sell order price]");
- } else {
- event.toolTip.add("§8[Press SHIFT to show instant sell price]");
- }
- }
-
- public static boolean inBazaar() {
- if (!NotEnoughUpdates.INSTANCE.isOnSkyblock()) return false;
-
- Minecraft minecraft = Minecraft.getMinecraft();
- if (minecraft == null || minecraft.thePlayer == null) return false;
-
- Container inventoryContainer = minecraft.thePlayer.openContainer;
- if (!(inventoryContainer instanceof ContainerChest)) return false;
- ContainerChest containerChest = (ContainerChest) inventoryContainer;
- return containerChest.getLowerChestInventory().getDisplayName().getUnformattedText().startsWith("Bazaar ");
- }
-}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/BazaarTweaks.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/BazaarTweaks.java
index 2ba0b718..954af02d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/BazaarTweaks.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/BazaarTweaks.java
@@ -70,12 +70,4 @@ public class BazaarTweaks {
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
public boolean escFullClose = true;
-
- @Expose
- @ConfigOption(
- name = "Bazaar Sacks Profit",
- desc = "Orders the items in your sacks in the bazaar inventory and adding buy order toggle"
- )
- @ConfigEditorBoolean
- public boolean bazaarSacksProfit = true;
}