From 4abd0d1fa483a67972aced65dc322ad5b510aee5 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 19 Nov 2023 22:30:23 +0100 Subject: Fixed farming weight no longer updating on block breaking. --- src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt | 11 ++++++++++- .../skyhanni/features/garden/farming/FarmingWeightDisplay.kt | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt index d6bd2d892..4c6058b26 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/OwnInventoryData.kt @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.data import at.hannibal2.skyhanni.events.InventoryCloseEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent +import at.hannibal2.skyhanni.events.OwnInventoryItemUpdateEvent import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.entity.ItemAddInInventoryEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi @@ -30,9 +31,17 @@ class OwnInventoryData { fun onChatPacket(event: PacketEvent.ReceiveEvent) { if (!LorenzUtils.inSkyBlock) return - if (event.packet.let { it is S2FPacketSetSlot || it is S0DPacketCollectItem }) { + val packet = event.packet + if (packet is S2FPacketSetSlot || packet is S0DPacketCollectItem) { dirty = true } + if (packet is S2FPacketSetSlot) { + val windowId = packet.func_149175_c() + if (windowId == 0) { + val item = packet.func_149174_e() ?: return + OwnInventoryItemUpdateEvent(item).postAndCatch() + } + } } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index f32da7867..f776a9c86 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -387,8 +387,8 @@ class FarmingWeightDisplay { private fun chatOffScreenChange(direction: String, oldPosition: Int) { farmingChatMessage( "§7Since your last visit to the §aGarden§7, " + - "you have $direction §7on the §dFarming Leaderboard§7. " + - "§7(§e#${oldPosition.addSeparators()} §7-> §e#${leaderboardPosition.addSeparators()}§7)" + "you have $direction §7on the §dFarming Leaderboard§7. " + + "§7(§e#${oldPosition.addSeparators()} §7-> §e#${leaderboardPosition.addSeparators()}§7)" ) } -- cgit