Skip to content

Commit

Permalink
fix block representation in .csv
Browse files Browse the repository at this point in the history
reset player after loading new blocks
  • Loading branch information
Leg0shii committed Apr 25, 2023
1 parent 2dda2c7 commit 23ba153
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/main/java/de/legoshi/parkourcalculator/file/CSVUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static void saveTicksToCSV(List<InputData> inputTicks, String filePath) {
Vec3 p = tick.getPosition();
Vec3 v = tick.getVelocity();
writer.write(String.format(Locale.US, "%.15f,%.15f,%.15f,%.5f,%.5f,%.1f,%.1f,%b,%b,%b,%b,%b,%b,%b,%b,%b,%.15f,%.15f,%.15f",
p.x, p.y, p.z, iTick.YAW, 90.0, iTick.YAW, 0.0, iTick.W, iTick.A, iTick.S, iTick.D, iTick.SPRINT, iTick.SNEAK, iTick.JUMP, false, false, v.x, v.y, v.z));
-p.x, p.y, p.z, iTick.YAW, 90.0, iTick.YAW, 0.0, iTick.W, iTick.A, iTick.S, iTick.D, iTick.SPRINT, iTick.SNEAK, iTick.JUMP, false, false, -v.x, v.y, v.z));
writer.newLine();
}
} catch (IOException e) {
Expand Down Expand Up @@ -60,8 +60,8 @@ public static List<InputData> loadTicksFromCSV(String filePath) {
Float.parseFloat(tokens[3])
);

Vec3 position = new Vec3(Double.parseDouble(tokens[0]), Double.parseDouble(tokens[1]), Double.parseDouble(tokens[2]));
Vec3 velocity = new Vec3(Double.parseDouble(tokens[16]), Double.parseDouble(tokens[17]), Double.parseDouble(tokens[18]));
Vec3 position = new Vec3(-Double.parseDouble(tokens[0]), Double.parseDouble(tokens[1]), Double.parseDouble(tokens[2]));
Vec3 velocity = new Vec3(-Double.parseDouble(tokens[16]), Double.parseDouble(tokens[17]), Double.parseDouble(tokens[18]));

inputData.setInputTick(tick);
inputData.setPosition(position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import lombok.Getter;

import java.awt.*;
import java.awt.datatransfer.Clipboard;
Expand All @@ -37,7 +39,7 @@ public class PlayerSettings extends TitledPane {
private final TextField yVelField;
private final TextField zVelField;

private final TextField facingYaw;
@Getter private final TextField facingYaw;
private final TextField facingPitch;

public PlayerSettings(CoordinateScreen coordinateScreen, MovementEngine movementEngine, PositionVisualizer positionVisualizer) {
Expand Down Expand Up @@ -100,7 +102,7 @@ public PlayerSettings(CoordinateScreen coordinateScreen, MovementEngine movement
gridPane.add(zVelField, 1, 5);

// Create the button to apply values
Button getButton = new Button("Get values");
Button getButton = new Button("Get Pos. & Vel.");
getButton.setOnAction(event -> updatePlayerSettings());

Button copyButton = new Button("Copy to Clipboard");
Expand Down Expand Up @@ -143,7 +145,7 @@ public void updatePlayerSettings() {
this.xPosField.setText(replaceNegZero(startPos.x*(-1))+ "");
this.yPosField.setText(startPos.y + "");
this.zPosField.setText(startPos.z + "");
this.facingYaw.setText(replaceNegZero(movementEngine.player.getStartYAW()*(-1)) + "");
this.facingYaw.setText(replaceNegZero(movementEngine.player.getStartYAW()) + "");

Player player = movementEngine.player;
this.xVelField.setText(replaceNegZero(startVel.x*(-1)) + "");
Expand Down

0 comments on commit 23ba153

Please sign in to comment.