The Bug:
Players' arms follow the position of sneaking players when preparing to throw tridents.
Judging by the assigned Mojang Priority on MC-190817, players' arms should not follow the position of sneaking players when holding loaded crossbows or fully charged bows. With this in mind, one would expect players' arms to not follow the position of sneaking players when preparing to throw tridents.
Steps to Reproduce:
Obtain a trident, hold it, and prepare to throw it.
Switch to third person and begin sneaking, and as you do this, look at the position of the arm that's used to hold the trident.
Take note as to whether or not players' arms follow the position of sneaking players when preparing to throw tridents.
Observed Behavior:
Players' arms follow the position of sneaking players.
Expected Behavior:
Players' arms would not follow the position of sneaking players.
Code Analysis:
Code analysis by @unknown can be found in this comment.
Linked issues
relates to 1
Attachments
Comments 2
Code Analysis:
The following is based on a decompiled version of Minecraft 1.20.1 using MCP-Reborn.
net.minecraft.client.model.HumanoidModel.java // Original
private void poseRightArm(T p_102876_) {
switch (this.rightArmPose) {
case EMPTY:
this.rightArm.yRot = 0.0F;
break;
case BLOCK:
this.rightArm.xRot = this.rightArm.xRot * 0.5F - 0.9424779F;
this.rightArm.yRot = (-(float) Math.PI / 6 F);
break;
case ITEM:
this.rightArm.xRot = this.rightArm.xRot * 0.5F - ((float) Math.PI / 10F);
this.rightArm.yRot = 0.0 F;
break;
case THROW_SPEAR:
this.rightArm.xRot = this.rightArm.xRot * 0.5F - (float) Math.PI;
this.rightArm.yRot = 0.0 F;
break;
case BOW_AND_ARROW:
this.rightArm.yRot = -0.1F + this.head.yRot;
this.leftArm.yRot = 0.1 F + this.head.yRot + 0.4F;
this.rightArm.xRot = (-(float) Math.PI / 2F) + this.head.xRot;
this.leftArm.xRot = (-(float) Math.PI / 2F) + this.head.xRot;
break;
case CROSSBOW_CHARGE:
AnimationUtils.animateCrossbowCharge(this.rightArm, this.leftArm, p_102876_, true);
break;
case CROSSBOW_HOLD:
AnimationUtils.animateCrossbowHold(this.rightArm, this.leftArm, this.head, true);
break;
case BRUSH:
this.rightArm.xRot = this.rightArm.xRot * 0.5F - ((float) Math.PI / 5F);
this.rightArm.yRot = 0.0F;
break;
case SPYGLASS:
this.rightArm.xRot = Mth.clamp(this.head.xRot - 1.9198622F - (p_102876_.isCrouching() ? 0.2617994 F : 0.0 F), -2.4 F, 3.3 F);
this.rightArm.yRot = this.head.yRot - 0.2617994F;
break;
case TOOT_HORN:
this.rightArm.xRot = Mth.clamp(this.head.xRot, -1.2F, 1.2F) - 1.4835298F;
this.rightArm.yRot = this.head.yRot - ((float) Math.PI / 6F);
}}private void poseLeftArm(T p_102879_) {
switch (this.leftArmPose) {
case EMPTY:
this.leftArm.yRot = 0.0F;
break;
case BLOCK:
this.leftArm.xRot = this.leftArm.xRot * 0.5F - 0.9424779F;
this.leftArm.yRot = ((float) Math.PI / 6 F);
break;
case ITEM:
this.leftArm.xRot = this.leftArm.xRot * 0.5F - ((float) Math.PI / 10F);
this.leftArm.yRot = 0.0F;
break;
case THROW_SPEAR:
this.leftArm.xRot = this.leftArm.xRot * 0.5F - (float) Math.PI;
this.leftArm.yRot = 0.0F;
break;
case BOW_AND_ARROW:
this.rightArm.yRot = -0.1F + this.head.yRot - 0.4F;
this.leftArm.yRot = 0.1 F + this.head.yRot;
this.rightArm.xRot = (-(float) Math.PI / 2 F) + this.head.xRot;
this.leftArm.xRot = (-(float) Math.PI / 2 F) + this.head.xRot;
break;
case CROSSBOW_CHARGE:
AnimationUtils.animateCrossbowCharge(this.rightArm, this.leftArm, p_102879_, false);
break;
case CROSSBOW_HOLD:
AnimationUtils.animateCrossbowHold(this.rightArm, this.leftArm, this.head, false);
break;
case BRUSH:
this.leftArm.xRot = this.leftArm.xRot * 0.5F - ((float) Math.PI / 5F);
this.leftArm.yRot = 0.0F;
break;
case SPYGLASS:
this.leftArm.xRot = Mth.clamp(this.head.xRot - 1.9198622F - (p_102879_.isCrouching() ? 0.2617994F : 0.0 F), -2.4F, 3.3F);
this.leftArm.yRot = this.head.yRot + 0.2617994F;
break;
case TOOT_HORN:
this.leftArm.xRot = Mth.clamp(this.head.xRot, -1.2 F, 1.2F) - 1.4835298F;
this.leftArm.yRot = this.head.yRot + ((float) Math.PI / 6F);
}
}
As seen in this code, we see the enum, THROW_SPEAR. When the switch case reaches that point, we do not see compatibility with crouching as opposed to the SPYGLASS enum.
Fix:
A simple fix is to copy the ternary operator from the SPYGLASS enum to the THROW_SPEAR enum.
Loading up 1.20.1 with MCP-Reborn, the trident's tilt will remain facing up.
net.minecraft.client.model.HumanoidModel.java // Updated
private void poseRightArm(T p_102876_) {
switch (this.rightArmPose) {
case EMPTY:
this.rightArm.yRot = 0.0 F;
break;
case BLOCK:
this.rightArm.xRot = this.rightArm.xRot * 0.5 F - 0.9424779 F;
this.rightArm.yRot = (-(float) Math.PI / 6 F);
break;
case ITEM:
this.rightArm.xRot = this.rightArm.xRot * 0.5 F - ((float) Math.PI / 10 F);
this.rightArm.yRot = 0.0 F;
break;
case THROW_SPEAR:
this.rightArm.xRot = this.rightArm.xRot * 0.5 F - (p_102876_.isCrouching() ? 0.2617994 F : 0.0 F) - (float) Math.PI;
this.rightArm.yRot = 0.0 F;
break;
case BOW_AND_ARROW:
this.rightArm.yRot = -0.1 F + this.head.yRot;
this.leftArm.yRot = 0.1 F + this.head.yRot + 0.4 F;
this.rightArm.xRot = (-(float) Math.PI / 2 F) + this.head.xRot;
this.leftArm.xRot = (-(float) Math.PI / 2 F) + this.head.xRot;
break;
case CROSSBOW_CHARGE:
AnimationUtils.animateCrossbowCharge(this.rightArm, this.leftArm, p_102876_, true);
break;
case CROSSBOW_HOLD:
AnimationUtils.animateCrossbowHold(this.rightArm, this.leftArm, this.head, true);
break;
case BRUSH:
this.rightArm.xRot = this.rightArm.xRot * 0.5 F - ((float) Math.PI / 5 F);
this.rightArm.yRot = 0.0 F;
break;
case SPYGLASS:
this.rightArm.xRot = Mth.clamp(this.head.xRot - 1.9198622 F - (p_102876_.isCrouching() ? 0.2617994 F : 0.0 F), -2.4 F, 3.3 F);
this.rightArm.yRot = this.head.yRot - 0.2617994 F;
break;
case TOOT_HORN:
this.rightArm.xRot = Mth.clamp(this.head.xRot, -1.2 F, 1.2 F) - 1.4835298 F;
this.rightArm.yRot = this.head.yRot - ((float) Math.PI / 6 F);
}}
private void poseLeftArm(T p_102879_) {
switch (this.leftArmPose) {
case EMPTY:
this.leftArm.yRot = 0.0 F;
break;
case BLOCK:
this.leftArm.xRot = this.leftArm.xRot * 0.5 F - 0.9424779 F;
this.leftArm.yRot = ((float) Math.PI / 6 F);
break;
case ITEM:
this.leftArm.xRot = this.leftArm.xRot * 0.5 F - ((float) Math.PI / 10 F);
this.leftArm.yRot = 0.0 F;
break;
case THROW_SPEAR:
this.leftArm.xRot = this.leftArm.xRot * 0.5 F - (p_102879_.isCrouching() ? 0.2617994 F : 0.0 F) - (float) Math.PI;
this.leftArm.yRot = 0.0 F;
break;
case BOW_AND_ARROW:
this.rightArm.yRot = -0.1 F + this.head.yRot - 0.4 F;
this.leftArm.yRot = 0.1 F + this.head.yRot;
this.rightArm.xRot = (-(float) Math.PI / 2 F) + this.head.xRot;
this.leftArm.xRot = (-(float) Math.PI / 2 F) + this.head.xRot;
break;
case CROSSBOW_CHARGE:
AnimationUtils.animateCrossbowCharge(this.rightArm, this.leftArm, p_102879_, false);
break;
case CROSSBOW_HOLD:
AnimationUtils.animateCrossbowHold(this.rightArm, this.leftArm, this.head, false);
break;
case BRUSH:
this.leftArm.xRot = this.leftArm.xRot * 0.5 F - ((float) Math.PI / 5 F);
this.leftArm.yRot = 0.0 F;
break;
case SPYGLASS:
this.leftArm.xRot = Mth.clamp(this.head.xRot - 1.9198622 F - (p_102879_.isCrouching() ? 0.2617994 F : 0.0 F), -2.4 F, 3.3 F);
this.leftArm.yRot = this.head.yRot + 0.2617994 F;
break;
case TOOT_HORN:
this.leftArm.xRot = Mth.clamp(this.head.xRot, -1.2 F, 1.2 F) - 1.4835298 F;
this.leftArm.yRot = this.head.yRot + ((float) Math.PI / 6 F);
}
}
Relates to MC-190817 and MC-264135.