diff --git a/README.md b/README.md index 4b39c85..4e5dc3d 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,5 @@ _Currently in super beta so don't expect something working for a while._ - Built-in guide (CANCELED) **This feature is being worked on in a different mod called "Mythicfy", so it will not be added to this one. We recommend you download that mod.** - Auto-Welcome (20%) **WARNING: This feature may prove to be annoying, in which case we will remove it.** - City NPCs (Lively Mode) (0%) -- Fishing notifications (0%) \ No newline at end of file +- Fishing notifications (0%) +- Macros (100%) \ No newline at end of file diff --git a/src/client/kotlin/chickenmanfy/scify/Modules/Menu.kt b/src/client/kotlin/chickenmanfy/scify/Modules/Menu.kt index 687542b..202ee45 100644 --- a/src/client/kotlin/chickenmanfy/scify/Modules/Menu.kt +++ b/src/client/kotlin/chickenmanfy/scify/Modules/Menu.kt @@ -48,15 +48,15 @@ class Menu : Screen(Text.literal("SciFy Menu")) { .tooltip(Tooltip.of(Text.literal("Fishing Notifications"))) .build() warpHotkeys = ButtonWidget.builder(Text.literal("Toggle hotkeys")) { - fishingnotif().toggleFishingNotif() // Call the function toggleFishingNotif() from the fishingnotif.kt module + // I don't think we actually need this module at all. TODO: replace with something else } .dimensions(width / 2 - 205, 60, 200, 20) .tooltip(Tooltip.of(Text.literal("Enable/Disable hotkeys."))) .build() autoWelcome = ButtonWidget.builder(Text.literal("Auto-Welcome")) { - fishingnotif().toggleFishingNotif() // Call the function toggleFishingNotif() from the fishingnotif.kt module + autowelcome().toggleAutoWelcome() // Call the function toggleAutoWelcome() from the fishingnotif.kt module } - .dimensions(width / 2 + 5, 60, 200, 20) + .dimensions(width / 2 - 205, 60, 200, 20) .tooltip(Tooltip.of(Text.literal("Automatically welcomes new players."))) .build() livelyMode = ButtonWidget.builder(Text.literal("City NPCs (Lively Mode)")) { @@ -66,17 +66,17 @@ class Menu : Screen(Text.literal("SciFy Menu")) { .tooltip(Tooltip.of(Text.literal("Replaces Villagers with player NPCs"))) .build() resourcePack = ButtonWidget.builder(Text.literal("Toggle Resource Pack")) { - fishingnotif().toggleFishingNotif() // Call the function toggleFishingNotif() from the fishingnotif.kt module + // TODO: Implement Resource pack } - .dimensions(width / 2 + 5, 100, 200, 20) + .dimensions(width / 2 + 5, 60, 200, 20) .tooltip(Tooltip.of(Text.literal("Toggles the community resource pack."))) .build() addDrawableChild(dynamicBars) addDrawableChild(fishingNotif) - addDrawableChild(warpHotkeys) + //addDrawableChild(warpHotkeys) addDrawableChild(autoWelcome) - addDrawableChild(livelyMode) + //addDrawableChild(livelyMode) addDrawableChild(resourcePack) } } \ No newline at end of file diff --git a/src/client/kotlin/chickenmanfy/scify/Modules/autowelcome.kt b/src/client/kotlin/chickenmanfy/scify/Modules/autowelcome.kt index 7dd8433..cc3d507 100644 --- a/src/client/kotlin/chickenmanfy/scify/Modules/autowelcome.kt +++ b/src/client/kotlin/chickenmanfy/scify/Modules/autowelcome.kt @@ -1,14 +1,10 @@ package chickenmanfy.scify.Modules -import net.minecraft.client.MinecraftClient -import net.minecraft.text.Text -fun autowelcome() { - val minecraftClient = MinecraftClient.getInstance() - val message: Text = Text.literal("Hi!") - if (minecraftClient?.player != null) { - minecraftClient.player!!.sendMessage(message, false) - } else { - println("MinecraftClient or player is null!") + +class autowelcome() { + fun toggleAutoWelcome() { + } + fun autoWelcome() { } } \ No newline at end of file diff --git a/src/client/kotlin/chickenmanfy/scify/Modules/hotkey.kt b/src/client/kotlin/chickenmanfy/scify/Modules/hotkey.kt index 20e1756..d570d60 100644 --- a/src/client/kotlin/chickenmanfy/scify/Modules/hotkey.kt +++ b/src/client/kotlin/chickenmanfy/scify/Modules/hotkey.kt @@ -1,9 +1,57 @@ package chickenmanfy.scify.Modules -import net.fabricmc.fabric.impl.command.client.ClientCommandInternals.executeCommand +import io.netty.buffer.ByteBuf +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 net.minecraft.network.PacketByteBuf +import net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket +import net.minecraft.text.Text +import org.lwjgl.glfw.GLFW + class hotkey { - fun hotkey() { - // TODO: Implement hotkeys in this file. + fun hotkeys() { + + // Register Keys + val warp = KeyBindingHelper.registerKeyBinding( + KeyBinding( + "Open Warp Menu (/warp)", + InputUtil.Type.KEYSYM, + GLFW.GLFW_KEY_V, + "SciFy" + ) + ) + val enderchest = KeyBindingHelper.registerKeyBinding( + KeyBinding( + "Open Ender Chest (/ec)", + InputUtil.Type.KEYSYM, + GLFW.GLFW_KEY_Z, + "SciFy" + ) + ) + val guide = KeyBindingHelper.registerKeyBinding( + KeyBinding( + "Open Guide Book (/guide)", + InputUtil.Type.KEYSYM, + GLFW.GLFW_KEY_SEMICOLON, + "SciFy" + ) + ) + ClientTickEvents.END_CLIENT_TICK.register(ClientTickEvents.EndTick { client: MinecraftClient -> + while (warp.wasPressed()) { + MinecraftClient.getInstance().networkHandler!!.sendChatCommand("warp") + } + while (enderchest.wasPressed()) { + MinecraftClient.getInstance().networkHandler!!.sendChatCommand("ec") + } + while (guide.wasPressed()) { + MinecraftClient.getInstance().networkHandler!!.sendChatCommand("guide") + } + + }) + } } \ No newline at end of file diff --git a/src/client/kotlin/chickenmanfy/scify/SciFyClient.kt b/src/client/kotlin/chickenmanfy/scify/SciFyClient.kt index e304c9b..480bd17 100644 --- a/src/client/kotlin/chickenmanfy/scify/SciFyClient.kt +++ b/src/client/kotlin/chickenmanfy/scify/SciFyClient.kt @@ -1,6 +1,7 @@ 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 @@ -14,6 +15,7 @@ import org.lwjgl.glfw.GLFW object SciFyClient : ClientModInitializer { override fun onInitializeClient() { + hotkey().hotkeys() // Open Menu Hotkey val menu = KeyBindingHelper.registerKeyBinding( KeyBinding(