aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-05-10 10:25:03 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-05-10 10:25:03 +0200
commitbf860a73e1206a132f446f23915f0ca0e3bbf615 (patch)
treeb80848d14d9b1e3dbfeaa888515ba47d25062673 /src/main/java/at/hannibal2
parentb7b4c4bde154e6177d03367024a6537133841309 (diff)
downloadskyhanni-bf860a73e1206a132f446f23915f0ca0e3bbf615.tar.gz
skyhanni-bf860a73e1206a132f446f23915f0ca0e3bbf615.tar.bz2
skyhanni-bf860a73e1206a132f446f23915f0ca0e3bbf615.zip
Npc prices will be loaded not during startup but once minecraft is fully loaded, to fix a bug with unloaded neu data
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt
index ef8a812e0..85267240e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarApi.kt
@@ -9,8 +9,10 @@ import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
class BazaarApi {
+ private var loadedNpcPriceData = false
companion object {
val holder = BazaarDataHolder()
@@ -37,6 +39,17 @@ class BazaarApi {
inBazaarInventory = checkIfInBazaar(event)
}
+
+ @SubscribeEvent
+ fun onTick(event: TickEvent.ClientTickEvent) {
+ if (event.phase != TickEvent.Phase.START) return
+
+ if (!loadedNpcPriceData) {
+ loadedNpcPriceData = true
+ holder.start()
+ }
+ }
+
private fun checkIfInBazaar(event: InventoryOpenEvent): Boolean {
val returnItem = event.inventorySize - 5
for ((slot, item) in event.inventoryItems) {
@@ -68,8 +81,4 @@ class BazaarApi {
fun onInventoryClose(event: InventoryCloseEvent) {
inBazaarInventory = false
}
-
- init {
- holder.start()
- }
} \ No newline at end of file