From 38c74502f755416b5e0e47707e5f1da459ce2c8a Mon Sep 17 00:00:00 2001 From: szdytom Date: Fri, 3 Nov 2023 13:35:48 +0800 Subject: [PATCH] [plugin/control] fix `.jumpForward()` --- plugin/control/index.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/control/index.mjs b/plugin/control/index.mjs index a8f28a0..88029f4 100644 --- a/plugin/control/index.mjs +++ b/plugin/control/index.mjs @@ -288,6 +288,7 @@ export default function inject(bot) { if (tactic == null) { tactic = {}; } if (tactic.sprint == null) { tactic.sprint = dis > 3; } if (tactic.speed == null) { tactic.speed = tactic.sprint ? .355 : .216; } + const axis = AXIS[axis_raw]; assert.ok(typeof axis == 'number'); assert.ok(0 <= axis && axis <= 3); assert.ok(typeof dis == 'number'); @@ -297,7 +298,6 @@ export default function inject(bot) { throw new NotOnGroundError(); } - const axis = AXIS[axis_raw]; bot.control.centralizeXZ(); let target = bot.entity.position.plus(AXIS_UNIT[axis].scaled(dis)); logger(`jumpForward() axis: ${"zx"[axis % 2]}`);