From 88111e6f7e189574e5936eed25c26d25e5e79ee0 Mon Sep 17 00:00:00 2001 From: Axionize <154778082+Axionize@users.noreply.github.com> Date: Sun, 22 Sep 2024 17:17:25 -0400 Subject: [PATCH] make getPossibleEyeHeights return most likely heights --- .../ac/grim/grimac/player/GrimPlayer.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/main/java/ac/grim/grimac/player/GrimPlayer.java b/src/main/java/ac/grim/grimac/player/GrimPlayer.java index f961fff3bb..64211e8b3c 100644 --- a/src/main/java/ac/grim/grimac/player/GrimPlayer.java +++ b/src/main/java/ac/grim/grimac/player/GrimPlayer.java @@ -555,13 +555,29 @@ public CompensatedInventory getInventory() { } public double[] getPossibleEyeHeights() { // We don't return sleeping eye height - if (getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) { // standing, sneaking (1.14), Elytra + if (getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) { final float scale = (float) compensatedEntities.getSelf().getAttributeValue(Attributes.GENERIC_SCALE); - return new double[]{1.62 * scale, 1.27 * scale, 0.4 * scale}; + if (this.isGliding || this.isSwimming) { + return new double[]{0.4 * scale, 1.62 * scale, 1.27 * scale}; // Elytra, standing, sneaking (1.14) + } else if (this.isSneaking) { + return new double[]{1.27 * scale, 1.62 * scale, 0.4 * scale}; // sneaking (1.14), standing, Elytra + } else { + return new double[]{1.62 * scale, 1.27 * scale, 0.4 * scale}; // standing, sneaking (1.14), Elytra + } } else if (getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)) { // standing, sneaking Elytra - return new double[]{1.62, 1.54, 0.4}; + if (this.isGliding || this.isSwimming) { + return new double[]{0.4, 1.62, 1.54}; // Elytra, standing, sneaking (1.14) + } else if (this.isSneaking) { + return new double[]{1.54, 1.62, 0.4}; // sneaking (1.14), standing, Elytra + } else { + return new double[]{1.62, 1.54, 0.4}; // standing, sneaking (1.14), Elytra + } } else { // Only standing or sneaking - return new double[]{(double) (1.62f), (double) (1.62f - 0.08f)}; + if (this.isSneaking) { + return new double[]{(double) (1.62f - 0.08f), (double) (1.62f)}; + } else { + return new double[]{(double) (1.62f), (double) (1.62f - 0.08f)}; + } } }