aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHiZe_ <superhize@hotmail.com>2023-08-09 01:04:03 +0200
committerGitHub <noreply@github.com>2023-08-09 01:04:03 +0200
commitbfadaa0971d8caf7daca7d0d72d7b7c5c7478cf6 (patch)
tree1e3e3b548a0e3f43f30abcbc2574469f9b1f05e8 /src
parentb7d05be41fe49081adcff5202a005f5282b4e86e (diff)
downloadskyhanni-bfadaa0971d8caf7daca7d0d72d7b7c5c7478cf6.tar.gz
skyhanni-bfadaa0971d8caf7daca7d0d72d7b7c5c7478cf6.tar.bz2
skyhanni-bfadaa0971d8caf7daca7d0d72d7b7c5c7478cf6.zip
Merge pull request #371
Fixed bestiary display not working sometimes.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt
index 30505ca83..11bd7f373 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/BestiaryData.kt
@@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.InventoryCloseEvent
-import at.hannibal2.skyhanni.events.InventoryOpenEvent
+import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.utils.*
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
@@ -58,30 +58,30 @@ object BestiaryData {
fun onRender(event: GuiContainerEvent.BackgroundDrawnEvent) {
if (!isEnabled()) return
if (inInventory) {
- val inventoryName = InventoryUtils.openInventoryName()
- if (isBestiaryGui(InventoryUtils.getItemsInOpenChest()[4].stack, inventoryName)) {
- for (slot in InventoryUtils.getItemsInOpenChest()) {
- val stack = slot.stack
- val lore = stack.getLore()
- if (lore.any { it == "§7Overall Progress: §b100% §7(§c§lMAX!§7)" || it == "§7Families Completed: §a100§6% §7(§c§lMAX!§7)" }) {
- slot highlight LorenzColor.GREEN
- }
+ for (slot in InventoryUtils.getItemsInOpenChest()) {
+ val stack = slot.stack
+ val lore = stack.getLore()
+ if (lore.any { it == "§7Overall Progress: §b100% §7(§c§lMAX!§7)" || it == "§7Families Completed: §a100§6% §7(§c§lMAX!§7)" }) {
+ slot highlight LorenzColor.GREEN
}
}
+
}
}
@SubscribeEvent
- fun onInventoryOpen(event: InventoryOpenEvent) {
+ fun onInventoryOpen(event: InventoryFullyOpenedEvent) {
if (!isEnabled()) return
val inventoryName = event.inventoryName
+ val stack = event.inventoryItems[4] ?: return
if ((inventoryName == "Bestiary ➜ Fishing" || inventoryName == "Bestiary") || isBestiaryGui(
- event.inventoryItems[4],
+ stack,
inventoryName
)
) {
isCategory = inventoryName == "Bestiary ➜ Fishing" || inventoryName == "Bestiary"
stackList.putAll(event.inventoryItems)
+ inInventory = true
update()
}
}
@@ -478,7 +478,7 @@ object BestiaryData {
})
}
- fun String.romanOrInt() = romanToDecimalIfNeeded().let {
+ private fun String.romanOrInt() = romanToDecimalIfNeeded().let {
if (config.replaceRoman || it == 0) it.toString() else it.toRoman()
}