diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-04-28 16:08:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-28 16:08:14 +0200 |
commit | ae9482ca94504e809c8effa02530fa4697845542 (patch) | |
tree | a2d7c782a1ca9f6016313d545e9964576d673dc3 /src/main/java/at/hannibal2/skyhanni/features/event | |
parent | 48f4e9818c5d8a5445b02384f49bbe5c82f8d16e (diff) | |
download | skyhanni-ae9482ca94504e809c8effa02530fa4697845542.tar.gz skyhanni-ae9482ca94504e809c8effa02530fa4697845542.tar.bz2 skyhanni-ae9482ca94504e809c8effa02530fa4697845542.zip |
Feature: Added Tooltip Move (#1581)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/event')
-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 |
1 files changed, 32 insertions, 1 deletions
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 |