Add player update injection
This commit is contained in:
parent
9bda792a3e
commit
4608086656
@ -24,8 +24,8 @@ public final class GameEventHandler implements IGameEventListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderPass() {
|
||||
dispatch(Behavior::onRenderPass);
|
||||
public void onPlayerUpdate() {
|
||||
dispatch(Behavior::onPlayerUpdate);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -57,6 +57,11 @@ public final class GameEventHandler implements IGameEventListener {
|
||||
dispatch(behavior -> behavior.onChunkEvent(event));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderPass() {
|
||||
dispatch(Behavior::onRenderPass);
|
||||
}
|
||||
|
||||
private void dispatch(Consumer<Behavior> dispatchFunction) {
|
||||
Baritone.INSTANCE.getBehaviors().stream().filter(Behavior::isEnabled).forEach(dispatchFunction);
|
||||
}
|
||||
|
@ -21,6 +21,9 @@ public interface AbstractGameEventListener extends IGameEventListener {
|
||||
@Override
|
||||
default void onTick() {}
|
||||
|
||||
@Override
|
||||
default void onPlayerUpdate() {}
|
||||
|
||||
@Override
|
||||
default void onProcessKeyBinds() {}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import baritone.bot.event.events.ChunkEvent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
|
||||
/**
|
||||
* @author Brady
|
||||
@ -19,6 +20,12 @@ public interface IGameEventListener {
|
||||
*/
|
||||
void onTick();
|
||||
|
||||
/**
|
||||
* Run once per game tick from before the player rotation is sent to the server.
|
||||
* @see EntityPlayerSP#onUpdate()
|
||||
*/
|
||||
void onPlayerUpdate();
|
||||
|
||||
/**
|
||||
* Run once per game tick from before keybinds are processed.
|
||||
*
|
||||
@ -43,6 +50,8 @@ public interface IGameEventListener {
|
||||
|
||||
/**
|
||||
* Runs once each frame
|
||||
*
|
||||
* @see EntityRenderer#renderWorldPass(int, float, long)
|
||||
*/
|
||||
void onRenderPass();
|
||||
}
|
||||
|
@ -26,4 +26,15 @@ public class MixinEntityPlayerSP {
|
||||
if (event.isCancelled())
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
@Inject(
|
||||
method = "onUpdate",
|
||||
at = @At(
|
||||
value = "INVOKE_ASSIGN",
|
||||
target = "Lnet/minecraft/client/entity/AbstractClientPlayer;onUpdate()V"
|
||||
)
|
||||
)
|
||||
public void onUpdate(CallbackInfo ci) {
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user