From 775939db91071d1dfed46e2dc90f539dad4afcc0 Mon Sep 17 00:00:00 2001 From: Wide-Cat Date: Mon, 21 Aug 2023 17:35:39 +0100 Subject: [PATCH] add option to hand view to disable the eating animation --- .../mixin/HeldItemRendererMixin.java | 9 ++++ .../systems/modules/render/HandView.java | 41 ++++++++++++------- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java index e6f21a619f..72748fa436 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java @@ -16,9 +16,11 @@ import net.minecraft.client.render.item.HeldItemRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; +import net.minecraft.util.Arm; import net.minecraft.util.Hand; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -83,6 +85,13 @@ private void onRenderArm(AbstractClientPlayerEntity player, float tickDelta, flo MeteorClient.EVENT_BUS.post(ArmRenderEvent.get(hand, matrices)); } + @Inject(method = "applyEatOrDrinkTransformation", at = @At(value = "INVOKE", target = "Ljava/lang/Math;pow(DD)D", shift = At.Shift.BEFORE), cancellable = true) + private void cancelTransformations(MatrixStack matrices, float tickDelta, Arm arm, ItemStack stack, CallbackInfo ci) { + if (Modules.get().get(HandView.class).disableFoodAnimation()) ci.cancel(); + } + + + @Unique private boolean showSwapping(ItemStack stack1, ItemStack stack2) { return !Modules.get().get(HandView.class).showSwapping() || ItemStack.areEqual(stack1, stack2); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/HandView.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/HandView.java index 9aa25519a4..fd718dec4d 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/HandView.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/HandView.java @@ -32,6 +32,27 @@ public class HandView extends Module { .build() ); + public final Setting oldAnimations = sgGeneral.add(new BoolSetting.Builder() + .name("old-animations") + .description("Changes hit animations to those like 1.8") + .defaultValue(false) + .build() + ); + + public final Setting showSwapping = sgGeneral.add(new BoolSetting.Builder() + .name("show-swapping") + .description("Whether or not to show the item swapping animation") + .defaultValue(true) + .build() + ); + + private final Setting disableFoodAnimation = sgGeneral.add(new BoolSetting.Builder() + .name("disable-eating-animation") + .description("Disables the eating animation. Potentially desirable if it goes offscreen.") + .defaultValue(false) + .build() + ); + public final Setting swingMode = sgGeneral.add(new EnumSetting.Builder() .name("swing-mode") .description("Modifies your client & server hand swinging.") @@ -66,20 +87,6 @@ public class HandView extends Module { .build() ); - public final Setting oldAnimations = sgGeneral.add(new BoolSetting.Builder() - .name("old-animations") - .description("Changes hit animations to those like 1.8") - .defaultValue(false) - .build() - ); - - public final Setting showSwapping = sgGeneral.add(new BoolSetting.Builder() - .name("show-swapping") - .description("Whether or not to show the item swapping animation") - .defaultValue(true) - .build() - ); - // Main Hand private final Setting scaleMain = sgMainHand.add(new Vector3dSetting.Builder() @@ -109,7 +116,7 @@ public class HandView extends Module { .build() ); - // Off Hand + // Offhand private final Setting scaleOff = sgOffHand.add(new Vector3dSetting.Builder() .name("scale") @@ -220,6 +227,10 @@ public boolean showSwapping() { return isActive() && showSwapping.get(); } + public boolean disableFoodAnimation() { + return isActive() && disableFoodAnimation.get(); + } + public enum SwingMode { Offhand, Mainhand,