aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorEmpa <42304516+ItsEmpa@users.noreply.github.com>2024-02-24 16:34:05 +0100
committerGitHub <noreply@github.com>2024-02-24 16:34:05 +0100
commitdffba2bb9abeb84e50816b69ea6f878ba9fc3d3f (patch)
tree85425e5cdd7526b42cb1ccb4e8a7e4052dfaef78 /src/main/java
parent80813c4ec241390f465231d6fccb9cf79e6096cb (diff)
downloadskyhanni-dffba2bb9abeb84e50816b69ea6f878ba9fc3d3f.tar.gz
skyhanni-dffba2bb9abeb84e50816b69ea6f878ba9fc3d3f.tar.bz2
skyhanni-dffba2bb9abeb84e50816b69ea6f878ba9fc3d3f.zip
Fixed Book Bundle showing wrong amount of books. #1043
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt2
3 files changed, 14 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java
index 87b5e4e00..ddd814159 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java
+++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/repo/ItemsJson.java
@@ -18,4 +18,7 @@ public class ItemsJson {
@Expose
public List<NEUInternalName> water_fishing_rods;
+
+ @Expose
+ public Map<String, Integer> book_bundle_amount;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
index aef1f392b..5ede5acf7 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
@@ -3,11 +3,13 @@ package at.hannibal2.skyhanni.features.misc.items
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigManager
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
+import at.hannibal2.skyhanni.data.jsonobjects.repo.ItemsJson
import at.hannibal2.skyhanni.events.ConfigLoadEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.LorenzToolTipEvent
import at.hannibal2.skyhanni.events.RenderItemTooltipEvent
+import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle
@@ -25,7 +27,6 @@ import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import com.google.gson.reflect.TypeToken
-import io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer
import net.minecraft.client.Minecraft
import net.minecraft.init.Items
@@ -41,12 +42,13 @@ object EstimatedItemValue {
private val cache = mutableMapOf<ItemStack, List<List<Any>>>()
private var lastToolTipTime = 0L
var gemstoneUnlockCosts = HashMap<NEUInternalName, HashMap<String, List<String>>>()
+ var bookBundleAmount = mapOf<String, Int>()
private var currentlyShowing = false
fun isCurrentlyShowing() = currentlyShowing && Minecraft.getMinecraft().currentScreen != null
@SubscribeEvent
- fun onRepoReload(event: RepositoryReloadEvent) {
+ fun onRepoReload(event: io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent) {
val data = manager.getJsonFromFile(File(manager.repoLocation, "constants/gemstonecosts.json"))
if (data != null)
@@ -61,6 +63,12 @@ object EstimatedItemValue {
}
@SubscribeEvent
+ fun onRepoReload(event: RepositoryReloadEvent) {
+ val data = event.getConstant<ItemsJson>("Items")
+ bookBundleAmount = data.book_bundle_amount ?: error("book_bundle_amount is missing")
+ }
+
+ @SubscribeEvent
fun onTooltip(event: LorenzToolTipEvent) {
if (!LorenzUtils.inSkyBlock) return
if (!config.enabled) return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt
index 8ea9195f8..87e582545 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt
@@ -576,7 +576,7 @@ object EstimatedItemValueCalculator {
level = 1
}
if (internalName.startsWith("ENCHANTED_BOOK_BUNDLE_")) {
- multiplier = 5
+ multiplier = EstimatedItemValue.bookBundleAmount.getOrDefault(rawName, 5)
}
if (rawName in tieredEnchants) level = 1