aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/kotlin/dulkirmod/DulkirMod.kt7
-rw-r--r--src/main/kotlin/dulkirmod/command/FarmingControlSchemeCommand.kt52
-rw-r--r--src/main/kotlin/dulkirmod/command/HelpCommand.kt1
-rw-r--r--src/main/kotlin/dulkirmod/config/Config.kt11
4 files changed, 70 insertions, 1 deletions
diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt
index 568619f..4c94ae2 100644
--- a/src/main/kotlin/dulkirmod/DulkirMod.kt
+++ b/src/main/kotlin/dulkirmod/DulkirMod.kt
@@ -55,6 +55,7 @@ class DulkirMod {
ClientCommandHandler.instance.registerCommand(JoinDungeonCommand())
ClientCommandHandler.instance.registerCommand(LeapNameCommand())
ClientCommandHandler.instance.registerCommand(HurtCamCommand())
+ ClientCommandHandler.instance.registerCommand(FarmingControlSchemeCommand())
}
@Mod.EventHandler
@@ -114,12 +115,15 @@ class DulkirMod {
Config.noReverse3rdPerson = !Config.noReverse3rdPerson
TextUtils.toggledMessage("No Selfie Camera", Config.noReverse3rdPerson)
}
+ if (keyBinds[2].isPressed) {
+ FarmingControlSchemeCommand.toggleControls();
+ }
}
companion object {
const val MOD_ID = "dulkirmod"
const val MOD_NAME = "Dulkir Mod"
- const val MOD_VERSION = "1.1.7"
+ const val MOD_VERSION = "1.1.8"
const val CHAT_PREFIX = "§f<§3DulkirMod§f>§r"
val mc: Minecraft = Minecraft.getMinecraft()
@@ -134,6 +138,7 @@ class DulkirMod {
val keyBinds = arrayOf(
KeyBinding("Open Settings", Keyboard.KEY_RSHIFT, "Dulkir Mod"),
KeyBinding("Toggle Selfie Setting", Keyboard.KEY_NONE, "Dulkir Mod"),
+ KeyBinding("Toggle Farming Controls", Keyboard.KEY_NONE, "Dulkir Mod")
)
}
diff --git a/src/main/kotlin/dulkirmod/command/FarmingControlSchemeCommand.kt b/src/main/kotlin/dulkirmod/command/FarmingControlSchemeCommand.kt
new file mode 100644
index 0000000..8bbad18
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/command/FarmingControlSchemeCommand.kt
@@ -0,0 +1,52 @@
+package dulkirmod.command
+
+import dulkirmod.config.Config
+import dulkirmod.utils.TextUtils
+import net.minecraft.client.Minecraft
+import net.minecraft.client.settings.KeyBinding
+import net.minecraft.command.CommandException
+import net.minecraft.command.ICommandSender
+
+class FarmingControlSchemeCommand : ClientCommandBase("farmcontrols") {
+ private var enabled = false
+ @Throws(CommandException::class)
+ override fun processCommand(sender: ICommandSender, args: Array<String>) {
+ toggleControls()
+ }
+
+ companion object {
+ private var enabled = false
+
+ /**
+ * Method to do the brunt work of the command. This is separate, so I can also let the user set a
+ * keybind to do the same thing.
+ */
+ fun toggleControls() {
+ val minecraft = Minecraft.getMinecraft()
+ val breakingKey: KeyBinding = minecraft.gameSettings.keyBindAttack
+ val jumpKey: KeyBinding = minecraft.gameSettings.keyBindJump
+ if (!enabled) {
+ KeyBinding.setKeyBindState(breakingKey.keyCode, false)
+ breakingKey.keyCode = 57 // 57 = space key code
+
+ KeyBinding.setKeyBindState(jumpKey.keyCode, false)
+ jumpKey.keyCode = -100 // -100 = Left click key code
+ minecraft.gameSettings.mouseSensitivity = 0.0f
+ } else {
+ KeyBinding.setKeyBindState(breakingKey.keyCode, false)
+ breakingKey.keyCode = -100 // -100 = Left click key code
+
+ KeyBinding.setKeyBindState(jumpKey.keyCode, false)
+ jumpKey.keyCode = 57 // 57 = space key code
+ minecraft.gameSettings.mouseSensitivity = Config.defaultSens / 2
+ }
+
+ // Save the changes to the control settings
+ minecraft.gameSettings.saveOptions()
+ minecraft.gameSettings.loadOptions()
+
+ enabled = !enabled
+ TextUtils.toggledMessage("Farming Controls", enabled)
+ }
+ }
+} \ No newline at end of file
diff --git a/src/main/kotlin/dulkirmod/command/HelpCommand.kt b/src/main/kotlin/dulkirmod/command/HelpCommand.kt
index 2b7a9b0..7269d7a 100644
--- a/src/main/kotlin/dulkirmod/command/HelpCommand.kt
+++ b/src/main/kotlin/dulkirmod/command/HelpCommand.kt
@@ -11,5 +11,6 @@ class HelpCommand : ClientCommandBase("dulkirhelp") {
TextUtils.info(" §7/enchantrune - toggles enchant rune visibility.", false)
TextUtils.info(" §7/fairy - toggles healer fairy visibility.", false)
TextUtils.info(" §7/hl - helps change highlighted leap player on the fly.", false)
+ TextUtils.info(" §7/farmcontrols - swaps some keybinds and adjusts sens to be better suited for farming", false)
}
} \ No newline at end of file
diff --git a/src/main/kotlin/dulkirmod/config/Config.kt b/src/main/kotlin/dulkirmod/config/Config.kt
index 4d490bd..7f914e1 100644
--- a/src/main/kotlin/dulkirmod/config/Config.kt
+++ b/src/main/kotlin/dulkirmod/config/Config.kt
@@ -559,6 +559,17 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so
)
var persistentAlert = true
+ @Property(
+ type = PropertyType.DECIMAL_SLIDER,
+ name = "Default Sensitivity",
+ description = "For use with the /farmcontrols command toggle",
+ category = "Farming",
+ minF = 0f,
+ maxF = 2f,
+ decimalPlaces = 2
+ )
+ var defaultSens = .7f
+
fun init() {
initialize()
addDependency("customMessage", "throttleNotifier")