HexCasting/src/main/java/at/petrak/hex/common/casting/operators/OpWriteToSpellbook.kt
2021-12-28 01:49:28 -06:00

17 lines
598 B
Kotlin

package at.petrak.hex.common.casting.operators
import at.petrak.hex.common.casting.CastingContext
import at.petrak.hex.common.casting.SpellDatum
import at.petrak.hex.common.casting.SpellOperator.Companion.spellListOf
import at.petrak.hex.common.items.ItemSpellbook
object OpWriteToSpellbook : SimpleOperator {
override val argc: Int
get() = 1
override fun execute(args: List<SpellDatum<*>>, ctx: CastingContext): List<SpellDatum<*>> {
val spellbook = ctx.getSpellbook()
ItemSpellbook.WriteDatum(spellbook.orCreateTag, args[0])
return spellListOf()
}
}