diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
3 files changed, 59 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 33d7cdbe9..885bffe30 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -133,6 +133,7 @@ import at.hannibal2.skyhanni.features.event.chocolatefactory.HoppityCollectionSt import at.hannibal2.skyhanni.features.event.chocolatefactory.HoppityEggLocator import at.hannibal2.skyhanni.features.event.chocolatefactory.HoppityEggsManager import at.hannibal2.skyhanni.features.event.chocolatefactory.HoppityEggsShared +import at.hannibal2.skyhanni.features.event.chocolatefactory.clicks.CompactFactoryClick import at.hannibal2.skyhanni.features.event.diana.AllBurrowsList import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper import at.hannibal2.skyhanni.features.event.diana.DianaProfitTracker @@ -625,6 +626,7 @@ class SkyHanniMod { loadModule(ChocolateFactoryBarnManager) loadModule(ChocolateFactoryInventory) loadModule(ChocolateFactoryStats) + loadModule(CompactFactoryClick) loadModule(HoppityEggsManager) loadModule(HoppityEggLocator) loadModule(HoppityEggsShared) diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/event/ChocolateFactoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/event/ChocolateFactoryConfig.java index 344ee625e..3aef75189 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/event/ChocolateFactoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/event/ChocolateFactoryConfig.java @@ -97,4 +97,15 @@ public class ChocolateFactoryConfig { @Expose @ConfigLink(owner = ChocolateFactoryConfig.class, field = "hoppityCollectionStats") public Position hoppityStatsPosition = new Position(183, 160, false, true); + + @Expose + @ConfigOption(name = "Compact On Click", desc = "Compact the item toolip when clicking on the chocolate.") + @ConfigEditorBoolean + @FeatureToggle + public boolean compactOnClick = true; + + @Expose + @ConfigOption(name = "Always Compact", desc = "Always Compact the item toolip on the chocolate. Requires the above option to be enabled.") + @ConfigEditorBoolean + public boolean compactOnClickAlways = false; } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/clicks/CompactFactoryClick.kt b/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/clicks/CompactFactoryClick.kt new file mode 100644 index 000000000..64f30de04 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/clicks/CompactFactoryClick.kt @@ -0,0 +1,46 @@ +package at.hannibal2.skyhanni.features.event.chocolatefactory.clicks + +import at.hannibal2.skyhanni.events.GuiContainerEvent +import at.hannibal2.skyhanni.events.LorenzToolTipEvent +import at.hannibal2.skyhanni.features.event.chocolatefactory.ChocolateFactoryAPI +import at.hannibal2.skyhanni.utils.CollectionUtils.getOrNull +import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.SimpleTimeMark +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.seconds + +object CompactFactoryClick { + private val config get() = ChocolateFactoryAPI.config + + private var lastClick = SimpleTimeMark.farPast() + + @SubscribeEvent + fun onTooltip(event: LorenzToolTipEvent) { + if (!ChocolateFactoryAPI.inChocolateFactory) return + if (!config.compactOnClick) return + + val itemStack = event.itemStack + val lore = itemStack.getLore() + if (!lore.any { it == "§7§eClick to uncover the meaning of life!" }) return + if (lastClick.passedSince() >= 1.seconds && !config.compactOnClickAlways) return + val list = mutableListOf<String>() + list.add(itemStack.name) + lore.getOrNull(5)?.let { + list.add(it) + } + event.toolTip = list + return + } + + @SubscribeEvent(priority = EventPriority.HIGH) + fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { + + if (ChocolateFactoryAPI.inChocolateFactory) { + if (event.slotId == 13) { + lastClick = SimpleTimeMark.now() + } + } + } +} |