From 7cede5af7f3d55bff27930c09b8d438d631dd080 Mon Sep 17 00:00:00 2001 From: Xiaro <62033805+Xiaro@users.noreply.github.com> Date: Tue, 19 Jan 2021 13:29:39 -0500 Subject: [PATCH] [fix] AutoWalk starts pathing when toggles mode and disabled, readable mode name on ModuleList --- .../kami/module/modules/movement/AutoWalk.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/movement/AutoWalk.kt b/src/main/java/me/zeroeightsix/kami/module/modules/movement/AutoWalk.kt index 81cba5fda..f0f041b1d 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/movement/AutoWalk.kt +++ b/src/main/java/me/zeroeightsix/kami/module/modules/movement/AutoWalk.kt @@ -18,6 +18,7 @@ import net.minecraft.util.MovementInputFromOptions import net.minecraftforge.client.event.InputUpdateEvent import net.minecraftforge.fml.common.gameevent.TickEvent import org.kamiblue.commons.extension.floorToInt +import org.kamiblue.commons.interfaces.DisplayEnum import org.kamiblue.event.listener.listener internal object AutoWalk : Module( @@ -28,8 +29,10 @@ internal object AutoWalk : Module( private val mode = setting("Direction", AutoWalkMode.BARITONE) private val disableOnDisconnect by setting("DisableOnDisconnect", true) - private enum class AutoWalkMode { - FORWARD, BACKWARDS, BARITONE + private enum class AutoWalkMode(override val displayName: String): DisplayEnum { + FORWARD("Forward"), + BACKWARD("Backward"), + BARITONE("Baritone") } val baritoneWalk get() = isEnabled && mode.value == AutoWalkMode.BARITONE @@ -46,7 +49,7 @@ internal object AutoWalk : Module( return if (mode.value == AutoWalkMode.BARITONE && (BaritoneUtils.isActive || BaritoneUtils.isPathing)) { direction.displayName } else { - mode.value.name + mode.value.displayName } } @@ -74,7 +77,7 @@ internal object AutoWalk : Module( AutoWalkMode.FORWARD -> { it.movementInput.moveForward = 1.0f } - AutoWalkMode.BACKWARDS -> { + AutoWalkMode.BACKWARD -> { it.movementInput.moveForward = -1.0f } else -> { @@ -111,7 +114,7 @@ internal object AutoWalk : Module( init { mode.listeners.add { - if (mc.player == null) return@add + if (isDisabled || mc.player == null) return@add if (mode.value == AutoWalkMode.BARITONE) { if (!checkBaritoneElytra()) { runSafe { startPathing() }