Move Menu keybind to Hotkey.kt
This commit is contained in:
@@ -1,35 +1,12 @@
|
|||||||
package chickenmanfy.scify
|
package chickenmanfy.scify
|
||||||
|
|
||||||
import chickenmanfy.scify.modules.Menu
|
|
||||||
import chickenmanfy.scify.modules.Hotkey
|
import chickenmanfy.scify.modules.Hotkey
|
||||||
import net.fabricmc.api.ClientModInitializer
|
import net.fabricmc.api.ClientModInitializer
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
|
|
||||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper
|
|
||||||
import net.minecraft.client.MinecraftClient
|
|
||||||
import net.minecraft.client.option.KeyBinding
|
|
||||||
import net.minecraft.client.util.InputUtil
|
|
||||||
import org.lwjgl.glfw.GLFW
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
object SciFyClient : ClientModInitializer {
|
object SciFyClient : ClientModInitializer {
|
||||||
override fun onInitializeClient() {
|
override fun onInitializeClient() {
|
||||||
|
// Runs the Hotkey().hotkeys() function which contains all keybindings.
|
||||||
Hotkey().hotkeys()
|
Hotkey().hotkeys()
|
||||||
// Open Menu Hotkey
|
|
||||||
val menu = KeyBindingHelper.registerKeyBinding(
|
|
||||||
KeyBinding(
|
|
||||||
"Menu",
|
|
||||||
InputUtil.Type.KEYSYM,
|
|
||||||
GLFW.GLFW_KEY_RIGHT_SHIFT,
|
|
||||||
"SciFy"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
ClientTickEvents.END_CLIENT_TICK.register(ClientTickEvents.EndTick {
|
|
||||||
while (menu.wasPressed()) {
|
|
||||||
MinecraftClient.getInstance().setScreen(Menu())
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,15 @@ class Hotkey {
|
|||||||
"SciFy"
|
"SciFy"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
// Open Menu Hotkey
|
||||||
|
val menu = KeyBindingHelper.registerKeyBinding(
|
||||||
|
KeyBinding(
|
||||||
|
"Menu",
|
||||||
|
InputUtil.Type.KEYSYM,
|
||||||
|
GLFW.GLFW_KEY_RIGHT_SHIFT,
|
||||||
|
"SciFy"
|
||||||
|
)
|
||||||
|
)
|
||||||
ClientTickEvents.END_CLIENT_TICK.register(ClientTickEvents.EndTick {
|
ClientTickEvents.END_CLIENT_TICK.register(ClientTickEvents.EndTick {
|
||||||
while (warp.wasPressed()) {
|
while (warp.wasPressed()) {
|
||||||
MinecraftClient.getInstance().networkHandler!!.sendChatCommand("warp")
|
MinecraftClient.getInstance().networkHandler!!.sendChatCommand("warp")
|
||||||
@@ -46,6 +55,9 @@ class Hotkey {
|
|||||||
while (guide.wasPressed()) {
|
while (guide.wasPressed()) {
|
||||||
MinecraftClient.getInstance().networkHandler!!.sendChatCommand("guide")
|
MinecraftClient.getInstance().networkHandler!!.sendChatCommand("guide")
|
||||||
}
|
}
|
||||||
|
while (menu.wasPressed()) {
|
||||||
|
MinecraftClient.getInstance().setScreen(Menu())
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user