diff options
author | Vixid <52578495+VixidDev@users.noreply.github.com> | 2023-11-15 10:13:27 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-15 11:13:27 +0100 |
commit | d10a09fa651aa9da8b842a21f0b25fc27594c1b2 (patch) | |
tree | 45539668c01f8623362ff491cc6aac3e6f086d8f /src/main/java/at/hannibal2/skyhanni | |
parent | aa9fe2a83cf65fcd28026db8f0bc9ed1723d49d5 (diff) | |
download | skyhanni-d10a09fa651aa9da8b842a21f0b25fc27594c1b2.tar.gz skyhanni-d10a09fa651aa9da8b842a21f0b25fc27594c1b2.tar.bz2 skyhanni-d10a09fa651aa9da8b842a21f0b25fc27594c1b2.zip |
Add delay before toggling borders (#708)
Added short delay for toggling borders, fixed flickering bugs. #708
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotBorders.kt | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotBorders.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotBorders.kt index c7d27d873..e3f0c1386 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotBorders.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenPlotBorders.kt @@ -6,15 +6,18 @@ import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.RenderUtils.draw3DLine +import at.hannibal2.skyhanni.utils.SimpleTimeMark import net.minecraft.client.Minecraft import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.lwjgl.input.Keyboard import java.awt.Color import kotlin.math.floor +import kotlin.time.Duration.Companion.milliseconds class GardenPlotBorders { private val config get() = SkyHanniMod.feature.garden.plotBorders + private var timeLastSaved = SimpleTimeMark.farPast() private var showBorders = false private val LINE_COLOR = LorenzColor.YELLOW.toColor() @@ -25,12 +28,16 @@ class GardenPlotBorders { @SubscribeEvent fun onKeyClick(event: LorenzKeyPressEvent) { if (!isEnabled()) return + if (timeLastSaved.passedSince() < 250.milliseconds) return + if (event.keyCode == Keyboard.KEY_G && Keyboard.isKeyDown(Keyboard.KEY_F3)) { showBorders = !showBorders } if (event.keyCode == Keyboard.KEY_F3 && Keyboard.isKeyDown(Keyboard.KEY_G)) { showBorders = !showBorders } + + timeLastSaved = SimpleTimeMark.now() } @SubscribeEvent |