Skip to content

Commit 8652ae7

Browse files
committed
fix
1 parent 79f9957 commit 8652ae7

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-1
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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.renderer.entity.layers.LayerArmorBase;
7+
import net.minecraft.entity.EntityLivingBase;
8+
import org.spongepowered.asm.mixin.Mixin;
9+
import org.spongepowered.asm.mixin.injection.At;
10+
import org.spongepowered.asm.mixin.injection.Inject;
11+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
12+
13+
@Mixin({LayerArmorBase.class})
14+
public class MixinLayerArmorBase {
15+
@Inject(method = {"doRenderLayer"}, at = {@At("HEAD")}, cancellable = true)
16+
public void doRenderLayer(final EntityLivingBase entitylivingbaseIn, final float limbSwing, final float limbSwingAmount, final float partialTicks, final float ageInTicks, final float netHeadYaw, final float headPitch, final float scale, final CallbackInfo ci) {
17+
if (ProtocolFixer.newerThanOrEqualsTo1_13() && McUpdatesHandler.shouldAnimation() && entitylivingbaseIn == MinecraftInstance.mc.thePlayer)
18+
ci.cancel();
19+
}
20+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
}

src/main/resources/viaforgeplus.forge.mixins.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"network.MixinNetworkManager",
2121
"network.MixinNetworkManager$5",
2222
"network.MixinServerData",
23-
"packets.MixinC00Handshake"
23+
"packets.MixinC00Handshake",
24+
"render.MixinLayerArmorBase",
25+
"render.MixinModelBiped"
2426
]
2527
}

0 commit comments

Comments
 (0)