fix 'direction null' bug and improve autowalk stability

This commit is contained in:
Dewy 2020-07-31 21:27:21 +01:00
parent 70db20c212
commit ff9cb1f0dc
No known key found for this signature in database
GPG Key ID: BEFD512A89BB6A10
3 changed files with 20 additions and 7 deletions

9
.gitignore vendored
View File

@ -57,6 +57,10 @@ local.properties
.recommenders
kami_Client.launch
kami_Server.launch
client_Client.launch
client_Server.launch
.classpath
.project
# External tool builders
.externalToolBuilders/
@ -103,11 +107,6 @@ kami_Server.launch
.worksheet
### Eclipse Patch ###
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Annotation Processing
.apt_generated

View File

@ -302,7 +302,7 @@ public class KamiGUI extends GUI {
processes.setText("");
if (!frameFinal.isMinimized() && BaritoneAPI.getProvider().getPrimaryBaritone().getPathingControlManager().mostRecentInControl().isPresent()) {
if (MODULE_MANAGER.isModuleEnabled(AutoWalk.class) && MODULE_MANAGER.getModuleT(AutoWalk.class).mode.getValue().equals(AutoWalk.AutoWalkMode.BARITONE)) {
if (MODULE_MANAGER.isModuleEnabled(AutoWalk.class) && MODULE_MANAGER.getModuleT(AutoWalk.class).mode.getValue().equals(AutoWalk.AutoWalkMode.BARITONE) && AutoWalk.direction != null) {
processes.addLine("Process: AutoWalk (" + AutoWalk.direction + ")");
} else {
processes.addLine("Process: " + BaritoneAPI.getProvider().getPrimaryBaritone().getPathingControlManager().mostRecentInControl().get().displayName());

View File

@ -5,6 +5,7 @@ import baritone.api.pathing.goals.GoalXZ
import me.zero.alpine.listener.EventHandler
import me.zero.alpine.listener.EventHook
import me.zero.alpine.listener.Listener
import me.zeroeightsix.kami.KamiMod
import me.zeroeightsix.kami.event.events.ServerDisconnectedEvent
import me.zeroeightsix.kami.module.Module
import me.zeroeightsix.kami.setting.Setting
@ -44,6 +45,10 @@ class AutoWalk : Module() {
event.movementInput.moveForward = -1f
}
AutoWalkMode.BARITONE -> disableBaritone = true
else -> {
KamiMod.log.error("Mode is irregular. Value: " + mode.value)
}
}
})
@ -77,6 +82,11 @@ class AutoWalk : Module() {
Cardinal.POS_X_NEG_Z -> BaritoneAPI.getProvider().primaryBaritone.customGoalProcess.setGoalAndPath(GoalXZ(mc.player.posX.toInt() + border, mc.player.posZ.toInt() - border))
Cardinal.POS_X -> BaritoneAPI.getProvider().primaryBaritone.customGoalProcess.setGoalAndPath(GoalXZ(mc.player.posX.toInt() + border, mc.player.posZ.toInt()))
Cardinal.POS_X_POS_Z -> BaritoneAPI.getProvider().primaryBaritone.customGoalProcess.setGoalAndPath(GoalXZ(mc.player.posX.toInt() + border, mc.player.posZ.toInt() + border))
else -> {
sendErrorMessage("&cCould not determine direction. Disabling...")
disable()
}
}
direction = MathsUtils.getPlayerCardinal(mc)!!.cardinalName
@ -84,12 +94,16 @@ class AutoWalk : Module() {
override fun getHudInfo(): String {
return if (BaritoneAPI.getProvider().primaryBaritone.customGoalProcess.goal != null) {
direction!!
direction.toString()
} else {
when (mode.value) {
AutoWalkMode.BARITONE -> "NONE"
AutoWalkMode.FORWARD -> "FORWARD"
AutoWalkMode.BACKWARDS -> "BACKWARDS"
else -> {
"N/A"
}
}
}
}