Quick start

Add a melee weapon with VFX to your mod in under a minute.

1. Add the dependency

repositories {
    mavenCentral()
}

dependencies {
    modImplementation "com.spardamc:armaria:0.1.0"
    modImplementation "net.fabricmc.fabric-api:fabric-api:0.163.0+26.3"
}

2. Create a weapon class

package com.example.weapons;

import com.spardamc.armaria.api.ArmariaMeleeWeapon;
import com.spardamc.armaria.api.Texture2D;
import com.spardamc.armaria.vfx.api.VFXPresets;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.InteractionHand;

public class Stormcaller extends ArmariaMeleeWeapon {
    public Stormcaller(Item.Properties props) {
        super(props);
        setTexture(Texture2D.of("armaria:item/stormcaller"));
    }

    @Override
    public void postHurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) {
        VFXPresets.stormChain(attacker, InteractionHand.MAIN_HAND);
    }
}

3. Register the weapon

public class ExampleMod implements ModInitializer {
    public static final Item STORMCALLER = new Stormcaller(
        new Item.Properties().setId(
            ResourceKey.create(Registries.ITEM,
                Identifier.fromNamespaceAndPath("example", "stormcaller"))
        )
    );

    @Override
    public void onInitialize() {
        Registry.register(BuiltInRegistries.ITEM,
            Identifier.fromNamespaceAndPath("example", "stormcaller"),
            STORMCALLER);
    }
}

4. Add the texture

Place your texture at src/main/resources/assets/example/textures/item/stormcaller.png.

That's it. The library auto-generates the model JSON on startup.

Tip You can also use setTexture(Texture2D.of("armaria:item/stormcaller")) to let Armaria generate the model automatically.