Skip to content

KilnWrite Minecraft Mods Once.

Clean, indentation-based .kiln declarations compiled to standalone Fabric & NeoForge projects across Minecraft 1.21.1, 1.21.3, 1.21.4, and 1.21.5 — with zero runtime library dependencies.

Kiln Logo

One Source, Target-Native Java ​

Instead of maintaining parallel Fabric/NeoForge boilerplate across four incompatible 1.21.x Minecraft codebases, declare your content once in .kiln and let Kiln emit idiomatic Java for every target:

kiln
item ruby_sword:
    name = "Ruby Sword"
    kind = sword
    tier = ruby_tier
    attack_damage = 3.0
    attack_speed = -2.4
    tab = combat

    on hit(target, attacker):
        if chance(25%):
            ignite(target, 3 seconds)
            knockback(target, 0.6)
        add_effect(weakness, duration = 4 seconds, level = 0)
        particle(flame, count = 6)
java
public static final ResourceKey<Item> RUBY_SWORD_KEY = key("ruby_sword");

public static final Item RUBY_SWORD = new SwordItem(
    ModToolTiers.RUBY_TIER, 3.0f, -2.4f,
    new Item.Properties().setId(RUBY_SWORD_KEY)
) {
    @Override
    public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) {
        if (!target.level().isClientSide) {
            if ((target.level().getRandom().nextDouble() < (0.25))) {
                if (target != null) {
                    target.igniteForSeconds((float) (3.0));
                }
                double kilnDx = attacker.getX() - target.getX();
                double kilnDz = attacker.getZ() - target.getZ();
                target.knockback((double) (0.6), kilnDx, kilnDz);
            }
            if (target instanceof LivingEntity kilnLiving) {
                kilnLiving.addEffect(new MobEffectInstance(MobEffects.WEAKNESS, 80, 0));
            }
            if (target.level() instanceof ServerLevel sl) {
                sl.sendParticles(ParticleTypes.FLAME, target.getX(), target.getY() + 1.0, target.getZ(), 6, 0.4, 0.4, 0.4, 0.1);
            }
        }
        return super.hurtEnemy(stack, target, attacker);
    }
};
java
public static final DeferredItem<Item> RUBY_SWORD = ITEMS.registerItem(
    "ruby_sword",
    props -> new Item(props
        .sword(ModToolTiers.RUBY_TIER, 3.0f, -2.4f)
    ) {
        @Override
        public void hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) {
            if (!target.level().isClientSide) {
                if ((target.level().getRandom().nextDouble() < (0.25))) {
                    if (target != null) {
                        target.igniteForSeconds((float) (3.0));
                    }
                    double kilnDx = attacker.getX() - target.getX();
                    double kilnDz = attacker.getZ() - target.getZ();
                    target.knockback((double) (0.6), kilnDx, kilnDz);
                }
                if (target instanceof LivingEntity kilnLiving) {
                    kilnLiving.addEffect(new MobEffectInstance(MobEffects.WEAKNESS, 80, 0));
                }
                if (target.level() instanceof ServerLevel sl) {
                    sl.sendParticles(ParticleTypes.FLAME, target.getX(), target.getY() + 1.0, target.getZ(), 6, 0.4, 0.4, 0.4, 0.1);
                }
            }
            super.hurtEnemy(stack, target, attacker);
        }
    }
);

Notice how Kiln adapts automatically across loaders and versions without any runtime bridge library:

  • 1.21.4 Fabric emits SwordItem, explicit setId(ResourceKey<Item>), and public boolean hurtEnemy(...).
  • 1.21.5 NeoForge emits DeferredItem<Item>, props.sword(...) data-component builders, and public void hurtEnemy(...).

Want to inspect more emitted Java? Try the Interactive Output Explorer, check the 8-Target Support Matrix, or read the Limitations, Escape Hatches & FAQ and Roadmap.

Released under the MIT License.