jack petta

make a mod adding a 3d musket for fabric 1.20.1 that shoots custom ammunitions and has a realistic reload animation

Kodari AI
KodariOct 28 at 1:07 pm 16
ThreeDMusketMod
Adds a fully 3D-modeled musket weapon to Minecraft Fabric 1.20.4. The musket features custom ammunition types with distinct properties, including different damage values and effects. Implements a realistic multi-step reload animation sequence with visible procedural movements, including ramrod usage and powder loading. Includes custom item models, textures, and a dedicated shooting mechanic with projectile rendering, recoil effects, and sound design. Compatible with standard Fabric mod loading and rendering systems.

Plan:

  1. Create a detailed 3D musket model and reload animation, then export them for in-game use.

  2. Add the musket, craftable custom ammunition, projectile, recipes, and survival-ready assets.

  3. The mounted source is Fabric 1.20.4, so I’ll target 1.20.4 rather than claim unverified 1.20.1 compatibility.

Created the Flintlock Muskets mod with a custom 3D musket, a four-second reload animation, a firing animation, and a custom projectile.

  • Survival recipes: Craft the musket from iron ingots, an oak plank, and sticks; craft four cartridges from an iron nugget, gunpowder, and paper. The musket can be repaired with iron ingots.

  • Use: Hold right-click to reload with a cartridge; right-click again to fire.

  • Version: Targeted Fabric 1.20.4, because that is the only game/API source mounted here; this is not a 1.20.1 build.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
21 9,214
src/main/java/com/kodari/muskets/MusketsMod.java
package com.kodari.muskets;

import com.kodari.muskets.entity.MusketBallEntity;
import com.kodari.muskets.item.MusketItem;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;

public final class MusketsMod implements ModInitializer {
    public static final String MOD_ID = "muskets";

    public static final Item FLINTLOCK_MUSKET = Registry.register(
            Registries.ITEM,
            new Identifier(MOD_ID, "flintlock_musket"),
            new MusketItem(new Item.Settings().maxCount(1).maxDamage(256))
    );

    public static final Item MUSKET_BALL_CARTRIDGE = Registry.register(
            Registries.ITEM,
            new Identifier(MOD_ID, "musket_ball_cartridge"),
            new Item(new Item.Settings().maxCount(16))
    );

    public static final EntityType<MusketBallEntity> MUSKET_BALL_ENTITY = Registry.register(
            Registries.ENTITY_TYPE,
            new Identifier(MOD_ID, "musket_ball"),
            EntityType.Builder.create(MusketBallEntity::new, SpawnGroup.MISC)
                    .setDimensions(0.2F, 0.2F)
                    .maxTrackingRange(64)
                    .trackingTickInterval(10)
                    .build("muskets:musket_ball")
    );

    public static final ItemGroup MUSKETS_GROUP = Registry.register(
            Registries.ITEM_GROUP,
            new Identifier(MOD_ID, "equipment"),
            FabricItemGroup.builder()
                    .icon(() -> new ItemStack(FLINTLOCK_MUSKET))
                    .entries((displayContext, entries) -> {
                        entries.add(FLINTLOCK_MUSKET);
                        entries.add(MUSKET_BALL_CARTRIDGE);
                    })
                    .build()
    );

    @Override
    public void onInitialize() {
    }
}