From 4d4ffbc81c0fc7957693954ccf47c42e8928cbd5 Mon Sep 17 00:00:00 2001 From: xvrrv Date: Mon, 6 Apr 2026 04:32:58 -0300 Subject: [PATCH 1/3] Add Sword Slash --- .../meteorclient/systems/modules/render/HandView.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 214054d993..57d47abd7d 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/HandView.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/HandView.java @@ -59,6 +59,13 @@ public class HandView extends Module { .defaultValue(SwingMode.None) .build() ); + + public final Setting swordSlash = sgGeneral.add(new BoolSetting.Builder() + .name("sword-slash") + .description("Replaces the sword swing animation with the offhand idle animation.") + .defaultValue(false) + .build() + ); public final Setting swingSpeed = sgGeneral.add(new IntSetting.Builder() .name("swing-speed") @@ -230,6 +237,10 @@ public boolean skipSwapping() { public boolean disableFoodAnimation() { return isActive() && disableFoodAnimation.get(); } + + public boolean swordSlash() { + return isActive() && swordSlash.get(); + } public enum SwingMode { Offhand, From a4eefcf2fb132edc5607a1d7c0f6be3a4c364412 Mon Sep 17 00:00:00 2001 From: xvrrv Date: Mon, 6 Apr 2026 04:35:58 -0300 Subject: [PATCH 2/3] Sword Slash check --- .../meteorclient/mixin/HeldItemRendererMixin.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java index 094cf3033d..d6132b709e 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java @@ -20,6 +20,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.Arm; import net.minecraft.util.Hand; +import net.minecraft.registry.tag.ItemTags; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -53,6 +54,9 @@ private float modifySwing(float swingProgress) { Hand hand = MoreObjects.firstNonNull(mc.player.preferredHand, Hand.MAIN_HAND); if (module.isActive()) { + if (module.swordSlash() && hand == Hand.MAIN_HAND && mc.player.getMainHandStack().isIn(ItemTags.SWORDS)) { + return 0f; + } if (hand == Hand.OFF_HAND && !mc.player.getOffHandStack().isEmpty()) { return swingProgress + module.offSwing.get().floatValue(); } @@ -63,7 +67,6 @@ private float modifySwing(float swingProgress) { return swingProgress; } - @ModifyReturnValue(method = "shouldSkipHandAnimationOnSwap", at = @At("RETURN")) private boolean modifySkipSwapAnimation(boolean original) { return original || Modules.get().get(HandView.class).skipSwapping(); From cda3ac1a98fd0085f8c24395edf25e86543a6867 Mon Sep 17 00:00:00 2001 From: Wide_Cat Date: Thu, 9 Apr 2026 20:01:31 +0100 Subject: [PATCH 3/3] Bugfix with the old animations setting and update old code --- .../mixin/HeldItemRendererMixin.java | 23 +++++++++++-------- .../meteorclient/mixin/LivingEntityMixin.java | 3 ++- .../systems/modules/render/HandView.java | 16 ++++++------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java index d6132b709e..185c6cff59 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java @@ -5,7 +5,7 @@ package meteordevelopment.meteorclient.mixin; -import com.google.common.base.MoreObjects; +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.injector.ModifyReturnValue; import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.events.render.ArmRenderEvent; @@ -18,17 +18,18 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.registry.tag.ItemTags; import net.minecraft.util.Arm; import net.minecraft.util.Hand; -import net.minecraft.registry.tag.ItemTags; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyArg; -import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import java.util.Objects; + import static meteordevelopment.meteorclient.MeteorClient.mc; @Mixin(HeldItemRenderer.class) @@ -48,25 +49,26 @@ public abstract class HeldItemRendererMixin { @Shadow protected abstract boolean shouldSkipHandAnimationOnSwap(ItemStack from, ItemStack to); - @ModifyVariable(method = "renderItem(FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/command/OrderedRenderCommandQueue;Lnet/minecraft/client/network/ClientPlayerEntity;I)V", at = @At(value = "STORE", ordinal = 0), index = 6) + @ModifyExpressionValue(method = "renderItem(FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/command/OrderedRenderCommandQueue;Lnet/minecraft/client/network/ClientPlayerEntity;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getHandSwingProgress(F)F")) private float modifySwing(float swingProgress) { HandView module = Modules.get().get(HandView.class); - Hand hand = MoreObjects.firstNonNull(mc.player.preferredHand, Hand.MAIN_HAND); + Hand hand = Objects.requireNonNullElse(mc.player.preferredHand, Hand.MAIN_HAND); if (module.isActive()) { - if (module.swordSlash() && hand == Hand.MAIN_HAND && mc.player.getMainHandStack().isIn(ItemTags.SWORDS)) { + if (module.swordSlash() && hand == Hand.MAIN_HAND && mainHand.isIn(ItemTags.SWORDS)) { return 0f; } - if (hand == Hand.OFF_HAND && !mc.player.getOffHandStack().isEmpty()) { + if (hand == Hand.OFF_HAND && !offHand.isEmpty()) { return swingProgress + module.offSwing.get().floatValue(); } - if (hand == Hand.MAIN_HAND && !mc.player.getMainHandStack().isEmpty()) { + if (hand == Hand.MAIN_HAND && !mainHand.isEmpty()) { return swingProgress + module.mainSwing.get().floatValue(); } } return swingProgress; } + @ModifyReturnValue(method = "shouldSkipHandAnimationOnSwap", at = @At("RETURN")) private boolean modifySkipSwapAnimation(boolean original) { return original || Modules.get().get(HandView.class).skipSwapping(); @@ -74,8 +76,11 @@ private boolean modifySkipSwapAnimation(boolean original) { @ModifyArg(method = "updateHeldItems", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;clamp(FFF)F", ordinal = 2), index = 0) private float modifyEquipProgressMainhand(float value) { + HandView handView = Modules.get().get(HandView.class); + if (handView.swordSlash() && mc.player.getMainHandStack().isIn(ItemTags.SWORDS)) return value; + float f = mc.player.getHandEquippingProgress(1f); - float modified = Modules.get().get(HandView.class).oldAnimations() ? 1 : f * f * f; + float modified = handView.oldAnimations() ? 1 : f * f * f; return (shouldSkipHandAnimationOnSwap(mainHand, mc.player.getMainHandStack()) ? modified : 0) - equipProgressMainHand; } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java index 892a8f9924..2e30685d6f 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java @@ -67,7 +67,7 @@ private void onEquipStack(EquipmentSlot slot, ItemStack oldStack, ItemStack newS } } - @ModifyArg(method = "swingHand(Lnet/minecraft/util/Hand;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;swingHand(Lnet/minecraft/util/Hand;Z)V")) + @ModifyVariable(method = "swingHand(Lnet/minecraft/util/Hand;Z)V", at = @At("HEAD"), argsOnly = true) private Hand setHand(Hand hand) { if ((Object) this != mc.player) return hand; @@ -76,6 +76,7 @@ private Hand setHand(Hand hand) { if (handView.swingMode.get() == HandView.SwingMode.None) return hand; return handView.swingMode.get() == HandView.SwingMode.Offhand ? Hand.OFF_HAND : Hand.MAIN_HAND; } + return hand; } 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 57d47abd7d..13cabdeba4 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/HandView.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/HandView.java @@ -53,19 +53,19 @@ public class HandView extends Module { .build() ); + public final Setting swordSlash = sgGeneral.add(new BoolSetting.Builder() + .name("sword-slash") + .description("Replaces the sword swing animation with the offhand idle animation.") + .defaultValue(false) + .build() + ); + public final Setting swingMode = sgGeneral.add(new EnumSetting.Builder() .name("swing-mode") .description("Modifies your client & server hand swinging.") .defaultValue(SwingMode.None) .build() ); - - public final Setting swordSlash = sgGeneral.add(new BoolSetting.Builder() - .name("sword-slash") - .description("Replaces the sword swing animation with the offhand idle animation.") - .defaultValue(false) - .build() - ); public final Setting swingSpeed = sgGeneral.add(new IntSetting.Builder() .name("swing-speed") @@ -237,7 +237,7 @@ public boolean skipSwapping() { public boolean disableFoodAnimation() { return isActive() && disableFoodAnimation.get(); } - + public boolean swordSlash() { return isActive() && swordSlash.get(); }