1+ package net .aspw .viaforgeplus .injection .forge .mixins .render ;
2+
3+ import net .aspw .viaforgeplus .api .McUpdatesHandler ;
4+ import net .aspw .viaforgeplus .api .ProtocolFixer ;
5+ import net .aspw .viaforgeplus .network .MinecraftInstance ;
6+ import net .minecraft .client .model .ModelBiped ;
7+ import net .minecraft .client .model .ModelRenderer ;
8+ import net .minecraft .client .renderer .GlStateManager ;
9+ import net .minecraft .entity .Entity ;
10+ import net .minecraft .entity .player .EntityPlayer ;
11+ import org .spongepowered .asm .mixin .Mixin ;
12+ import org .spongepowered .asm .mixin .Shadow ;
13+ import org .spongepowered .asm .mixin .injection .At ;
14+ import org .spongepowered .asm .mixin .injection .Inject ;
15+ import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
16+
17+ @ Mixin (ModelBiped .class )
18+ public abstract class MixinModelBiped {
19+
20+ @ Shadow
21+ public ModelRenderer bipedRightArm ;
22+
23+ @ Shadow
24+ public ModelRenderer bipedLeftArm ;
25+
26+ @ Shadow
27+ public boolean isSneak ;
28+
29+ @ Shadow
30+ public ModelRenderer bipedHead ;
31+
32+ @ Shadow
33+ public ModelRenderer bipedHeadwear ;
34+
35+ @ Inject (method = "setRotationAngles" , at = @ At (value = "FIELD" , target = "Lnet/minecraft/client/model/ModelBiped;swingProgress:F" ))
36+ private void revertSwordAnimation (float p_setRotationAngles1 , float p_setRotationAngles2 , float p_setRotationAngles3 , float p_setRotationAngles4 , float p_setRotationAngles5 , float p_setRotationAngles6 , Entity p_setRotationAngles7 , CallbackInfo callbackInfo ) {
37+ if (ProtocolFixer .newerThanOrEqualsTo1_13 () && McUpdatesHandler .shouldAnimation () && p_setRotationAngles7 instanceof EntityPlayer && p_setRotationAngles7 .equals (MinecraftInstance .mc .thePlayer )) {
38+ GlStateManager .rotate (45.0F , 1F , 0.0F , 0.0F );
39+ GlStateManager .translate (0.0F , 0.0F , -0.7F );
40+
41+ float swing = MinecraftInstance .mc .thePlayer .limbSwing / 3 ;
42+
43+ this .bipedHead .rotateAngleX = -0.95f ;
44+ this .bipedHeadwear .rotateAngleX = -0.95f ;
45+ this .bipedLeftArm .rotateAngleX = swing ;
46+ this .bipedRightArm .rotateAngleX = swing ;
47+ this .bipedLeftArm .rotateAngleY = swing ;
48+ this .bipedRightArm .rotateAngleY = -swing ;
49+ this .isSneak = false ;
50+ }
51+ }
52+ }
0 commit comments