Skip to content

Addon Compatibilities

liopyu edited this page Oct 12, 2024 · 24 revisions

Iron's Spells Mob Registration Script πŸ§™β€β™‚οΈ

This script demonstrates the dynamic registration of entities capable of casting spells from the Iron's Spells Mod using the KubeJS addon, KubeJS Iron's Spells Mod.


πŸ“œ Startup Script

// Register the spellcasting entity
StartupEvents.registry('entity_type', event => {
    event.create('wyrm', 'irons_spells_js:spellcasting')
        .onCancelledCast(entity => {
            // Execute code when the entity stops casting its spell
            console.log('Cancelled spellcasting')
        })
        // Cast a spell when the entity jumps
        .onLivingJump(entity => entity.initiateCastSpell(SpellRegistry.BLOOD_SLASH_SPELL.get(), 1))
})
Entity Type Registration Registers a new entity type, "wyrm", with spellcasting capabilities.
Spellcasting Events Handles events like spell cancelation and spell initiation upon entity actions (like jumping).

Iron's Spells Example Goal Script πŸ›‘οΈ

This script adds custom goal selectors for Minecraft entities, allowing them to use spells from Iron's Spells Mod.


πŸ“œ Server Script

EntityJSEvents.addGoalSelectors('minecraft:creeper', event => {
    event.arbitraryGoal(1, (e) => {
        return new WizardAttackGoal(e, 1, 60) // Parameters: entity, movement speed modifier, cast interval
            .setSpells(
                [Spell.of('irons_spellbooks:fang_strike')], // Attack
                [Spell.of('irons_spellbooks:slow')], // Defense
                [Spell.of('irons_spellbooks:blood_step')], // Movement
                [] // Support
            )
    })
})
Goal Selectors Adds custom goal selectors to enable spellcasting behaviors for Minecraft entities, such as the Creeper.
Spell Categories Allows categorizing spells into Attack, Defense, Movement, and Support types.

MrCrayfish's Gun Mod Compatibility πŸ”«

This script demonstrates compatibility integration with MrCrayfish's Gun Mod by registering a new entity type, "mymissile", with ammo and Geckolib/Liolib support.


πŸ“œ Startup Script

StartupEvents.registry("entity_type", event => {
    event.create("mymissile", "cgm:ammo")
        .onHitEntity(context => {
            // Execute code when the ammo hits an entity
            console.log(context.entity);
        })
        .explosionEnabled(true);
});
Entity Type Registration Registers a custom entity type "mymissile" that is compatible with MrCrayfish's Gun Mod's ammo system.
Hit Behavior Triggers a custom event when the projectile hits an entity and enables explosion effects.
Geckolib/Liolib Support Includes full support for animation and model rendering using Geckolib and Liolib.