diff --git a/src/main/java/ac/grim/grimac/player/GrimPlayer.java b/src/main/java/ac/grim/grimac/player/GrimPlayer.java index 22ea198aa7..81b83de3e1 100644 --- a/src/main/java/ac/grim/grimac/player/GrimPlayer.java +++ b/src/main/java/ac/grim/grimac/player/GrimPlayer.java @@ -572,15 +572,22 @@ public CompensatedInventory getInventory() { } public double[] getPossibleEyeHeights() { // We don't return sleeping eye height - switch (pose) { - case SWIMMING: // Swimming (includes crawling in 1.14+) - case FALL_FLYING: // Elytra gliding - case SPIN_ATTACK: // Riptide trident - return this.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) ? possibleEyeHeights[2] : this.isSneaking ? possibleEyeHeights[1] : possibleEyeHeights[0]; - case CROUCHING: - return possibleEyeHeights[1]; - default: - return possibleEyeHeights[0]; + // 1.8 Players once again ruin my clean switch-case + if (this.getClientVersion().isOlderThan(ClientVersion.V_1_9)) { + return this.isSneaking ? this.possibleEyeHeights[1] : this.possibleEyeHeights[0]; + } else { + // 1.8 players just have their pose set to standing all the time + switch (pose) { + case FALL_FLYING: // Elytra gliding + case SPIN_ATTACK: // Riptide trident + case SWIMMING: // Swimming (includes crawling in 1.14+) + return this.possibleEyeHeights[2]; + case NINE_CROUCHING: + case CROUCHING: + return this.possibleEyeHeights[1]; + default: + return this.possibleEyeHeights[0]; + } } } diff --git a/src/main/java/ac/grim/grimac/utils/data/packetentity/PacketEntitySelf.java b/src/main/java/ac/grim/grimac/utils/data/packetentity/PacketEntitySelf.java index 0108b0890c..2c9c621f59 100644 --- a/src/main/java/ac/grim/grimac/utils/data/packetentity/PacketEntitySelf.java +++ b/src/main/java/ac/grim/grimac/utils/data/packetentity/PacketEntitySelf.java @@ -54,22 +54,23 @@ protected void initAttributes(GrimPlayer player) { return getAttribute(Attributes.GENERIC_SCALE).get().getDefaultValue(); } else if ((newValue).equals(oldValue)) { return oldValue; + } else { + // Elytra, standing, sneaking (1.14) + player.possibleEyeHeights[2][0] = 0.4 * newValue; + player.possibleEyeHeights[2][1] = 1.62 * newValue; + player.possibleEyeHeights[2][2] = 1.27 * newValue; + + // sneaking (1.14), standing, Elytra + player.possibleEyeHeights[1][0] = 1.27 * newValue; + player.possibleEyeHeights[1][1] = 1.62 * newValue; + player.possibleEyeHeights[1][2] = 0.4 * newValue; + + // standing, sneaking (1.14), Elytra + player.possibleEyeHeights[0][0] = 1.62 * newValue; + player.possibleEyeHeights[0][1] = 1.27 * newValue; + player.possibleEyeHeights[0][2] = 0.4 * newValue; + return newValue; } - // Elytra, standing, sneaking (1.14) - player.possibleEyeHeights[2][0] = 0.4 * newValue; - player.possibleEyeHeights[2][1] = 1.62 * newValue; - player.possibleEyeHeights[2][2] = 1.27 * newValue; - - // sneaking (1.14), standing, Elytra - player.possibleEyeHeights[1][0] = 1.27 * newValue; - player.possibleEyeHeights[1][1] = 1.62 * newValue; - player.possibleEyeHeights[1][2] = 0.4 * newValue; - - // standing, sneaking (1.14), Elytra - player.possibleEyeHeights[0][0] = 1.62 * newValue; - player.possibleEyeHeights[0][1] = 1.27 * newValue; - player.possibleEyeHeights[0][2] = 0.4 * newValue; - return newValue; }); final ValuedAttribute movementSpeed = ValuedAttribute.ranged(Attributes.GENERIC_MOVEMENT_SPEED, 0.1f, 0, 1024);