File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed
src/main/kotlin/io/github/frostzie/skyfall Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,11 @@ class GardenConfig {
2929 var onGarden = true
3030 }
3131
32+ @Expose
33+ @ConfigOption(name = " Spawn Keybind" , desc = " Keybind to teleport to the garden spawn" )
34+ @ConfigEditorKeybind(defaultKey = GLFW .GLFW_KEY_UNKNOWN )
35+ var warpToSpawn = GLFW .GLFW_KEY_UNKNOWN
36+
3237 @Expose
3338 @Accordion
3439 @ConfigOption(name = " Garden Map" , desc = " " )
Original file line number Diff line number Diff line change 1+ package io.github.frostzie.skyfall.features.garden
2+
3+ import io.github.frostzie.skyfall.SkyFall
4+ import io.github.frostzie.skyfall.features.Feature
5+ import io.github.frostzie.skyfall.features.IFeature
6+ import io.github.frostzie.skyfall.utils.KeyboardManager.isKeyClicked
7+ import io.github.frostzie.skyfall.utils.SimpleTimeMark
8+ import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
9+ import org.lwjgl.glfw.GLFW
10+ import kotlin.time.Duration.Companion.milliseconds
11+
12+ @Feature(name = " Warp to Garden Spawn" )
13+ object warpToSpawn : IFeature {
14+ override var isRunning = false
15+ private var lastCommandTime = SimpleTimeMark .farPast()
16+ private val requeueKey get() = SkyFall .feature.garden.warpToSpawn
17+
18+ override fun shouldLoad (): Boolean {
19+ return requeueKey != GLFW .GLFW_KEY_UNKNOWN
20+ }
21+
22+ init {
23+ ClientTickEvents .END_CLIENT_TICK .register { client ->
24+ if (client.currentScreen == null ) {
25+ if (requeueKey != GLFW .GLFW_KEY_UNKNOWN ) {
26+ if (requeueKey.isKeyClicked() && lastCommandTime.passedSince() >= 350 .milliseconds) {
27+ val player = client.player
28+ if (player != null ) {
29+ player.networkHandler.sendChatCommand(" warp garden" )
30+ lastCommandTime = SimpleTimeMark .now()
31+ }
32+ }
33+ }
34+ }
35+ }
36+ }
37+
38+ override fun init () {
39+ isRunning = true
40+ }
41+
42+ override fun terminate () {
43+ isRunning = false
44+ }
45+ }
You can’t perform that action at this time.
0 commit comments