Skip to content

Commit

Permalink
NoAFK: Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
uoil committed Jan 8, 2021
1 parent c479733 commit b177ec3
Showing 1 changed file with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,25 @@ public void onDisable() {

@Listener
public void onWalkingUpdate(EventUpdateWalkingPlayer event) {
if (event.getStage() == EventStageable.EventStage.PRE) {
final Minecraft mc = Minecraft.getMinecraft();
float yaw = mc.player.rotationYaw;
float pitch = mc.player.rotationPitch;
yaw += (this.yawOffset.getValue() * Math.sin(mc.player.ticksExisted / Math.PI));

Seppuku.INSTANCE.getRotationManager().startTask(this.rotationTask);
if (this.rotationTask.isOnline()) {
Seppuku.INSTANCE.getRotationManager().setPlayerRotations(yaw, pitch);
//Seppuku.INSTANCE.getRotationManager().finishTask(this.rotationTask);
}
final Minecraft mc = Minecraft.getMinecraft();
if (mc.player == null || mc.world == null)
return;

switch (event.getStage()) {
case PRE:
float yaw = mc.player.rotationYaw;
float pitch = mc.player.rotationPitch;
yaw += (this.yawOffset.getValue() * Math.sin(mc.player.ticksExisted / Math.PI));

Seppuku.INSTANCE.getRotationManager().startTask(this.rotationTask);
if (this.rotationTask.isOnline()) {
Seppuku.INSTANCE.getRotationManager().setPlayerRotations(yaw, pitch);
}
break;
case POST:
if (this.rotationTask.isOnline())
Seppuku.INSTANCE.getRotationManager().finishTask(this.rotationTask);
break;
}
}

Expand Down

0 comments on commit b177ec3

Please sign in to comment.