From f320c6710a55192c6edc12b8f563a5ca0edf3a9e Mon Sep 17 00:00:00 2001 From: Howard Stark Date: Sun, 5 Aug 2018 22:15:25 -0400 Subject: [PATCH 1/2] Fix instant crash on mainmenu --- .../java/baritone/bot/behavior/impl/PathingBehavior.java | 3 +-- src/main/java/baritone/bot/event/events/TickEvent.java | 8 ++++++++ .../bot/pathing/movement/movements/MovementFall.java | 4 ++++ src/main/java/baritone/bot/pathing/path/PathExecutor.java | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 src/main/java/baritone/bot/pathing/movement/movements/MovementFall.java diff --git a/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java b/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java index 2592c9d7..a18b5d7e 100644 --- a/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java +++ b/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java @@ -42,8 +42,7 @@ public class PathingBehavior extends Behavior { @Override public void onTick(TickEvent event) { - // System.out.println("Ticking"); - if (current == null) { + if(event.getType() == TickEvent.Type.OUT || current == null) { return; } current.onTick(event); diff --git a/src/main/java/baritone/bot/event/events/TickEvent.java b/src/main/java/baritone/bot/event/events/TickEvent.java index 4e6790ba..b6c732b2 100644 --- a/src/main/java/baritone/bot/event/events/TickEvent.java +++ b/src/main/java/baritone/bot/event/events/TickEvent.java @@ -13,6 +13,14 @@ public final class TickEvent { this.type = type; } + public Type getType() { + return type; + } + + public EventState getState() { + return state; + } + public enum Type { /** diff --git a/src/main/java/baritone/bot/pathing/movement/movements/MovementFall.java b/src/main/java/baritone/bot/pathing/movement/movements/MovementFall.java new file mode 100644 index 00000000..94bece12 --- /dev/null +++ b/src/main/java/baritone/bot/pathing/movement/movements/MovementFall.java @@ -0,0 +1,4 @@ +package baritone.bot.pathing.movement.movements; + +public class MovementFall { +} diff --git a/src/main/java/baritone/bot/pathing/path/PathExecutor.java b/src/main/java/baritone/bot/pathing/path/PathExecutor.java index 3ebd344c..8d0c0d53 100644 --- a/src/main/java/baritone/bot/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/bot/pathing/path/PathExecutor.java @@ -35,6 +35,7 @@ public class PathExecutor extends Behavior { @Override public void onTick(TickEvent event) { + if(event.) if (pathPosition >= path.length()) { //stop bugging me, I'm done //TODO Baritone.INSTANCE.behaviors.remove(this) From a4ccfe50a74af647394a9cedf066e7fce73cbe93 Mon Sep 17 00:00:00 2001 From: Howard Stark Date: Mon, 6 Aug 2018 13:07:30 -0700 Subject: [PATCH 2/2] Add TickEvent typecheck --- src/main/java/baritone/bot/pathing/path/PathExecutor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/bot/pathing/path/PathExecutor.java b/src/main/java/baritone/bot/pathing/path/PathExecutor.java index 8d0c0d53..087e53f6 100644 --- a/src/main/java/baritone/bot/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/bot/pathing/path/PathExecutor.java @@ -35,7 +35,9 @@ public class PathExecutor extends Behavior { @Override public void onTick(TickEvent event) { - if(event.) + if(event.getType() == TickEvent.Type.OUT) { + return; + } if (pathPosition >= path.length()) { //stop bugging me, I'm done //TODO Baritone.INSTANCE.behaviors.remove(this)