aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/event/ChocolateFactoryConfig.java10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/clicks/FactoryItemTooltipFeatures.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/clicks/CompactFactoryClick.kt)33
3 files changed, 44 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 885bffe30..a92e2fb1b 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -133,7 +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.chocolatefactory.clicks.FactoryItemTooltipFeatures
import at.hannibal2.skyhanni.features.event.diana.AllBurrowsList
import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper
import at.hannibal2.skyhanni.features.event.diana.DianaProfitTracker
@@ -626,7 +626,7 @@ class SkyHanniMod {
loadModule(ChocolateFactoryBarnManager)
loadModule(ChocolateFactoryInventory)
loadModule(ChocolateFactoryStats)
- loadModule(CompactFactoryClick)
+ loadModule(FactoryItemTooltipFeatures)
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 99d4b5862..2a0d47892 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
@@ -108,4 +108,14 @@ public class ChocolateFactoryConfig {
@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;
+
+ @Expose
+ @ConfigOption(name = "Tooltip Move", desc = "Move Tooltip away from the item you hover over while inside the Chocolate Factory.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean tooltipMove = false;
+
+ @Expose
+ @ConfigLink(owner = ChocolateFactoryConfig.class, field = "tooltipMove")
+ public Position tooltipMovePosition = new Position(-380, 150, false, true);
}
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/FactoryItemTooltipFeatures.kt
index 64f30de04..a7d2a3c79 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/clicks/CompactFactoryClick.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/chocolatefactory/clicks/FactoryItemTooltipFeatures.kt
@@ -1,24 +1,55 @@
package at.hannibal2.skyhanni.features.event.chocolatefactory.clicks
import at.hannibal2.skyhanni.events.GuiContainerEvent
+import at.hannibal2.skyhanni.events.GuiRenderEvent
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.RenderUtils.renderStrings
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.milliseconds
import kotlin.time.Duration.Companion.seconds
-object CompactFactoryClick {
+object FactoryItemTooltipFeatures {
private val config get() = ChocolateFactoryAPI.config
private var lastClick = SimpleTimeMark.farPast()
+ private var lastHover = SimpleTimeMark.farPast()
+ private var tooltipToHover = listOf<String>()
@SubscribeEvent
fun onTooltip(event: LorenzToolTipEvent) {
if (!ChocolateFactoryAPI.inChocolateFactory) return
+
+ if (config.tooltipMove) {
+ if (event.slot.slotNumber <= 44) {
+ lastHover = SimpleTimeMark.now()
+ tooltipToHover = event.toolTip.toList()
+ event.cancel()
+ } else {
+ lastHover = SimpleTimeMark.farPast()
+ }
+ return
+ }
+
+ onCompactClick(event)
+ }
+
+ @SubscribeEvent
+ fun onBackgroundDraw(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) {
+ if (!ChocolateFactoryAPI.inChocolateFactory) return
+ if (config.tooltipMove) {
+ if (lastHover.passedSince() < 300.milliseconds) {
+ config.tooltipMovePosition.renderStrings(tooltipToHover, posLabel = "Tooltip Move")
+ }
+ }
+ }
+
+ private fun onCompactClick(event: LorenzToolTipEvent) {
if (!config.compactOnClick) return
val itemStack = event.itemStack