From edbd40c9708237881ca2ac548abd54d31a27c437 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Fri, 19 Jan 2024 20:15:35 +0600 Subject: [PATCH] (feature) shaking intensity --- .../client/mixin/mixins/EntityRendererMixin.java | 10 ++++++++++ .../silentclient/client/mods/render/AnimationsMod.java | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/silentclient/client/mixin/mixins/EntityRendererMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/EntityRendererMixin.java index a796b3f..554555e 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/EntityRendererMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/EntityRendererMixin.java @@ -155,6 +155,16 @@ public abstract class EntityRendererMixin implements EntityRendererExt { } } + @Redirect(method = "hurtCameraEffect", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;rotate(FFFF)V", ordinal = 2)) + public void changeIntensity(float angle, float x, float y, float z) { + if(!Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() || Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "No Shaking").getValBoolean()) { + GlStateManager.rotate(angle, x, y, z); + return; + } + float intensity = Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "Shaking Intensity").getValFloat(); + GlStateManager.rotate(angle * (intensity / 14), x, y, z); + } + @Redirect(method = "setupCameraTransform", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/EntityRenderer;setupViewBobbing(F)V")) public void modelBobbing(EntityRenderer instance, float f) { if(!Client.getInstance().getSettingsManager().getSettingByClass(RenderMod.class, "Model Bobbing Only").getValBoolean()) { diff --git a/src/main/java/net/silentclient/client/mods/render/AnimationsMod.java b/src/main/java/net/silentclient/client/mods/render/AnimationsMod.java index 613b39b..6e8320f 100644 --- a/src/main/java/net/silentclient/client/mods/render/AnimationsMod.java +++ b/src/main/java/net/silentclient/client/mods/render/AnimationsMod.java @@ -20,8 +20,9 @@ public class AnimationsMod extends Mod { this.addBooleanSetting("1.7 Throwing", this, true); this.addBooleanSetting("1.7 Enchant Glint", this, true); this.addBooleanSetting("1.7 Skins", this, false); - this.addBooleanSetting("Smooth Sneaking", this, true); this.addBooleanSetting("No Shaking", this, true); + this.addSliderSetting("Shaking Intensity", this, 14, 0, 100, true); + this.addBooleanSetting("Smooth Sneaking", this, true); this.addBooleanSetting("Consume Animation", this, true); this.addBooleanSetting("Block-Hitting Animation", this, true); this.addBooleanSetting("Red Armor", this, true);