pathing frame listener

This commit is contained in:
Leijurv
2018-08-05 17:48:10 -04:00
parent c1306ab8bf
commit 4cbf20922c
4 changed files with 14 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
package baritone.bot; package baritone.bot;
import baritone.bot.behavior.Behavior; import baritone.bot.behavior.Behavior;
import baritone.bot.behavior.impl.PathingBehavior;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -40,6 +41,7 @@ public enum Baritone {
this.gameEventHandler = new GameEventHandler(); this.gameEventHandler = new GameEventHandler();
this.inputOverrideHandler = new InputOverrideHandler(); this.inputOverrideHandler = new InputOverrideHandler();
this.behaviors = new ArrayList<>(); this.behaviors = new ArrayList<>();
behaviors.add(PathingBehavior.INSTANCE);
this.active = true; this.active = true;
this.initialized = true; this.initialized = true;

View File

@@ -82,7 +82,7 @@ public final class GameEventHandler implements IGameEventListener {
@Override @Override
public void onRenderPass(RenderEvent event) { public void onRenderPass(RenderEvent event) {
dispatch(behavior -> onRenderPass(event)); dispatch(behavior -> behavior.onRenderPass(event));
} }
@Override @Override

View File

@@ -14,7 +14,7 @@ public class Behavior implements AbstractGameEventListener, Helper {
/** /**
* Whether or not this behavior is enabled * Whether or not this behavior is enabled
*/ */
private boolean enabled; private boolean enabled = true;
/** /**
* Toggles the enabled state of this {@link Behavior}. * Toggles the enabled state of this {@link Behavior}.

View File

@@ -1,6 +1,7 @@
package baritone.bot.behavior.impl; package baritone.bot.behavior.impl;
import baritone.bot.behavior.Behavior; import baritone.bot.behavior.Behavior;
import baritone.bot.event.events.RenderEvent;
import baritone.bot.pathing.path.IPath; import baritone.bot.pathing.path.IPath;
import baritone.bot.pathing.path.PathExecutor; import baritone.bot.pathing.path.PathExecutor;
@@ -14,6 +15,7 @@ public class PathingBehavior extends Behavior {
@Override @Override
public void onTick() { public void onTick() {
System.out.println("Ticking");
if (current == null) { if (current == null) {
return; return;
} }
@@ -33,4 +35,11 @@ public class PathingBehavior extends Behavior {
} }
return current.getPath(); return current.getPath();
} }
@Override
public void onRenderPass(RenderEvent event) {
System.out.println("Render passing");
System.out.println(event.getPartialTicks());
}
} }