Skip to content

Commit

Permalink
Fix intializing array
Browse files Browse the repository at this point in the history
  • Loading branch information
Axionize committed Sep 24, 2024
1 parent 94e5f63 commit 7695167
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions src/main/java/ac/grim/grimac/player/GrimPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,27 +245,17 @@ public GrimPlayer(User user) {

if (getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) {
final float scale = (float) compensatedEntities.getSelf().getAttributeValue(Attributes.GENERIC_SCALE);
if (this.isGliding || this.isSwimming) {
possibleEyeHeights[2] = new double[]{0.4 * scale, 1.62 * scale, 1.27 * scale}; // Elytra, standing, sneaking (1.14)
} else if (this.isSneaking) {
possibleEyeHeights[1] = new double[]{1.27 * scale, 1.62 * scale, 0.4 * scale}; // sneaking (1.14), standing, Elytra
} else {
possibleEyeHeights[0] = new double[]{1.62 * scale, 1.27 * scale, 0.4 * scale}; // standing, sneaking (1.14), Elytra
}
possibleEyeHeights[2] = new double[]{0.4 * scale, 1.62 * scale, 1.27 * scale}; // Elytra, standing, sneaking (1.14)
possibleEyeHeights[1] = new double[]{1.27 * scale, 1.62 * scale, 0.4 * scale}; // sneaking (1.14), standing, Elytra
possibleEyeHeights[0] = new double[]{1.62 * scale, 1.27 * scale, 0.4 * scale}; // standing, sneaking (1.14), Elytragit status

} else if (getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)) { // standing, sneaking Elytra
if (this.isGliding || this.isSwimming) {
possibleEyeHeights[2] = new double[]{0.4, 1.62, 1.54}; // Elytra, standing, sneaking (1.14)
} else if (this.isSneaking) {
possibleEyeHeights[1] = new double[]{1.54, 1.62, 0.4}; // sneaking (1.14), standing, Elytra
} else {
possibleEyeHeights[0] = new double[]{1.62, 1.54, 0.4}; // standing, sneaking (1.14), Elytra
}
possibleEyeHeights[2] = new double[]{0.4, 1.62, 1.54}; // Elytra, standing, sneaking (1.14)
possibleEyeHeights[1] = new double[]{1.54, 1.62, 0.4}; // sneaking (1.14), standing, Elytra
possibleEyeHeights[0] = new double[]{1.62, 1.54, 0.4}; // standing, sneaking (1.14), Elytra
} else { // Only standing or sneaking
if (this.isSneaking) {
possibleEyeHeights[1] = new double[]{(double) (1.62f - 0.08f), (double) (1.62f)};
} else {
possibleEyeHeights[0] = new double[]{(double) (1.62f), (double) (1.62f - 0.08f)};
}
possibleEyeHeights[1] = new double[]{(double) (1.62f - 0.08f), (double) (1.62f)};
possibleEyeHeights[0] = new double[]{(double) (1.62f), (double) (1.62f - 0.08f)};
}
}

Expand Down Expand Up @@ -582,7 +572,7 @@ public CompensatedInventory getInventory() {
}

public double[] getPossibleEyeHeights() { // We don't return sleeping eye height
if (getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) && this.isGliding || this.isSwimming) {
if (getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) && this.isGliding || this.isSwimming || this.isRiptidePose) {
return possibleEyeHeights[2];
}
return this.isSneaking ? possibleEyeHeights[1] : possibleEyeHeights[0];
Expand Down

0 comments on commit 7695167

Please sign in to comment.