asiangbt

I want you to change a current mod i have .

Its a sword to knife mod . Instead of a basic knife i want it to be a butterfly knife . I want a custom swing animation, i want it to swing like its stabbing someone and a slashy sound when used . Also make sure all sword rarities and enchanted swords have this

Kodari AI
KodariToday at 11:03 am 1
ButterflyKnifeSword
A Fabric mod for Minecraft 1.21.1 that transforms all swords into butterfly knives. Features a custom stabbing swing animation replacing the default sword swing, a distinct slashy sound effect on every use, and full compatibility across all sword rarities and enchantments. The mod overrides the sword's attack behavior to trigger the unique animation and audio, maintaining vanilla damage values while enhancing the visual and auditory experience. Works seamlessly with enchanted swords, preserving all enchantment effects while applying the butterfly knife aesthetic and combat feel.

Upload the existing mod’s source project so I can replace its knife with a butterfly knife and add the stabbing animation and slash sound.

Should the new look and animation apply to every sword tier, including enchanted swords?

asiangbt

I added it to the project

Kodari AI
KodariToday at 11:05 am 1

The project contains Sword To Knife.jar, but not its source code. Please upload the mod’s source project so I can change its swing animation and add the slash sound.

The JAR includes textures for all six vanilla sword tiers; I’ll make sure enchanted swords retain their enchantment glint too.

asiangbt

So to confirm make all sword variants and enchanted to a butterfly knife . Use the information i said above to make it

Kodari AI
KodariToday at 11:07 am 1

Yes: all six vanilla sword tiers, including enchanted swords, should look like butterfly knives and use the stabbing swing and slash sound. Enchanted swords will retain their glint.

The project currently contains only the compiled JAR, not its source. Upload the source project so I can modify the existing mod, or tell me to rebuild it as a replacement.

asiangbt

Just make a brand new one . Using the same as what i said

Kodari AI
KodariToday at 11:14 am 17

I’ll build this as a client-side replacement: all six vanilla sword tiers will use butterfly-knife textures, retain enchantment glint, and get a stabbing swing and slash sound.

Built a client-side replacement for all six vanilla sword tiers, including enchanted swords. It uses a first-person stabbing swing and a slash sound; swords remain obtainable through their normal survival recipes and retain enchantment glint.

Texture limitation: Credits ran out after three textures, so gold, diamond, and netherite currently share the iron butterfly-knife appearance.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Sword To Knife.jar
Code
15 157
src/client/java/dev/kodari/butterflyknives/mixin/HeldItemRendererMixin.java
package dev.kodari.butterflyknives.mixin;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.sugar.Local;
import dev.kodari.butterflyknives.VanillaSwords;
import net.minecraft.client.render.item.HeldItemRenderer;
import net.minecraft.component.type.SwingAnimationComponent;
import net.minecraft.item.ItemStack;
import net.minecraft.util.SwingAnimationType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(HeldItemRenderer.class)
public abstract class HeldItemRendererMixin {
    @ModifyExpressionValue(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getSwingAnimation()Lnet/minecraft/component/type/SwingAnimationComponent;"))
    private SwingAnimationComponent butterfly_knives$stab(SwingAnimationComponent original, @Local(argsOnly = true) ItemStack stack) {
        return VanillaSwords.contains(stack)
                ? new SwingAnimationComponent(SwingAnimationType.STAB, original.duration())
                : original;
    }
}