pathing frame listener

This commit is contained in:
Leijurv 2018-08-05 17:48:10 -04:00
parent c1306ab8bf
commit 4cbf20922c
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
4 changed files with 14 additions and 3 deletions

View File

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

View File

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

View File

@ -14,7 +14,7 @@ public class Behavior implements AbstractGameEventListener, Helper {
/**
* Whether or not this behavior is enabled
*/
private boolean enabled;
private boolean enabled = true;
/**
* Toggles the enabled state of this {@link Behavior}.
@ -51,7 +51,7 @@ public class Behavior implements AbstractGameEventListener, Helper {
* that should always be active, given that the bot itself is
* active.
*
* @param oldState The old state
* @param oldState The old state
* @param proposedState The proposed state
* @return The new state
*/

View File

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