1
0
mirror of https://github.com/kami-blue/client synced 2024-12-19 05:34:41 +00:00

Added AutoMine

This commit is contained in:
Dominika 2020-05-25 16:54:40 -04:00
parent a759b25552
commit 3012e97610
No known key found for this signature in database
GPG Key ID: B4A5A6DCA70F861F
2 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,68 @@
package me.zeroeightsix.kami.module.modules.misc
import baritone.api.BaritoneAPI
import me.zeroeightsix.kami.command.Command
import me.zeroeightsix.kami.module.Module
import me.zeroeightsix.kami.setting.Setting
import me.zeroeightsix.kami.setting.Settings
import me.zeroeightsix.kami.util.MessageSendHelper
/**
* @author dominikaaaa
*/
@Module.Info(
name = "AutoMine",
description = "Automatically mines chosen ores",
category = Module.Category.MISC
)
class AutoMine : Module() {
private var iron = register(Settings.b("Iron", true))
private var diamond = register(Settings.b("Diamond", true))
private var gold = register(Settings.b("Gold", false))
private var coal = register(Settings.b("Coal", false))
private var log = register(Settings.b("Logs", false))
init {
iron.settingListener = Setting.SettingListeners { if (mc.player != null && isEnabled) run() }
diamond.settingListener = Setting.SettingListeners { if (mc.player != null && isEnabled) run() }
gold.settingListener = Setting.SettingListeners { if (mc.player != null && isEnabled) run() }
coal.settingListener = Setting.SettingListeners { if (mc.player != null && isEnabled) run() }
log.settingListener = Setting.SettingListeners { if (mc.player != null && isEnabled) run() }
}
override fun onEnable() {
if (mc.player == null) {
disable()
return
}
run()
}
private fun run() {
var current = ""
if (iron.value) current += " iron_ore"
if (diamond.value) current += " diamond_ore"
if (gold.value) current += " gold_ore"
if (coal.value) current += " coal_ore"
if (log.value) current += " log"
if (current.startsWith(" ")) {
current = current.substring(1)
}
val total = current.split(" ")
if (current.length < 2) {
MessageSendHelper.sendBaritoneMessage("Error: you have to choose at least one thing to mine. To mine custom blocks run the &7" + Command.getCommandPrefix() + "b mine block&f command")
BaritoneAPI.getProvider().primaryBaritone.pathingBehavior.cancelEverything()
return
}
MessageSendHelper.sendBaritoneCommand("mine", *total.toTypedArray())
}
override fun onDisable() {
mc.player?.let {
BaritoneAPI.getProvider().primaryBaritone.pathingBehavior.cancelEverything()
}
}
}

View File

@ -10,6 +10,9 @@ import me.zeroeightsix.kami.util.MathsUtils.CardinalMain
import me.zeroeightsix.kami.util.MathsUtils.getPlayerMainCardinal
import me.zeroeightsix.kami.util.MessageSendHelper
/**
* @author dominikaaaa
*/
@Module.Info(
name = "AutoTunnel",
description = "Automatically tunnels forward, at a given size",