Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ public class HandView extends Module {
.defaultValue(SwingMode.None)
.build()
);

public final Setting<Boolean> 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<Integer> swingSpeed = sgGeneral.add(new IntSetting.Builder()
.name("swing-speed")
Expand Down Expand Up @@ -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,
Expand Down
Loading