Skip to content

Commit 9979e82

Browse files
authored
[InfoHud] Update facing and camera angle values (#268)
A request from Poyo to make the camera values in the game update even in Tickrate 0, made me realise I had not updated the camera... Now facing should display the current angle while camera should show the next camera
2 parents fbae542 + 551bec0 commit 9979e82

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/main/java/com/minecrafttas/tasmod/gui/InfoHud.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public boolean checkInit() {
316316
+ "_visible")), Boolean.parseBoolean(configuration.getProperty(title + "_rect")), () -> {
317317
if (Minecraft.getMinecraft().currentScreen == this)
318318
return "Facing";
319-
return String.format("%.2f %.2f", MathHelper.wrapDegrees(Minecraft.getMinecraft().player.rotationYaw), MathHelper.wrapDegrees(Minecraft.getMinecraft().player.rotationPitch));
319+
return String.format("%.2f %.2f", MathHelper.wrapDegrees(TASmodClient.virtual.CAMERA_ANGLE.getCurrentYaw()), MathHelper.wrapDegrees(TASmodClient.virtual.CAMERA_ANGLE.getCurrentPitch()));
320320
}));
321321

322322
title = "camera";
@@ -327,7 +327,7 @@ public boolean checkInit() {
327327
+ "_visible")), Boolean.parseBoolean(configuration.getProperty(title + "_rect")), () -> {
328328
if (Minecraft.getMinecraft().currentScreen == this)
329329
return "Camera";
330-
return String.format("%.2f %.2f", TASmodClient.virtual.CAMERA_ANGLE.getCurrentYaw(), TASmodClient.virtual.CAMERA_ANGLE.getCurrentPitch());
330+
return String.format("%.2f %.2f", MathHelper.wrapDegrees(TASmodClient.virtual.CAMERA_ANGLE.getNextYaw()), MathHelper.wrapDegrees(TASmodClient.virtual.CAMERA_ANGLE.getNextPitch()));
331331
}));
332332

333333
title = "cticks";

src/main/java/com/minecrafttas/tasmod/virtual/VirtualInput.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,19 +684,33 @@ public void setCamera(Float pitch, Float yaw) {
684684
}
685685

686686
/**
687-
* @return The absolute pitch coordinate of the player. May be null when it's initialized
687+
* @return The current pitch coordinate of the player. May be null when it's initialized
688688
*/
689689
public Float getCurrentPitch() {
690690
return currentCameraAngle.getPitch();
691691
}
692692

693693
/**
694-
* @return The absolute yaw coordinate of the player. May be null when it's initialized
694+
* @return The current yaw coordinate of the player. May be null when it's initialized
695695
*/
696696
public Float getCurrentYaw() {
697697
return currentCameraAngle.getYaw();
698698
}
699699

700+
/**
701+
* @return The pitch coordinate of the player in the next tick. May be null when it's initialized
702+
*/
703+
public Float getNextPitch() {
704+
return nextCameraAngle.getPitch();
705+
}
706+
707+
/**
708+
* @return The yaw coordinate of the player in the next tick. May be null when it's initialized
709+
*/
710+
public Float getNextYaw() {
711+
return nextCameraAngle.getYaw();
712+
}
713+
700714
/**
701715
* Clears the {@link #nextCameraAngle}
702716
*/

0 commit comments

Comments
 (0)