diff options
Diffstat (limited to 'src/main/java')
4 files changed, 50 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index cb276b7ce..46fcd2e54 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -275,6 +275,7 @@ public class SkyHanniMod { loadModule(new ComposterOverlay()); loadModule(new GardenCropMilestoneFix()); loadModule(new GardenBurrowingSporesNotifier()); + loadModule(new WildStrawberryDyeNotification()); Commands.INSTANCE.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java index aab2c8f73..3f89d4def 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java @@ -976,13 +976,17 @@ public class Garden { @ConfigEditorBoolean public boolean fungiCutterWarn = true; - @Expose @ConfigOption(name = "Burrowing Spores", desc = "Show a notification when a Burrowing Spores spawns during farming mushrooms.") @ConfigEditorBoolean public boolean burrowingSporesNotification = true; @Expose + @ConfigOption(name = "Wild Strawberry", desc = "Show a notification when a Wild Strawberry Dye drops during farming.") + @ConfigEditorBoolean + public boolean wildStrawberryDyeNotification = true; + + @Expose @ConfigOption(name = "Always Finnegan", desc = "Forcefully set the Finnegan Farming Simulator perk to be active. This is useful if the auto mayor detection fails.") @ConfigEditorBoolean public boolean forcefullyEnabledAlwaysFinnegan = false; diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt new file mode 100644 index 000000000..cc86819a6 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WildStrawberryDyeNotification.kt @@ -0,0 +1,43 @@ +package at.hannibal2.skyhanni.features.garden.farming + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.TitleUtils +import at.hannibal2.skyhanni.events.GuiContainerEvent +import at.hannibal2.skyhanni.events.OwnInventorItemUpdateEvent +import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.SoundUtils +import io.github.moulberry.notenoughupdates.util.MinecraftExecutor +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class WildStrawberryDyeNotification { + var lastCloseTime = 0L + + @SubscribeEvent + fun onCloseWindow(event: GuiContainerEvent.CloseWindowEvent) { + lastCloseTime = System.currentTimeMillis() + } + + @SubscribeEvent + fun onOwnInventoryItemUpdate(event: OwnInventorItemUpdateEvent) { + if (!GardenAPI.inGarden()) return + if (!SkyHanniMod.feature.garden.wildStrawberryDyeNotification) return + + MinecraftExecutor.OnThread.execute { + + // Prevent false positives when buying the item in ah or moving it from a storage + val diff = System.currentTimeMillis() - lastCloseTime + if (diff < 1_000) return@execute + + val internalName = event.itemStack.getInternalName() + if (internalName == "DYE_WILD_STRAWBERRY") { + val name = event.itemStack.name!! + TitleUtils.sendTitle(name, 5_000) + LorenzUtils.chat("§e[SkyHanni] You found a $name§e!") + SoundUtils.playBeepSound() + } + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt index a6d06366a..1c47b65c5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt @@ -62,6 +62,7 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { } } + // TODO use OwnInventorItemUpdateEvent private fun checkInventoryForTrophyFish() { val fishQuest = getQuest<TrophyFishQuest>() ?: return if (fishQuest.state != QuestState.ACCEPTED && fishQuest.state != QuestState.READY_TO_COLLECT) return |