diff options
author | Linnea Gräf <nea@nea.moe> | 2024-09-01 22:21:19 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-09-01 22:21:19 +0200 |
commit | 5ed74f2df49c93ed1617520a935078b59ad7e195 (patch) | |
tree | f0d52699fff7f820bd724902878988859bd43516 /src/main/kotlin/features/debug | |
parent | 816f80f862d2f5de6bc9b0ae84cd6df0da341228 (diff) | |
download | Firmament-5ed74f2df49c93ed1617520a935078b59ad7e195.tar.gz Firmament-5ed74f2df49c93ed1617520a935078b59ad7e195.tar.bz2 Firmament-5ed74f2df49c93ed1617520a935078b59ad7e195.zip |
Add per compat project event listeners
[no changelog]
Diffstat (limited to 'src/main/kotlin/features/debug')
-rw-r--r-- | src/main/kotlin/features/debug/DebugView.kt | 11 | ||||
-rw-r--r-- | src/main/kotlin/features/debug/PowerUserTools.kt | 18 |
2 files changed, 11 insertions, 18 deletions
diff --git a/src/main/kotlin/features/debug/DebugView.kt b/src/main/kotlin/features/debug/DebugView.kt index 7e1b8ec..ee54260 100644 --- a/src/main/kotlin/features/debug/DebugView.kt +++ b/src/main/kotlin/features/debug/DebugView.kt @@ -3,6 +3,7 @@ package moe.nea.firmament.features.debug import moe.nea.firmament.Firmament +import moe.nea.firmament.annotations.Subscribe import moe.nea.firmament.events.TickEvent import moe.nea.firmament.features.FirmamentFeature import moe.nea.firmament.util.TimeMark @@ -25,14 +26,4 @@ object DebugView : FirmamentFeature { } } - fun recalculateDebugWidget() { - } - - override fun onLoad() { - TickEvent.subscribe { - synchronized(this) { - recalculateDebugWidget() - } - } - } } diff --git a/src/main/kotlin/features/debug/PowerUserTools.kt b/src/main/kotlin/features/debug/PowerUserTools.kt index 7893eff..dccf8f7 100644 --- a/src/main/kotlin/features/debug/PowerUserTools.kt +++ b/src/main/kotlin/features/debug/PowerUserTools.kt @@ -4,6 +4,7 @@ package moe.nea.firmament.features.debug import net.minecraft.block.SkullBlock import net.minecraft.block.entity.SkullBlockEntity +import net.minecraft.client.gui.screen.Screen import net.minecraft.component.DataComponentTypes import net.minecraft.entity.Entity import net.minecraft.entity.LivingEntity @@ -54,15 +55,16 @@ object PowerUserTools : FirmamentFeature { } var lastCopiedStackViewTime = false - override fun onLoad() { - TickEvent.subscribe { - if (!lastCopiedStackViewTime) - lastCopiedStack = null - lastCopiedStackViewTime = false - } - ScreenChangeEvent.subscribe { + @Subscribe + fun resetLastCopiedStack(event: TickEvent) { + if (!lastCopiedStackViewTime) lastCopiedStack = null - } + lastCopiedStackViewTime = false + } + + @Subscribe + fun resetLastCopiedStackOnScreenChange(event: ScreenChangeEvent) { + lastCopiedStack = null } fun debugFormat(itemStack: ItemStack): Text { |