概述
本模组为 KubeJS 添加了 Iron's Spells 'n Spellbooks 的法术书及咒语的自定义添加。
计划功能
使用示例
StartupEvents.registry('irons_spellbooks:spells', event => {
event.create('bloodfed')
.setCastTime(60) // Sets the cast time
.setCooldownSeconds(10) // Sets the cooldown in seconds
.setManaCostPerLevel(20) // Sets the mana cost per level
.setCastType('continuous') // Sets the cast type
.setSchool('irons_spellbooks:blood') // Sets the school
.setMinRarity('epic') // Sets the minimal rarity
.setMaxLevel(2) // Sets the maximum level
.setStartSound('item.honey_bottle.drink') // Sets the start sound
.setFinishSound('item.honey_bottle.drink') // Sets the finish sound
.onCast(ctx => global.bloodfed(ctx)) // Calls global.bloodfed when the spell is casted})global.bloodfed = (/** @type {Internal.CustomSpell$CastContext} */ ctx) => {
let /** @type {Internal.ServerPlayer} */ player = ctx.entityif ((player.getFoodData().getFoodLevel() * (ctx.getSpellLevel() / 2)) < 2
|| !ctx.entity.isPlayer()) return
player.heal(ctx.getSpellLevel() / 2)
player.getFoodData().setFoodLevel(player.getFoodData().getFoodLevel() - 2 * (ctx.getSpellLevel() / 2))}