Fix SprintStateEvent

This commit is contained in:
Brady 2019-01-19 12:12:26 -06:00
parent aa2e680568
commit f5446cc415
No known key found for this signature in database
GPG Key ID: 73A788379A197567
2 changed files with 3 additions and 11 deletions

View File

@ -17,21 +17,14 @@
package baritone.api.event.events;
import baritone.api.event.events.type.ManagedPlayerEvent;
import net.minecraft.client.entity.EntityPlayerSP;
/**
* @author Brady
* @since 1/18/2019
*/
public class SprintStateEvent extends ManagedPlayerEvent {
public class SprintStateEvent {
private Boolean state;
public SprintStateEvent(EntityPlayerSP player) {
super(player);
}
public final void setState(boolean state) {
this.state = state;
}

View File

@ -98,9 +98,8 @@ public class MixinEntityPlayerSP {
)
)
private boolean isKeyDown(KeyBinding keyBinding) {
EntityPlayerSP self = (EntityPlayerSP) (Object) this;
SprintStateEvent event = new SprintStateEvent(self);
BaritoneAPI.getProvider().getBaritoneForPlayer(self).getGameEventHandler().onPlayerSprintState(event);
SprintStateEvent event = new SprintStateEvent();
BaritoneAPI.getProvider().getBaritoneForPlayer((EntityPlayerSP) (Object) this).getGameEventHandler().onPlayerSprintState(event);
return event.getState() == null ? keyBinding.isKeyDown() : event.getState();
}
}