diff --git a/src/client/kotlin/chickenmanfy/scify/SciFyClient.kt b/src/client/kotlin/chickenmanfy/scify/SciFyClient.kt index 9ce1576..7448f69 100644 --- a/src/client/kotlin/chickenmanfy/scify/SciFyClient.kt +++ b/src/client/kotlin/chickenmanfy/scify/SciFyClient.kt @@ -1,35 +1,12 @@ package chickenmanfy.scify -import chickenmanfy.scify.modules.Menu import chickenmanfy.scify.modules.Hotkey 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 { override fun onInitializeClient() { + // Runs the Hotkey().hotkeys() function which contains all keybindings. 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()) - } - }) } } diff --git a/src/client/kotlin/chickenmanfy/scify/modules/Hotkey.kt b/src/client/kotlin/chickenmanfy/scify/modules/Hotkey.kt index 19b0319..c69ca56 100644 --- a/src/client/kotlin/chickenmanfy/scify/modules/Hotkey.kt +++ b/src/client/kotlin/chickenmanfy/scify/modules/Hotkey.kt @@ -36,6 +36,15 @@ class Hotkey { "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 { while (warp.wasPressed()) { MinecraftClient.getInstance().networkHandler!!.sendChatCommand("warp") @@ -46,6 +55,9 @@ class Hotkey { while (guide.wasPressed()) { MinecraftClient.getInstance().networkHandler!!.sendChatCommand("guide") } + while (menu.wasPressed()) { + MinecraftClient.getInstance().setScreen(Menu()) + } })