diff options
author | Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> | 2023-12-02 13:59:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-02 13:59:45 +0100 |
commit | 0de297133be4233e61beab835e98c98584371fe7 (patch) | |
tree | 3efa51c5f76f8c9c83f7c6c0bca0d208a6ab8f47 /src/main/java/at | |
parent | 3d4e33d56f3592671899c6e2943580d3780596d2 (diff) | |
download | skyhanni-0de297133be4233e61beab835e98c98584371fe7.tar.gz skyhanni-0de297133be4233e61beab835e98c98584371fe7.tar.bz2 skyhanni-0de297133be4233e61beab835e98c98584371fe7.zip |
Fix: MinionXp close Event (#748)
Fixed Minion XP display now showing sometimes. #748
Diffstat (limited to 'src/main/java/at')
3 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/events/MinionOpenEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/MinionOpenEvent.kt index 4cbb112de..c6233371f 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/MinionOpenEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/MinionOpenEvent.kt @@ -4,4 +4,5 @@ import at.hannibal2.skyhanni.utils.LorenzVec import net.minecraft.item.ItemStack class MinionOpenEvent(val inventoryName: String, val inventoryItems: Map<Int, ItemStack>) : LorenzEvent() +class MinionCloseEvent() : LorenzEvent() class MinionStorageOpenEvent(val position: LorenzVec?, val inventoryItems: Map<Int, ItemStack>) : LorenzEvent() diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index 77ce80990..98d9c107e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.events.MinionCloseEvent import at.hannibal2.skyhanni.events.MinionOpenEvent import at.hannibal2.skyhanni.events.MinionStorageOpenEvent import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled @@ -180,6 +181,7 @@ class MinionFeatures { if (location !in minions) { minions[location]!!.lastClicked = 0 } + MinionCloseEvent().postAndCatch() } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt index 110413323..787cbe059 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionXp.kt @@ -2,8 +2,8 @@ package at.hannibal2.skyhanni.features.minion import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.jsonobjects.repo.MinionXPJson -import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.IslandChangeEvent +import at.hannibal2.skyhanni.events.MinionCloseEvent import at.hannibal2.skyhanni.events.MinionOpenEvent import at.hannibal2.skyhanni.events.MinionStorageOpenEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent @@ -83,7 +83,7 @@ class MinionXp { private fun getStorageXpAndUpdateTotal( minionPosition: LorenzVec, - xpTotal: EnumMap<XpType, Double> + xpTotal: EnumMap<XpType, Double>, ): Boolean { if (!getHasStorage(minionPosition)) return false val storage = minionStorages.firstOrNull { @@ -110,7 +110,7 @@ class MinionXp { val name = item.name val xp = xpInfoMap[name] ?: return@forEach - //TODO add wisdom and Derpy to calculation and random extra Exp Events + // TODO add wisdom and Derpy to calculation and random extra Exp Events val xpAmount = xp.amount * item.stackSize xpItemMap[item] = collectMessage(xp.type, xpAmount) @@ -181,7 +181,7 @@ class MinionXp { } @SubscribeEvent - fun onInventoryClose(event: InventoryCloseEvent) { + fun onMinionClose(event: MinionCloseEvent) { xpItemMap.clear() collectItemXpList.clear() } |