Adrenix / Nostalgic-Tweaks

This mod brings back a plethora of Minecraft Alpha/Beta gameplay elements. This mod is intended for nostalgic enthusiasts who want to relive the glory days of Minecraft by tweaking the mod to their preference.
GNU Lesser General Public License v3.0
97 stars 15 forks source link

[FABRIC] Classic Attack Swing is missing its rotation #81

Open coyo-t opened 3 months ago

coyo-t commented 3 months ago

Version Information

Minecraft Version: 1.20.1 Nostalgic Tweaks Version: beta.902

https://github.com/user-attachments/assets/e35cec22-2be7-41a2-84ed-7533b2af3e43

https://github.com/user-attachments/assets/5992dbc1-53ca-4c6f-9cb9-c2164b7de1d4

the classic inview model is animated as such:

// punch position
if (attacking)
{
    var atk = (attackTime + tfac) / 7;
    var sqr = Mth.sqrt(atk);
    glTranslatef(
        sin(sqr * PI)  * -0.4f,
        sin(sqr * TAU) * +0.2f,
        sin(atk * PI)  * -0.2f
    );
}

// positioning (and draw/holster postiong)
float holster = oDrawTime + (drawTime - oDrawTime) * tfac;
glTranslatef(
    0.7f * 0.8f,
    -0.65f * 0.8f - (1f - holster) * 0.6f,
    -0.9f * 0.8f
);
glRotatef(45, 0, 1, 0);

// punch rotation
if (attacking)
{
    var atk = (attackTime + tfac) / 7;
    glRotatef(+sin(Mth.sqrt(atk) * PI) * 80, 0, 1, 0);
    glRotatef(-sin(atk * atk * PI) * 20, 1, 0, 0);
}
Adrenix commented 3 months ago

Thank you for the detailed post and videos!