kotlin went great, now for java
This commit is contained in:
parent
e00757331e
commit
7403d87e6f
141 changed files with 273 additions and 273 deletions
|
@ -13,9 +13,9 @@ interface ConstManaOperator : Operator {
|
||||||
val manaCost: Int
|
val manaCost: Int
|
||||||
get() = 0
|
get() = 0
|
||||||
|
|
||||||
fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>>
|
fun execute(args: List<Iota>, ctx: CastingContext): List<Iota>
|
||||||
|
|
||||||
override fun operate(continuation: SpellContinuation, stack: MutableList<LegacySpellDatum<*>>, local: LegacySpellDatum<*>, ctx: CastingContext): OperationResult {
|
override fun operate(continuation: SpellContinuation, stack: MutableList<Iota>, local: Iota, ctx: CastingContext): OperationResult {
|
||||||
if (this.argc > stack.size)
|
if (this.argc > stack.size)
|
||||||
throw MishapNotEnoughArgs(this.argc, stack.size)
|
throw MishapNotEnoughArgs(this.argc, stack.size)
|
||||||
val args = stack.takeLast(this.argc)
|
val args = stack.takeLast(this.argc)
|
||||||
|
|
|
@ -6,4 +6,4 @@ import at.petrak.hexcasting.api.spell.casting.SpellContinuation
|
||||||
/**
|
/**
|
||||||
* What happens when an operator is through?
|
* What happens when an operator is through?
|
||||||
*/
|
*/
|
||||||
data class OperationResult(val newContinuation: SpellContinuation, val newStack: List<LegacySpellDatum<*>>, val newLocalIota: LegacySpellDatum<*>, val sideEffects: List<OperatorSideEffect>)
|
data class OperationResult(val newContinuation: SpellContinuation, val newStack: List<Iota>, val newLocalIota: Iota, val sideEffects: List<OperatorSideEffect>)
|
||||||
|
|
|
@ -21,7 +21,7 @@ interface Operator {
|
||||||
*
|
*
|
||||||
* A particle effect at the cast site and various messages and advancements are done automagically.
|
* A particle effect at the cast site and various messages and advancements are done automagically.
|
||||||
*/
|
*/
|
||||||
fun operate(continuation: SpellContinuation, stack: MutableList<LegacySpellDatum<*>>, local: LegacySpellDatum<*>, ctx: CastingContext): OperationResult
|
fun operate(continuation: SpellContinuation, stack: MutableList<Iota>, local: Iota, ctx: CastingContext): OperationResult
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do you need to be enlightened to use this operator? (i.e. is this operator a Great Pattern)
|
* Do you need to be enlightened to use this operator? (i.e. is this operator a Great Pattern)
|
||||||
|
@ -50,11 +50,11 @@ interface Operator {
|
||||||
origin.add(look.normalize().scale(MAX_DISTANCE))
|
origin.add(look.normalize().scale(MAX_DISTANCE))
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun makeConstantOp(x: LegacySpellDatum<*>): Operator = object : ConstManaOperator {
|
fun makeConstantOp(x: Iota): Operator = object : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 0
|
get() = 0
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> =
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> =
|
||||||
listOf(x)
|
listOf(x)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.world.entity.Entity
|
||||||
import net.minecraft.world.phys.Vec3
|
import net.minecraft.world.phys.Vec3
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
fun numOrVec(datum: LegacySpellDatum<*>, reverseIdx: Int): Either<Double, Vec3> =
|
fun numOrVec(datum: Iota, reverseIdx: Int): Either<Double, Vec3> =
|
||||||
when (datum.payload) {
|
when (datum.payload) {
|
||||||
is Double -> Either.left(datum.payload)
|
is Double -> Either.left(datum.payload)
|
||||||
is Vec3 -> Either.right(datum.payload)
|
is Vec3 -> Either.right(datum.payload)
|
||||||
|
@ -24,7 +24,7 @@ fun numOrVec(datum: LegacySpellDatum<*>, reverseIdx: Int): Either<Double, Vec3>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun numOrList(datum: LegacySpellDatum<*>, reverseIdx: Int): Either<Double, SpellList> =
|
fun numOrList(datum: Iota, reverseIdx: Int): Either<Double, SpellList> =
|
||||||
when (datum.payload) {
|
when (datum.payload) {
|
||||||
is Double -> Either.left(datum.payload)
|
is Double -> Either.left(datum.payload)
|
||||||
is SpellList -> Either.right(datum.payload)
|
is SpellList -> Either.right(datum.payload)
|
||||||
|
@ -35,15 +35,15 @@ fun numOrList(datum: LegacySpellDatum<*>, reverseIdx: Int): Either<Double, Spell
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun spellListOf(vararg vs: Any): List<LegacySpellDatum<*>> {
|
fun spellListOf(vararg vs: Any): List<Iota> {
|
||||||
val out = ArrayList<LegacySpellDatum<*>>(vs.size)
|
val out = ArrayList<Iota>(vs.size)
|
||||||
for (v in vs) {
|
for (v in vs) {
|
||||||
out.add(LegacySpellDatum.make(v))
|
out.add(LegacySpellDatum.make(v))
|
||||||
}
|
}
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun <reified T : Any> List<LegacySpellDatum<*>>.getChecked(idx: Int, argc: Int = 0): T {
|
inline fun <reified T : Any> List<Iota>.getChecked(idx: Int, argc: Int = 0): T {
|
||||||
val x = this.getOrElse(idx) { throw MishapNotEnoughArgs(idx + 1, this.size) }
|
val x = this.getOrElse(idx) { throw MishapNotEnoughArgs(idx + 1, this.size) }
|
||||||
if (x.payload is T)
|
if (x.payload is T)
|
||||||
return x.payload
|
return x.payload
|
||||||
|
@ -57,7 +57,7 @@ inline val Double.asSpellResult get() = spellListOf(this)
|
||||||
inline val Number.asSpellResult get() = spellListOf(this.toDouble())
|
inline val Number.asSpellResult get() = spellListOf(this.toDouble())
|
||||||
|
|
||||||
inline val SpellList.asSpellResult get() = spellListOf(this)
|
inline val SpellList.asSpellResult get() = spellListOf(this)
|
||||||
inline val List<LegacySpellDatum<*>>.asSpellResult get() = spellListOf(this)
|
inline val List<Iota>.asSpellResult get() = spellListOf(this)
|
||||||
|
|
||||||
inline val Widget.asSpellResult get() = spellListOf(this)
|
inline val Widget.asSpellResult get() = spellListOf(this)
|
||||||
|
|
||||||
|
@ -74,9 +74,9 @@ fun Any.tolerantEquals(other: Any) = tolerantEquals(other, 64)
|
||||||
|
|
||||||
private fun Any.tolerantEquals(other: Any, recursionsLeft: Int): Boolean {
|
private fun Any.tolerantEquals(other: Any, recursionsLeft: Int): Boolean {
|
||||||
return when {
|
return when {
|
||||||
this is LegacySpellDatum<*> && other is LegacySpellDatum<*> -> this.payload.tolerantEquals(other.payload, recursionsLeft)
|
this is Iota && other is Iota -> this.payload.tolerantEquals(other.payload, recursionsLeft)
|
||||||
this is LegacySpellDatum<*> -> this.payload.tolerantEquals(other, recursionsLeft)
|
this is Iota -> this.payload.tolerantEquals(other, recursionsLeft)
|
||||||
other is LegacySpellDatum<*> -> this.tolerantEquals(other.payload, recursionsLeft)
|
other is Iota -> this.tolerantEquals(other.payload, recursionsLeft)
|
||||||
|
|
||||||
this is HexPattern && other is HexPattern -> this.angles == other.angles
|
this is HexPattern && other is HexPattern -> this.angles == other.angles
|
||||||
this is Double && other is Double -> abs(this - other) < TOLERANCE
|
this is Double && other is Double -> abs(this - other) < TOLERANCE
|
||||||
|
|
|
@ -13,11 +13,11 @@ interface SpellOperator : Operator {
|
||||||
fun awardsCastingStat(ctx: CastingContext): Boolean = true
|
fun awardsCastingStat(ctx: CastingContext): Boolean = true
|
||||||
|
|
||||||
fun execute(
|
fun execute(
|
||||||
args: List<LegacySpellDatum<*>>,
|
args: List<Iota>,
|
||||||
ctx: CastingContext
|
ctx: CastingContext
|
||||||
): Triple<RenderedSpell, Int, List<ParticleSpray>>?
|
): Triple<RenderedSpell, Int, List<ParticleSpray>>?
|
||||||
|
|
||||||
override fun operate(continuation: SpellContinuation, stack: MutableList<LegacySpellDatum<*>>, local: LegacySpellDatum<*>, ctx: CastingContext): OperationResult {
|
override fun operate(continuation: SpellContinuation, stack: MutableList<Iota>, local: Iota, ctx: CastingContext): OperationResult {
|
||||||
if (this.argc > stack.size)
|
if (this.argc > stack.size)
|
||||||
throw MishapNotEnoughArgs(this.argc, stack.size)
|
throw MishapNotEnoughArgs(this.argc, stack.size)
|
||||||
val args = stack.takeLast(this.argc)
|
val args = stack.takeLast(this.argc)
|
||||||
|
|
|
@ -16,7 +16,7 @@ enum class Widget : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 0
|
get() = 0
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> =
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> =
|
||||||
this.asSpellResult
|
this.asSpellResult
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package at.petrak.hexcasting.api.spell.casting
|
package at.petrak.hexcasting.api.spell.casting
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A change to the data in a CastHarness after a pattern is drawn.
|
* A change to the data in a CastHarness after a pattern is drawn.
|
||||||
*/
|
*/
|
||||||
data class FunctionalData(
|
data class FunctionalData(
|
||||||
val stack: List<LegacySpellDatum<*>>,
|
val stack: List<Iota>,
|
||||||
val parenCount: Int,
|
val parenCount: Int,
|
||||||
val parenthesized: List<LegacySpellDatum<*>>,
|
val parenthesized: List<Iota>,
|
||||||
val escapeNext: Boolean,
|
val escapeNext: Boolean,
|
||||||
) {
|
) {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,7 +3,7 @@ package at.petrak.hexcasting.api.spell.mishaps
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.mod.HexItemTags
|
import at.petrak.hexcasting.api.mod.HexItemTags
|
||||||
import at.petrak.hexcasting.api.spell.ParticleSpray
|
import at.petrak.hexcasting.api.spell.ParticleSpray
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.casting.ResolvedPatternType
|
import at.petrak.hexcasting.api.spell.casting.ResolvedPatternType
|
||||||
import at.petrak.hexcasting.api.spell.math.HexPattern
|
import at.petrak.hexcasting.api.spell.math.HexPattern
|
||||||
|
@ -38,7 +38,7 @@ sealed class Mishap : Throwable() {
|
||||||
*
|
*
|
||||||
* You can also mess up the stack with this.
|
* You can also mess up the stack with this.
|
||||||
*/
|
*/
|
||||||
abstract fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>)
|
abstract fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>)
|
||||||
|
|
||||||
abstract fun errorMessage(ctx: CastingContext, errorCtx: Context): Component
|
abstract fun errorMessage(ctx: CastingContext, errorCtx: Context): Component
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.misc.HexDamageSources
|
import at.petrak.hexcasting.api.misc.HexDamageSources
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.ParticleSpray
|
import at.petrak.hexcasting.api.spell.ParticleSpray
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import net.minecraft.world.entity.npc.Villager
|
import net.minecraft.world.entity.npc.Villager
|
||||||
|
@ -12,7 +12,7 @@ class MishapAlreadyBrainswept(val villager: Villager) : Mishap() {
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.GREEN)
|
dyeColor(DyeColor.GREEN)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
villager.hurt(HexDamageSources.overcastDamageFrom(ctx.caster), villager.health)
|
villager.hurt(HexDamageSources.overcastDamageFrom(ctx.caster), villager.health)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.ParticleSpray
|
import at.petrak.hexcasting.api.spell.ParticleSpray
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.utils.asTranslatedComponent
|
import at.petrak.hexcasting.api.utils.asTranslatedComponent
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
|
@ -15,7 +15,7 @@ class MishapBadBlock(val pos: BlockPos, val expected: Component) : Mishap() {
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.LIME)
|
dyeColor(DyeColor.LIME)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
ctx.world.explode(null, pos.x + 0.5, pos.y + 0.5, pos.z + 0.5, 0.25f, Explosion.BlockInteraction.NONE)
|
ctx.world.explode(null, pos.x + 0.5, pos.y + 0.5, pos.z + 0.5, 0.25f, Explosion.BlockInteraction.NONE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package at.petrak.hexcasting.api.spell.mishaps
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.misc.HexDamageSources
|
import at.petrak.hexcasting.api.misc.HexDamageSources
|
||||||
import at.petrak.hexcasting.api.spell.ParticleSpray
|
import at.petrak.hexcasting.api.spell.ParticleSpray
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
import net.minecraft.world.entity.npc.Villager
|
import net.minecraft.world.entity.npc.Villager
|
||||||
|
@ -14,7 +14,7 @@ class MishapBadBrainsweep(val villager: Villager, val pos: BlockPos) : Mishap()
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.GREEN)
|
dyeColor(DyeColor.GREEN)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
trulyHurt(villager, HexDamageSources.overcastDamageFrom(ctx.caster), villager.health)
|
trulyHurt(villager, HexDamageSources.overcastDamageFrom(ctx.caster), villager.health)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.utils.asTranslatedComponent
|
import at.petrak.hexcasting.api.utils.asTranslatedComponent
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
|
@ -12,7 +12,7 @@ class MishapBadItem(val item: ItemEntity, val wanted: Component) : Mishap() {
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.BROWN)
|
dyeColor(DyeColor.BROWN)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
item.deltaMovement = item.deltaMovement.add((Math.random() - 0.5) * 0.05, 0.75, (Math.random() - 0.5) * 0.05)
|
item.deltaMovement = item.deltaMovement.add((Math.random() - 0.5) * 0.05, 0.75, (Math.random() - 0.5) * 0.05)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.utils.asTranslatedComponent
|
import at.petrak.hexcasting.api.utils.asTranslatedComponent
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
|
@ -13,7 +13,7 @@ class MishapBadOffhandItem(val item: ItemStack, val hand: InteractionHand, val w
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.BROWN)
|
dyeColor(DyeColor.BROWN)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
yeetHeldItem(ctx, hand)
|
yeetHeldItem(ctx, hand)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.casting.ResolvedPatternType
|
import at.petrak.hexcasting.api.spell.casting.ResolvedPatternType
|
||||||
import net.minecraft.world.item.DyeColor
|
import net.minecraft.world.item.DyeColor
|
||||||
|
@ -12,7 +12,7 @@ class MishapDisallowedSpell(val type: String = "disallowed") : Mishap() {
|
||||||
|
|
||||||
override fun resolutionType(ctx: CastingContext) = ResolvedPatternType.INVALID
|
override fun resolutionType(ctx: CastingContext) = ResolvedPatternType.INVALID
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
// NO-OP
|
// NO-OP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.misc.HexDamageSources
|
import at.petrak.hexcasting.api.misc.HexDamageSources
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.Widget
|
import at.petrak.hexcasting.api.spell.Widget
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.utils.asTranslatedComponent
|
import at.petrak.hexcasting.api.utils.asTranslatedComponent
|
||||||
|
@ -15,7 +15,7 @@ class MishapDivideByZero(val operand1: Component, val operand2: Component, val s
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.RED)
|
dyeColor(DyeColor.RED)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
stack.add(LegacySpellDatum.make(Widget.GARBAGE))
|
stack.add(LegacySpellDatum.make(Widget.GARBAGE))
|
||||||
trulyHurt(ctx.caster, HexDamageSources.OVERCAST, ctx.caster.health / 2)
|
trulyHurt(ctx.caster, HexDamageSources.OVERCAST, ctx.caster.health / 2)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.world.entity.Entity
|
import net.minecraft.world.entity.Entity
|
||||||
|
@ -11,7 +11,7 @@ class MishapEntityTooFarAway(val entity: Entity) : Mishap() {
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.PINK)
|
dyeColor(DyeColor.PINK)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
// Knock the player's items out of their hands
|
// Knock the player's items out of their hands
|
||||||
yeetHeldItemsTowards(ctx, entity.position())
|
yeetHeldItemsTowards(ctx, entity.position())
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import net.minecraft.world.item.DyeColor
|
import net.minecraft.world.item.DyeColor
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ class MishapError(val exception: Exception) : Mishap() {
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.BLACK)
|
dyeColor(DyeColor.BLACK)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
// NO-OP
|
// NO-OP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import net.minecraft.world.item.DyeColor
|
import net.minecraft.world.item.DyeColor
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ class MishapEvalTooDeep : Mishap() {
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.BLUE)
|
dyeColor(DyeColor.BLUE)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
ctx.caster.airSupply -= 290
|
ctx.caster.airSupply -= 290
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import net.minecraft.world.entity.Entity
|
import net.minecraft.world.entity.Entity
|
||||||
import net.minecraft.world.item.DyeColor
|
import net.minecraft.world.item.DyeColor
|
||||||
|
@ -10,7 +10,7 @@ class MishapImmuneEntity(val entity: Entity) : Mishap() {
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.BLUE)
|
dyeColor(DyeColor.BLUE)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
yeetHeldItemsTowards(ctx, entity.position())
|
yeetHeldItemsTowards(ctx, entity.position())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.SpellList
|
import at.petrak.hexcasting.api.spell.SpellList
|
||||||
import at.petrak.hexcasting.api.spell.Widget
|
import at.petrak.hexcasting.api.spell.Widget
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
|
@ -22,14 +22,14 @@ import net.minecraft.world.phys.Vec3
|
||||||
* [MishapInvalidIota.reverseIdx] is the index from the *back* of the stack.
|
* [MishapInvalidIota.reverseIdx] is the index from the *back* of the stack.
|
||||||
*/
|
*/
|
||||||
class MishapInvalidIota(
|
class MishapInvalidIota(
|
||||||
val perpetrator: LegacySpellDatum<*>,
|
val perpetrator: Iota,
|
||||||
val reverseIdx: Int,
|
val reverseIdx: Int,
|
||||||
val expected: Component
|
val expected: Component
|
||||||
) : Mishap() {
|
) : Mishap() {
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.GRAY)
|
dyeColor(DyeColor.GRAY)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
stack[stack.size - 1 - reverseIdx] = LegacySpellDatum.make(Widget.GARBAGE)
|
stack[stack.size - 1 - reverseIdx] = LegacySpellDatum.make(Widget.GARBAGE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class MishapInvalidIota(
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun ofClass(perpetrator: LegacySpellDatum<*>, reverseIdx: Int, cls: Class<*>): MishapInvalidIota {
|
fun ofClass(perpetrator: Iota, reverseIdx: Int, cls: Class<*>): MishapInvalidIota {
|
||||||
val key = "hexcasting.mishap.invalid_value.class." + when {
|
val key = "hexcasting.mishap.invalid_value.class." + when {
|
||||||
Double::class.java.isAssignableFrom(cls) || Double::class.javaObjectType.isAssignableFrom(cls) -> "double"
|
Double::class.java.isAssignableFrom(cls) || Double::class.javaObjectType.isAssignableFrom(cls) -> "double"
|
||||||
Vec3::class.java.isAssignableFrom(cls) -> "vector"
|
Vec3::class.java.isAssignableFrom(cls) -> "vector"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.Widget
|
import at.petrak.hexcasting.api.spell.Widget
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.casting.ResolvedPatternType
|
import at.petrak.hexcasting.api.spell.casting.ResolvedPatternType
|
||||||
|
@ -13,7 +13,7 @@ class MishapInvalidPattern : Mishap() {
|
||||||
|
|
||||||
override fun resolutionType(ctx: CastingContext) = ResolvedPatternType.INVALID
|
override fun resolutionType(ctx: CastingContext) = ResolvedPatternType.INVALID
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
stack.add(LegacySpellDatum.make(Widget.GARBAGE))
|
stack.add(LegacySpellDatum.make(Widget.GARBAGE))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import net.minecraft.world.item.DyeColor
|
import net.minecraft.world.item.DyeColor
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ class MishapInvalidSpellDatumType(val perpetrator: Any) : Mishap() {
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.BLACK)
|
dyeColor(DyeColor.BLACK)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
// NO-OP
|
// NO-OP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.Widget
|
import at.petrak.hexcasting.api.spell.Widget
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
|
@ -12,7 +12,7 @@ class MishapLocationInWrongDimension(val properDimension: ResourceLocation) : Mi
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.MAGENTA)
|
dyeColor(DyeColor.MAGENTA)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
stack.add(LegacySpellDatum.make(Widget.GARBAGE))
|
stack.add(LegacySpellDatum.make(Widget.GARBAGE))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.world.item.DyeColor
|
import net.minecraft.world.item.DyeColor
|
||||||
|
@ -11,7 +11,7 @@ class MishapLocationTooFarAway(val location: Vec3, val type: String = "too_far")
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.MAGENTA)
|
dyeColor(DyeColor.MAGENTA)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
yeetHeldItemsTowards(ctx, location)
|
yeetHeldItemsTowards(ctx, location)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
import net.minecraft.world.item.DyeColor
|
import net.minecraft.world.item.DyeColor
|
||||||
|
@ -10,7 +10,7 @@ class MishapNoAkashicRecord(val pos: BlockPos) : Mishap() {
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.PURPLE)
|
dyeColor(DyeColor.PURPLE)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
ctx.caster.giveExperiencePoints(-100)
|
ctx.caster.giveExperiencePoints(-100)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import net.minecraft.world.item.DyeColor
|
import net.minecraft.world.item.DyeColor
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ class MishapNoSpellCircle : Mishap() {
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.LIGHT_BLUE)
|
dyeColor(DyeColor.LIGHT_BLUE)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
ctx.caster.inventory.dropAll()
|
ctx.caster.inventory.dropAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.Widget
|
import at.petrak.hexcasting.api.spell.Widget
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
|
@ -11,7 +11,7 @@ class MishapNotEnoughArgs(val expected: Int, val got: Int) : Mishap() {
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.LIGHT_GRAY)
|
dyeColor(DyeColor.LIGHT_GRAY)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
for (i in got until expected)
|
for (i in got until expected)
|
||||||
stack.add(LegacySpellDatum.make(Widget.GARBAGE))
|
stack.add(LegacySpellDatum.make(Widget.GARBAGE))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.SpellList
|
import at.petrak.hexcasting.api.spell.SpellList
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import net.minecraft.world.effect.MobEffectInstance
|
import net.minecraft.world.effect.MobEffectInstance
|
||||||
|
@ -13,7 +13,7 @@ class MishapOthersName(val other: Player) : Mishap() {
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.BLACK)
|
dyeColor(DyeColor.BLACK)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
ctx.caster.addEffect(MobEffectInstance(MobEffects.BLINDNESS, 20 * 60))
|
ctx.caster.addEffect(MobEffectInstance(MobEffects.BLINDNESS, 20 * 60))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,14 +22,14 @@ class MishapOthersName(val other: Player) : Mishap() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getTrueNameFromDatum(datum: LegacySpellDatum<*>, caster: Player): Player? {
|
fun getTrueNameFromDatum(datum: Iota, caster: Player): Player? {
|
||||||
if (datum.payload is Player && datum.payload != caster)
|
if (datum.payload is Player && datum.payload != caster)
|
||||||
return datum.payload
|
return datum.payload
|
||||||
else if (datum.payload !is SpellList)
|
else if (datum.payload !is SpellList)
|
||||||
return null
|
return null
|
||||||
|
|
||||||
val poolToSearch: MutableList<LegacySpellDatum<*>> =
|
val poolToSearch: MutableList<Iota> =
|
||||||
datum.payload.filterIsInstance<LegacySpellDatum<*>>().toMutableList()
|
datum.payload.filterIsInstance<Iota>().toMutableList()
|
||||||
|
|
||||||
while (poolToSearch.isNotEmpty()) {
|
while (poolToSearch.isNotEmpty()) {
|
||||||
val datumToCheck = poolToSearch[0]
|
val datumToCheck = poolToSearch[0]
|
||||||
|
@ -38,14 +38,14 @@ class MishapOthersName(val other: Player) : Mishap() {
|
||||||
if (datumToCheck.payload is Player && datumToCheck.payload != caster)
|
if (datumToCheck.payload is Player && datumToCheck.payload != caster)
|
||||||
return datumToCheck.payload
|
return datumToCheck.payload
|
||||||
else if (datumToCheck.payload is SpellList)
|
else if (datumToCheck.payload is SpellList)
|
||||||
poolToSearch.addAll(datumToCheck.payload.filterIsInstance<LegacySpellDatum<*>>())
|
poolToSearch.addAll(datumToCheck.payload.filterIsInstance<Iota>())
|
||||||
}
|
}
|
||||||
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getTrueNameFromArgs(datums: List<LegacySpellDatum<*>>, caster: Player): Player? {
|
fun getTrueNameFromArgs(datums: List<Iota>, caster: Player): Player? {
|
||||||
return datums.firstNotNullOfOrNull { getTrueNameFromDatum(it, caster) }
|
return datums.firstNotNullOfOrNull { getTrueNameFromDatum(it, caster) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.world.item.DyeColor
|
import net.minecraft.world.item.DyeColor
|
||||||
|
@ -10,7 +10,7 @@ class MishapTooManyCloseParens : Mishap() {
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.ORANGE)
|
dyeColor(DyeColor.ORANGE)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
stack.add(LegacySpellDatum.make(errorCtx.pattern))
|
stack.add(LegacySpellDatum.make(errorCtx.pattern))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import net.minecraft.world.item.DyeColor
|
import net.minecraft.world.item.DyeColor
|
||||||
|
|
||||||
|
@ -9,12 +9,12 @@ import net.minecraft.world.item.DyeColor
|
||||||
* The value was a naked iota without being Considered or Retrospected.
|
* The value was a naked iota without being Considered or Retrospected.
|
||||||
*/
|
*/
|
||||||
class MishapUnescapedValue(
|
class MishapUnescapedValue(
|
||||||
val perpetrator: LegacySpellDatum<*>
|
val perpetrator: Iota
|
||||||
) : Mishap() {
|
) : Mishap() {
|
||||||
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
override fun accentColor(ctx: CastingContext, errorCtx: Context): FrozenColorizer =
|
||||||
dyeColor(DyeColor.GRAY)
|
dyeColor(DyeColor.GRAY)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<LegacySpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<Iota>) {
|
||||||
// TODO
|
// TODO
|
||||||
/*
|
/*
|
||||||
val idx = stack.indexOfLast { it.getType() == DatumType.LIST }
|
val idx = stack.indexOfLast { it.getType() == DatumType.LIST }
|
||||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.world.phys.Vec3
|
||||||
object OpBlockAxisRaycast : ConstManaOperator {
|
object OpBlockAxisRaycast : ConstManaOperator {
|
||||||
override val argc = 2
|
override val argc = 2
|
||||||
override val manaCost = ManaConstants.DUST_UNIT / 100
|
override val manaCost = ManaConstants.DUST_UNIT / 100
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val origin: Vec3 = args.getChecked(0, argc)
|
val origin: Vec3 = args.getChecked(0, argc)
|
||||||
val look: Vec3 = args.getChecked(1, argc)
|
val look: Vec3 = args.getChecked(1, argc)
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.world.phys.Vec3
|
||||||
object OpBlockRaycast : ConstManaOperator {
|
object OpBlockRaycast : ConstManaOperator {
|
||||||
override val argc = 2
|
override val argc = 2
|
||||||
override val manaCost = ManaConstants.DUST_UNIT / 100
|
override val manaCost = ManaConstants.DUST_UNIT / 100
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val origin: Vec3 = args.getChecked(0, argc)
|
val origin: Vec3 = args.getChecked(0, argc)
|
||||||
val look: Vec3 = args.getChecked(1, argc)
|
val look: Vec3 = args.getChecked(1, argc)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators
|
package at.petrak.hexcasting.common.casting.operators
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -10,7 +10,7 @@ import net.minecraft.world.entity.Entity
|
||||||
object OpEntityHeight : ConstManaOperator {
|
object OpEntityHeight : ConstManaOperator {
|
||||||
override val argc = 1
|
override val argc = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val e: Entity = args.getChecked(0, argc)
|
val e: Entity = args.getChecked(0, argc)
|
||||||
ctx.assertEntityInRange(e)
|
ctx.assertEntityInRange(e)
|
||||||
return e.bbHeight.asSpellResult
|
return e.bbHeight.asSpellResult
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators
|
package at.petrak.hexcasting.common.casting.operators
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -10,7 +10,7 @@ import net.minecraft.world.entity.Entity
|
||||||
object OpEntityLook : ConstManaOperator {
|
object OpEntityLook : ConstManaOperator {
|
||||||
override val argc = 1
|
override val argc = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val e: Entity = args.getChecked(0, argc)
|
val e: Entity = args.getChecked(0, argc)
|
||||||
ctx.assertEntityInRange(e)
|
ctx.assertEntityInRange(e)
|
||||||
return e.lookAngle.asSpellResult
|
return e.lookAngle.asSpellResult
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators
|
package at.petrak.hexcasting.common.casting.operators
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -11,7 +11,7 @@ import net.minecraft.world.entity.player.Player
|
||||||
object OpEntityPos : ConstManaOperator {
|
object OpEntityPos : ConstManaOperator {
|
||||||
override val argc = 1
|
override val argc = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val e: Entity = args.getChecked(0, argc)
|
val e: Entity = args.getChecked(0, argc)
|
||||||
ctx.assertEntityInRange(e)
|
ctx.assertEntityInRange(e)
|
||||||
// If this is a player, "expected behavior" is to get the *eye* position so raycasts don't immediately
|
// If this is a player, "expected behavior" is to get the *eye* position so raycasts don't immediately
|
||||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.world.phys.Vec3
|
||||||
object OpEntityRaycast : ConstManaOperator {
|
object OpEntityRaycast : ConstManaOperator {
|
||||||
override val argc = 2
|
override val argc = 2
|
||||||
override val manaCost = ManaConstants.DUST_UNIT / 100
|
override val manaCost = ManaConstants.DUST_UNIT / 100
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val origin: Vec3 = args.getChecked(0, argc)
|
val origin: Vec3 = args.getChecked(0, argc)
|
||||||
val look: Vec3 = args.getChecked(1, argc)
|
val look: Vec3 = args.getChecked(1, argc)
|
||||||
val endp = Operator.raycastEnd(origin, look)
|
val endp = Operator.raycastEnd(origin, look)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators
|
package at.petrak.hexcasting.common.casting.operators
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -12,7 +12,7 @@ import net.minecraft.world.entity.Entity
|
||||||
object OpEntityVelocity : ConstManaOperator {
|
object OpEntityVelocity : ConstManaOperator {
|
||||||
override val argc = 1
|
override val argc = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val e: Entity = args.getChecked(0, argc)
|
val e: Entity = args.getChecked(0, argc)
|
||||||
ctx.assertEntityInRange(e)
|
ctx.assertEntityInRange(e)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators
|
package at.petrak.hexcasting.common.casting.operators
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.mishaps.MishapBadOffhandItem
|
import at.petrak.hexcasting.api.spell.mishaps.MishapBadOffhandItem
|
||||||
import at.petrak.hexcasting.xplat.IXplatAbstractions
|
import at.petrak.hexcasting.xplat.IXplatAbstractions
|
||||||
|
@ -9,7 +9,7 @@ import at.petrak.hexcasting.xplat.IXplatAbstractions
|
||||||
object OpRead : ConstManaOperator {
|
object OpRead : ConstManaOperator {
|
||||||
override val argc = 0
|
override val argc = 0
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val (handStack, hand) = ctx.getHeldItemToOperateOn {
|
val (handStack, hand) = ctx.getHeldItemToOperateOn {
|
||||||
val dataHolder = IXplatAbstractions.INSTANCE.findDataHolder(it)
|
val dataHolder = IXplatAbstractions.INSTANCE.findDataHolder(it)
|
||||||
dataHolder != null && (dataHolder.readIota(ctx.world) != null || dataHolder.emptyIota() != null)
|
dataHolder != null && (dataHolder.readIota(ctx.world) != null || dataHolder.emptyIota() != null)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators
|
package at.petrak.hexcasting.common.casting.operators
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.xplat.IXplatAbstractions
|
import at.petrak.hexcasting.xplat.IXplatAbstractions
|
||||||
|
@ -9,7 +9,7 @@ import at.petrak.hexcasting.xplat.IXplatAbstractions
|
||||||
object OpReadable : ConstManaOperator {
|
object OpReadable : ConstManaOperator {
|
||||||
override val argc = 0
|
override val argc = 0
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val (handStack) = ctx.getHeldItemToOperateOn {
|
val (handStack) = ctx.getHeldItemToOperateOn {
|
||||||
IXplatAbstractions.INSTANCE.findDataHolder(it) != null
|
IXplatAbstractions.INSTANCE.findDataHolder(it) != null
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators
|
package at.petrak.hexcasting.common.casting.operators
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
import at.petrak.hexcasting.api.spell.mishaps.MishapBadItem
|
import at.petrak.hexcasting.api.spell.mishaps.MishapBadItem
|
||||||
|
@ -12,9 +12,9 @@ object OpTheCoolerRead : ConstManaOperator {
|
||||||
override val argc = 1
|
override val argc = 1
|
||||||
|
|
||||||
override fun execute(
|
override fun execute(
|
||||||
args: List<LegacySpellDatum<*>>,
|
args: List<Iota>,
|
||||||
ctx: CastingContext
|
ctx: CastingContext
|
||||||
): List<LegacySpellDatum<*>> {
|
): List<Iota> {
|
||||||
val target = args.getChecked<ItemEntity>(0, argc)
|
val target = args.getChecked<ItemEntity>(0, argc)
|
||||||
|
|
||||||
ctx.assertEntityInRange(target)
|
ctx.assertEntityInRange(target)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators
|
package at.petrak.hexcasting.common.casting.operators
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -12,9 +12,9 @@ object OpTheCoolerReadable : ConstManaOperator {
|
||||||
override val argc = 1
|
override val argc = 1
|
||||||
|
|
||||||
override fun execute(
|
override fun execute(
|
||||||
args: List<LegacySpellDatum<*>>,
|
args: List<Iota>,
|
||||||
ctx: CastingContext
|
ctx: CastingContext
|
||||||
): List<LegacySpellDatum<*>> {
|
): List<Iota> {
|
||||||
val target = args.getChecked<ItemEntity>(0, argc)
|
val target = args.getChecked<ItemEntity>(0, argc)
|
||||||
ctx.assertEntityInRange(target)
|
ctx.assertEntityInRange(target)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators
|
package at.petrak.hexcasting.common.casting.operators
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.mishaps.MishapOthersName
|
import at.petrak.hexcasting.api.spell.mishaps.MishapOthersName
|
||||||
|
@ -10,7 +10,7 @@ import at.petrak.hexcasting.xplat.IXplatAbstractions
|
||||||
object OpWritable : ConstManaOperator {
|
object OpWritable : ConstManaOperator {
|
||||||
override val argc = 1
|
override val argc = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val datum = args[0]
|
val datum = args[0]
|
||||||
|
|
||||||
val (handStack) = ctx.getHeldItemToOperateOn {
|
val (handStack) = ctx.getHeldItemToOperateOn {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators
|
package at.petrak.hexcasting.common.casting.operators
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.ParticleSpray
|
import at.petrak.hexcasting.api.spell.ParticleSpray
|
||||||
import at.petrak.hexcasting.api.spell.RenderedSpell
|
import at.petrak.hexcasting.api.spell.RenderedSpell
|
||||||
import at.petrak.hexcasting.api.spell.SpellOperator
|
import at.petrak.hexcasting.api.spell.SpellOperator
|
||||||
|
@ -13,7 +13,7 @@ import at.petrak.hexcasting.xplat.IXplatAbstractions
|
||||||
object OpWrite : SpellOperator {
|
object OpWrite : SpellOperator {
|
||||||
override val argc = 1
|
override val argc = 1
|
||||||
override fun execute(
|
override fun execute(
|
||||||
args: List<LegacySpellDatum<*>>,
|
args: List<Iota>,
|
||||||
ctx: CastingContext
|
ctx: CastingContext
|
||||||
): Triple<RenderedSpell, Int, List<ParticleSpray>> {
|
): Triple<RenderedSpell, Int, List<ParticleSpray>> {
|
||||||
val datum = args[0]
|
val datum = args[0]
|
||||||
|
@ -41,7 +41,7 @@ object OpWrite : SpellOperator {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private data class Spell(val datum: LegacySpellDatum<*>) : RenderedSpell {
|
private data class Spell(val datum: Iota) : RenderedSpell {
|
||||||
override fun cast(ctx: CastingContext) {
|
override fun cast(ctx: CastingContext) {
|
||||||
val (handStack) = ctx.getHeldItemToOperateOn {
|
val (handStack) = ctx.getHeldItemToOperateOn {
|
||||||
val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(it)
|
val datumHolder = IXplatAbstractions.INSTANCE.findDataHolder(it)
|
||||||
|
|
|
@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.akashic
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.misc.ManaConstants
|
import at.petrak.hexcasting.api.misc.ManaConstants
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.Widget
|
import at.petrak.hexcasting.api.spell.Widget
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -16,7 +16,7 @@ object OpAkashicRead : ConstManaOperator {
|
||||||
override val argc = 2
|
override val argc = 2
|
||||||
override val manaCost = ManaConstants.DUST_UNIT
|
override val manaCost = ManaConstants.DUST_UNIT
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val pos = args.getChecked<Vec3>(0, argc)
|
val pos = args.getChecked<Vec3>(0, argc)
|
||||||
val key = args.getChecked<HexPattern>(1, argc)
|
val key = args.getChecked<HexPattern>(1, argc)
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ object OpAkashicWrite : SpellOperator {
|
||||||
override val causesBlindDiversion = false
|
override val causesBlindDiversion = false
|
||||||
|
|
||||||
override fun execute(
|
override fun execute(
|
||||||
args: List<LegacySpellDatum<*>>,
|
args: List<Iota>,
|
||||||
ctx: CastingContext
|
ctx: CastingContext
|
||||||
): Triple<RenderedSpell, Int, List<ParticleSpray>> {
|
): Triple<RenderedSpell, Int, List<ParticleSpray>> {
|
||||||
val pos = args.getChecked<Vec3>(0, argc)
|
val pos = args.getChecked<Vec3>(0, argc)
|
||||||
|
@ -46,7 +46,7 @@ object OpAkashicWrite : SpellOperator {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private data class Spell(val record: BlockEntityAkashicRecord, val key: HexPattern, val datum: LegacySpellDatum<*>) :
|
private data class Spell(val record: BlockEntityAkashicRecord, val key: HexPattern, val datum: Iota) :
|
||||||
RenderedSpell {
|
RenderedSpell {
|
||||||
override fun cast(ctx: CastingContext) {
|
override fun cast(ctx: CastingContext) {
|
||||||
record.addNewDatum(key, datum)
|
record.addNewDatum(key, datum)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.circles
|
package at.petrak.hexcasting.common.casting.operators.circles
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.mishaps.MishapNoSpellCircle
|
import at.petrak.hexcasting.api.spell.mishaps.MishapNoSpellCircle
|
||||||
|
@ -10,7 +10,7 @@ import net.minecraft.world.phys.Vec3
|
||||||
class OpCircleBounds(val max: Boolean) : ConstManaOperator {
|
class OpCircleBounds(val max: Boolean) : ConstManaOperator {
|
||||||
override val argc = 0
|
override val argc = 0
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
if (ctx.spellCircle == null)
|
if (ctx.spellCircle == null)
|
||||||
throw MishapNoSpellCircle()
|
throw MishapNoSpellCircle()
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.circles
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.block.circle.BlockAbstractImpetus
|
import at.petrak.hexcasting.api.block.circle.BlockAbstractImpetus
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.mishaps.MishapNoSpellCircle
|
import at.petrak.hexcasting.api.spell.mishaps.MishapNoSpellCircle
|
||||||
|
@ -10,7 +10,7 @@ import at.petrak.hexcasting.api.spell.mishaps.MishapNoSpellCircle
|
||||||
object OpImpetusDir : ConstManaOperator {
|
object OpImpetusDir : ConstManaOperator {
|
||||||
override val argc = 0
|
override val argc = 0
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
if (ctx.spellCircle == null)
|
if (ctx.spellCircle == null)
|
||||||
throw MishapNoSpellCircle()
|
throw MishapNoSpellCircle()
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.circles
|
package at.petrak.hexcasting.common.casting.operators.circles
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.mishaps.MishapNoSpellCircle
|
import at.petrak.hexcasting.api.spell.mishaps.MishapNoSpellCircle
|
||||||
|
@ -10,7 +10,7 @@ import net.minecraft.world.phys.Vec3
|
||||||
object OpImpetusPos : ConstManaOperator {
|
object OpImpetusPos : ConstManaOperator {
|
||||||
override val argc = 0
|
override val argc = 0
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
if (ctx.spellCircle == null)
|
if (ctx.spellCircle == null)
|
||||||
throw MishapNoSpellCircle()
|
throw MishapNoSpellCircle()
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import at.petrak.hexcasting.api.spell.casting.ContinuationFrame
|
||||||
import at.petrak.hexcasting.api.spell.casting.SpellContinuation
|
import at.petrak.hexcasting.api.spell.casting.SpellContinuation
|
||||||
|
|
||||||
object OpEval : Operator {
|
object OpEval : Operator {
|
||||||
override fun operate(continuation: SpellContinuation, stack: MutableList<LegacySpellDatum<*>>, local: LegacySpellDatum<*>, ctx: CastingContext): OperationResult {
|
override fun operate(continuation: SpellContinuation, stack: MutableList<Iota>, local: Iota, ctx: CastingContext): OperationResult {
|
||||||
val instrs: SpellList = stack.getChecked(stack.lastIndex)
|
val instrs: SpellList = stack.getChecked(stack.lastIndex)
|
||||||
stack.removeLastOrNull()
|
stack.removeLastOrNull()
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,12 @@ package at.petrak.hexcasting.common.casting.operators.eval
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.OperationResult
|
import at.petrak.hexcasting.api.spell.OperationResult
|
||||||
import at.petrak.hexcasting.api.spell.Operator
|
import at.petrak.hexcasting.api.spell.Operator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.casting.SpellContinuation
|
import at.petrak.hexcasting.api.spell.casting.SpellContinuation
|
||||||
|
|
||||||
object OpEvalDelay : Operator {
|
object OpEvalDelay : Operator {
|
||||||
override fun operate(continuation: SpellContinuation, stack: MutableList<LegacySpellDatum<*>>, local: LegacySpellDatum<*>, ctx: CastingContext): OperationResult {
|
override fun operate(continuation: SpellContinuation, stack: MutableList<Iota>, local: Iota, ctx: CastingContext): OperationResult {
|
||||||
return OperationResult(continuation, stack, local, listOf())
|
return OperationResult(continuation, stack, local, listOf())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs
|
||||||
object OpForEach : Operator {
|
object OpForEach : Operator {
|
||||||
override fun operate(
|
override fun operate(
|
||||||
continuation: SpellContinuation,
|
continuation: SpellContinuation,
|
||||||
stack: MutableList<LegacySpellDatum<*>>,
|
stack: MutableList<Iota>,
|
||||||
local: LegacySpellDatum<*>,
|
local: Iota,
|
||||||
ctx: CastingContext
|
ctx: CastingContext
|
||||||
): OperationResult {
|
): OperationResult {
|
||||||
if (stack.size < 2)
|
if (stack.size < 2)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.eval
|
package at.petrak.hexcasting.common.casting.operators.eval
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.OperationResult
|
import at.petrak.hexcasting.api.spell.OperationResult
|
||||||
import at.petrak.hexcasting.api.spell.Operator
|
import at.petrak.hexcasting.api.spell.Operator
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
|
@ -9,8 +9,8 @@ import at.petrak.hexcasting.api.spell.casting.SpellContinuation
|
||||||
object OpHalt : Operator {
|
object OpHalt : Operator {
|
||||||
override fun operate(
|
override fun operate(
|
||||||
continuation: SpellContinuation,
|
continuation: SpellContinuation,
|
||||||
stack: MutableList<LegacySpellDatum<*>>,
|
stack: MutableList<Iota>,
|
||||||
local: LegacySpellDatum<*>,
|
local: Iota,
|
||||||
ctx: CastingContext
|
ctx: CastingContext
|
||||||
): OperationResult {
|
): OperationResult {
|
||||||
var newStack = stack.toList()
|
var newStack = stack.toList()
|
||||||
|
|
|
@ -5,7 +5,7 @@ import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
|
|
||||||
object OpAppend : ConstManaOperator {
|
object OpAppend : ConstManaOperator {
|
||||||
override val argc = 2
|
override val argc = 2
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val list = args.getChecked<SpellList>(0, argc).toMutableList()
|
val list = args.getChecked<SpellList>(0, argc).toMutableList()
|
||||||
val datum = args[1]
|
val datum = args[1]
|
||||||
list.add(datum)
|
list.add(datum)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
|
|
||||||
object OpConcat : ConstManaOperator {
|
object OpConcat : ConstManaOperator {
|
||||||
override val argc = 2
|
override val argc = 2
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val lhs = args.getChecked<SpellList>(0, argc).toMutableList()
|
val lhs = args.getChecked<SpellList>(0, argc).toMutableList()
|
||||||
val rhs = args.getChecked<SpellList>(1, argc)
|
val rhs = args.getChecked<SpellList>(1, argc)
|
||||||
lhs.addAll(rhs)
|
lhs.addAll(rhs)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
|
|
||||||
object OpCons : ConstManaOperator {
|
object OpCons : ConstManaOperator {
|
||||||
override val argc = 2
|
override val argc = 2
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val bottom = args.getChecked<SpellList>(0, argc)
|
val bottom = args.getChecked<SpellList>(0, argc)
|
||||||
val top = args[1]
|
val top = args[1]
|
||||||
return SpellList.LPair(top, bottom).asSpellResult
|
return SpellList.LPair(top, bottom).asSpellResult
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.lists
|
package at.petrak.hexcasting.common.casting.operators.lists
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
|
|
||||||
object OpEmptyList : ConstManaOperator {
|
object OpEmptyList : ConstManaOperator {
|
||||||
override val argc = 0
|
override val argc = 0
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
return emptyList<LegacySpellDatum<*>>().asSpellResult // sorry for taking all the easy impls, hudeler
|
return emptyList<Iota>().asSpellResult // sorry for taking all the easy impls, hudeler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import kotlin.math.roundToInt
|
||||||
|
|
||||||
object OpIndex : ConstManaOperator {
|
object OpIndex : ConstManaOperator {
|
||||||
override val argc = 2
|
override val argc = 2
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val list = args.getChecked<SpellList>(0, argc).toMutableList()
|
val list = args.getChecked<SpellList>(0, argc).toMutableList()
|
||||||
val index = args.getChecked<Double>(1, argc)
|
val index = args.getChecked<Double>(1, argc)
|
||||||
val x = list.getOrElse(index.roundToInt()) { LegacySpellDatum.make(Widget.NULL) }
|
val x = list.getOrElse(index.roundToInt()) { LegacySpellDatum.make(Widget.NULL) }
|
||||||
|
|
|
@ -7,7 +7,7 @@ object OpIndexOf : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 2
|
get() = 2
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val list = args.getChecked<SpellList>(0, argc).toMutableList()
|
val list = args.getChecked<SpellList>(0, argc).toMutableList()
|
||||||
val value = args[1]
|
val value = args[1]
|
||||||
return list.indexOfFirst(value::tolerantEquals).asSpellResult
|
return list.indexOfFirst(value::tolerantEquals).asSpellResult
|
||||||
|
|
|
@ -10,7 +10,7 @@ import kotlin.math.abs
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
object OpLastNToList : Operator {
|
object OpLastNToList : Operator {
|
||||||
override fun operate(continuation: SpellContinuation, stack: MutableList<LegacySpellDatum<*>>, local: LegacySpellDatum<*>, ctx: CastingContext): OperationResult {
|
override fun operate(continuation: SpellContinuation, stack: MutableList<Iota>, local: Iota, ctx: CastingContext): OperationResult {
|
||||||
if (stack.isEmpty())
|
if (stack.isEmpty())
|
||||||
throw MishapNotEnoughArgs(1, 0)
|
throw MishapNotEnoughArgs(1, 0)
|
||||||
val arg = stack.takeLast(1).getChecked<Double>(0)
|
val arg = stack.takeLast(1).getChecked<Double>(0)
|
||||||
|
@ -23,7 +23,7 @@ object OpLastNToList : Operator {
|
||||||
"hexcasting.mishap.invalid_value.int.between".asTranslatedComponent(0, stack.size)
|
"hexcasting.mishap.invalid_value.int.between".asTranslatedComponent(0, stack.size)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val output = mutableListOf<LegacySpellDatum<*>>()
|
val output = mutableListOf<Iota>()
|
||||||
output.addAll(stack.takeLast(arg.toInt()))
|
output.addAll(stack.takeLast(arg.toInt()))
|
||||||
val endSize = stack.size - output.toList().size
|
val endSize = stack.size - output.toList().size
|
||||||
while (stack.size != endSize) {
|
while (stack.size != endSize) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
// it's still called beancounter's distillation in my heart
|
// it's still called beancounter's distillation in my heart
|
||||||
object OpListSize : ConstManaOperator {
|
object OpListSize : ConstManaOperator {
|
||||||
override val argc = 1
|
override val argc = 1
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
return args.getChecked<SpellList>(0, argc).toList().size.asSpellResult // mmm one-liner
|
return args.getChecked<SpellList>(0, argc).toList().size.asSpellResult // mmm one-liner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import kotlin.math.roundToInt
|
||||||
|
|
||||||
object OpModifyInPlace : ConstManaOperator {
|
object OpModifyInPlace : ConstManaOperator {
|
||||||
override val argc = 3
|
override val argc = 3
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val list = args.getChecked<SpellList>(0, argc)
|
val list = args.getChecked<SpellList>(0, argc)
|
||||||
val index = args.getChecked<Double>(1, argc).roundToInt()
|
val index = args.getChecked<Double>(1, argc).roundToInt()
|
||||||
val iota = args[2]
|
val iota = args[2]
|
||||||
|
|
|
@ -7,7 +7,7 @@ object OpRemove : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 2
|
get() = 2
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val list = args.getChecked<SpellList>(0, argc).toMutableList()
|
val list = args.getChecked<SpellList>(0, argc).toMutableList()
|
||||||
val index = args.getChecked<Double>(1, argc).toInt()
|
val index = args.getChecked<Double>(1, argc).toInt()
|
||||||
if (index < 0 || index >= list.size)
|
if (index < 0 || index >= list.size)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
|
|
||||||
object OpReverski : ConstManaOperator {
|
object OpReverski : ConstManaOperator {
|
||||||
override val argc = 1
|
override val argc = 1
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
return args.getChecked<SpellList>(0, argc).toList().asReversed().asSpellResult // okay kotlin kinda pogged for this
|
return args.getChecked<SpellList>(0, argc).toList().asReversed().asSpellResult // okay kotlin kinda pogged for this
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.lists
|
package at.petrak.hexcasting.common.casting.operators.lists
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
|
|
||||||
object OpSingleton : ConstManaOperator {
|
object OpSingleton : ConstManaOperator {
|
||||||
override val argc = 1
|
override val argc = 1
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
return listOf(args[0]).asSpellResult // god i love one-liners
|
return listOf(args[0]).asSpellResult // god i love one-liners
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,13 +9,13 @@ import kotlin.math.roundToInt
|
||||||
|
|
||||||
object OpSlice : ConstManaOperator {
|
object OpSlice : ConstManaOperator {
|
||||||
override val argc = 3
|
override val argc = 3
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val list = args.getChecked<SpellList>(0, argc).toList()
|
val list = args.getChecked<SpellList>(0, argc).toList()
|
||||||
val index1 = Mth.clamp(args.getChecked<Double>(1, argc).roundToInt(), 0, list.size)
|
val index1 = Mth.clamp(args.getChecked<Double>(1, argc).roundToInt(), 0, list.size)
|
||||||
val index2 = Mth.clamp(args.getChecked<Double>(2, argc).roundToInt(), 0, list.size)
|
val index2 = Mth.clamp(args.getChecked<Double>(2, argc).roundToInt(), 0, list.size)
|
||||||
|
|
||||||
if (index1 == index2)
|
if (index1 == index2)
|
||||||
return emptyList<LegacySpellDatum<*>>().asSpellResult
|
return emptyList<Iota>().asSpellResult
|
||||||
|
|
||||||
return list.subList(min(index1, index2), max(index1, index2)).asSpellResult
|
return list.subList(min(index1, index2), max(index1, index2)).asSpellResult
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.lists
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.SpellList
|
import at.petrak.hexcasting.api.spell.SpellList
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
|
|
||||||
|
@ -10,6 +10,6 @@ object OpSplat : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 1
|
get() = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> =
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> =
|
||||||
args.getChecked<SpellList>(0, argc).toMutableList()
|
args.getChecked<SpellList>(0, argc).toMutableList()
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
|
|
||||||
object OpUnCons : ConstManaOperator {
|
object OpUnCons : ConstManaOperator {
|
||||||
override val argc = 1
|
override val argc = 1
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val list = args.getChecked<SpellList>(0, argc)
|
val list = args.getChecked<SpellList>(0, argc)
|
||||||
if (list.nonEmpty) {
|
if (list.nonEmpty) {
|
||||||
return spellListOf(list.cdr, list.car)
|
return spellListOf(list.cdr, list.car)
|
||||||
|
|
|
@ -2,15 +2,15 @@ package at.petrak.hexcasting.common.casting.operators.local
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.OperationResult
|
import at.petrak.hexcasting.api.spell.OperationResult
|
||||||
import at.petrak.hexcasting.api.spell.Operator
|
import at.petrak.hexcasting.api.spell.Operator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.casting.SpellContinuation
|
import at.petrak.hexcasting.api.spell.casting.SpellContinuation
|
||||||
|
|
||||||
object OpPeekLocal : Operator {
|
object OpPeekLocal : Operator {
|
||||||
override fun operate(
|
override fun operate(
|
||||||
continuation: SpellContinuation,
|
continuation: SpellContinuation,
|
||||||
stack: MutableList<LegacySpellDatum<*>>,
|
stack: MutableList<Iota>,
|
||||||
local: LegacySpellDatum<*>,
|
local: Iota,
|
||||||
ctx: CastingContext
|
ctx: CastingContext
|
||||||
): OperationResult {
|
): OperationResult {
|
||||||
stack.add(local)
|
stack.add(local)
|
||||||
|
|
|
@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.local
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.OperationResult
|
import at.petrak.hexcasting.api.spell.OperationResult
|
||||||
import at.petrak.hexcasting.api.spell.Operator
|
import at.petrak.hexcasting.api.spell.Operator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs
|
import at.petrak.hexcasting.api.spell.mishaps.MishapNotEnoughArgs
|
||||||
import at.petrak.hexcasting.api.spell.casting.SpellContinuation
|
import at.petrak.hexcasting.api.spell.casting.SpellContinuation
|
||||||
|
@ -10,8 +10,8 @@ import at.petrak.hexcasting.api.spell.casting.SpellContinuation
|
||||||
object OpPushLocal : Operator {
|
object OpPushLocal : Operator {
|
||||||
override fun operate(
|
override fun operate(
|
||||||
continuation: SpellContinuation,
|
continuation: SpellContinuation,
|
||||||
stack: MutableList<LegacySpellDatum<*>>,
|
stack: MutableList<Iota>,
|
||||||
local: LegacySpellDatum<*>,
|
local: Iota,
|
||||||
ctx: CastingContext
|
ctx: CastingContext
|
||||||
): OperationResult {
|
): OperationResult {
|
||||||
if (stack.isEmpty())
|
if (stack.isEmpty())
|
||||||
|
|
|
@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.numOrVec
|
import at.petrak.hexcasting.api.spell.numOrVec
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import kotlin.math.absoluteValue
|
import kotlin.math.absoluteValue
|
||||||
|
@ -11,7 +11,7 @@ object OpAbsLen : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 1
|
get() = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val x = numOrVec(args[0], 0)
|
val x = numOrVec(args[0], 0)
|
||||||
|
|
||||||
return x.map({ num -> num.absoluteValue }, { vec -> vec.length() }).asSpellResult
|
return x.map({ num -> num.absoluteValue }, { vec -> vec.length() }).asSpellResult
|
||||||
|
|
|
@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.numOrVec
|
import at.petrak.hexcasting.api.spell.numOrVec
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.spellListOf
|
import at.petrak.hexcasting.api.spell.spellListOf
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ object OpAdd : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 2
|
get() = 2
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val lhs = numOrVec(args[0], 1)
|
val lhs = numOrVec(args[0], 1)
|
||||||
val rhs = numOrVec(args[1], 0)
|
val rhs = numOrVec(args[1], 0)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math
|
package at.petrak.hexcasting.common.casting.operators.math
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -11,7 +11,7 @@ object OpCeil : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 1
|
get() = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val value = args.getChecked<Double>(0, argc)
|
val value = args.getChecked<Double>(0, argc)
|
||||||
return ceil(value).asSpellResult
|
return ceil(value).asSpellResult
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math
|
package at.petrak.hexcasting.common.casting.operators.math
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -12,7 +12,7 @@ object OpCoerceToAxial : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 1
|
get() = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val vec = args.getChecked<Vec3>(0, argc)
|
val vec = args.getChecked<Vec3>(0, argc)
|
||||||
if (vec == Vec3.ZERO)
|
if (vec == Vec3.ZERO)
|
||||||
return vec.asSpellResult
|
return vec.asSpellResult
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math
|
package at.petrak.hexcasting.common.casting.operators.math
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -9,7 +9,7 @@ import net.minecraft.world.phys.Vec3
|
||||||
|
|
||||||
object OpConstructVec : ConstManaOperator {
|
object OpConstructVec : ConstManaOperator {
|
||||||
override val argc = 3
|
override val argc = 3
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val x = args.getChecked<Double>(0, argc)
|
val x = args.getChecked<Double>(0, argc)
|
||||||
val y = args.getChecked<Double>(1, argc)
|
val y = args.getChecked<Double>(1, argc)
|
||||||
val z = args.getChecked<Double>(2, argc)
|
val z = args.getChecked<Double>(2, argc)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math
|
package at.petrak.hexcasting.common.casting.operators.math
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
import at.petrak.hexcasting.api.spell.spellListOf
|
import at.petrak.hexcasting.api.spell.spellListOf
|
||||||
|
@ -9,7 +9,7 @@ import net.minecraft.world.phys.Vec3
|
||||||
|
|
||||||
object OpDeconstructVec : ConstManaOperator {
|
object OpDeconstructVec : ConstManaOperator {
|
||||||
override val argc = 1
|
override val argc = 1
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val v = args.getChecked<Vec3>(0, argc)
|
val v = args.getChecked<Vec3>(0, argc)
|
||||||
return spellListOf(v.x, v.y, v.z)
|
return spellListOf(v.x, v.y, v.z)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.numOrVec
|
import at.petrak.hexcasting.api.spell.numOrVec
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.mishaps.MishapDivideByZero
|
import at.petrak.hexcasting.api.spell.mishaps.MishapDivideByZero
|
||||||
import at.petrak.hexcasting.api.spell.spellListOf
|
import at.petrak.hexcasting.api.spell.spellListOf
|
||||||
|
@ -12,7 +12,7 @@ object OpDivCross : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 2
|
get() = 2
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val lhs = numOrVec(args[0], 1)
|
val lhs = numOrVec(args[0], 1)
|
||||||
val rhs = numOrVec(args[1], 0)
|
val rhs = numOrVec(args[1], 0)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math
|
package at.petrak.hexcasting.common.casting.operators.math
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -11,7 +11,7 @@ object OpFloor : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 1
|
get() = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val value = args.getChecked<Double>(0, argc)
|
val value = args.getChecked<Double>(0, argc)
|
||||||
return floor(value).asSpellResult
|
return floor(value).asSpellResult
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math
|
package at.petrak.hexcasting.common.casting.operators.math
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -12,7 +12,7 @@ object OpLog : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 2
|
get() = 2
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val value = args.getChecked<Double>(0, argc)
|
val value = args.getChecked<Double>(0, argc)
|
||||||
val base = args.getChecked<Double>(1, argc)
|
val base = args.getChecked<Double>(1, argc)
|
||||||
if (value <= 0.0 || base <= 0.0 || base == 1.0)
|
if (value <= 0.0 || base <= 0.0 || base == 1.0)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math
|
package at.petrak.hexcasting.common.casting.operators.math
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -11,7 +11,7 @@ object OpModulo : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 2
|
get() = 2
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val l = args.getChecked<Double>(0, argc)
|
val l = args.getChecked<Double>(0, argc)
|
||||||
val r = args.getChecked<Double>(1, argc)
|
val r = args.getChecked<Double>(1, argc)
|
||||||
if (r == 0.0)
|
if (r == 0.0)
|
||||||
|
|
|
@ -3,14 +3,14 @@ package at.petrak.hexcasting.common.casting.operators.math
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.numOrVec
|
import at.petrak.hexcasting.api.spell.numOrVec
|
||||||
import at.petrak.hexcasting.api.spell.spellListOf
|
import at.petrak.hexcasting.api.spell.spellListOf
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
|
|
||||||
object OpMulDot : ConstManaOperator {
|
object OpMulDot : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 2
|
get() = 2
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val lhs = numOrVec(args[0], 1)
|
val lhs = numOrVec(args[0], 1)
|
||||||
val rhs = numOrVec(args[1], 0)
|
val rhs = numOrVec(args[1], 0)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.numOrVec
|
import at.petrak.hexcasting.api.spell.numOrVec
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.mishaps.MishapDivideByZero
|
import at.petrak.hexcasting.api.spell.mishaps.MishapDivideByZero
|
||||||
import at.petrak.hexcasting.api.spell.spellListOf
|
import at.petrak.hexcasting.api.spell.spellListOf
|
||||||
|
@ -13,7 +13,7 @@ object OpPowProj : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 2
|
get() = 2
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val lhs = numOrVec(args[0], 1)
|
val lhs = numOrVec(args[0], 1)
|
||||||
val rhs = numOrVec(args[1], 0)
|
val rhs = numOrVec(args[1], 0)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math
|
package at.petrak.hexcasting.common.casting.operators.math
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ object OpRandom : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 0
|
get() = 0
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
return ctx.world.random.nextDouble().asSpellResult
|
return ctx.world.random.nextDouble().asSpellResult
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package at.petrak.hexcasting.common.casting.operators.math
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.numOrVec
|
import at.petrak.hexcasting.api.spell.numOrVec
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.spellListOf
|
import at.petrak.hexcasting.api.spell.spellListOf
|
||||||
import net.minecraft.world.phys.Vec3
|
import net.minecraft.world.phys.Vec3
|
||||||
|
@ -11,7 +11,7 @@ object OpSub : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 2
|
get() = 2
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val lhs = numOrVec(args[0], 1)
|
val lhs = numOrVec(args[0], 1)
|
||||||
val rhs = numOrVec(args[1], 0)
|
val rhs = numOrVec(args[1], 0)
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import kotlin.math.roundToInt
|
||||||
object OpAnd : ConstManaOperator {
|
object OpAnd : ConstManaOperator {
|
||||||
override val argc = 2
|
override val argc = 2
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val firstParam = numOrList(args[0], 0)
|
val firstParam = numOrList(args[0], 0)
|
||||||
|
|
||||||
if (firstParam.right().isPresent) {
|
if (firstParam.right().isPresent) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math.bit
|
package at.petrak.hexcasting.common.casting.operators.math.bit
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -10,7 +10,7 @@ import kotlin.math.roundToInt
|
||||||
object OpNot : ConstManaOperator {
|
object OpNot : ConstManaOperator {
|
||||||
override val argc = 1
|
override val argc = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val num = args.getChecked<Double>(0, argc).roundToInt()
|
val num = args.getChecked<Double>(0, argc).roundToInt()
|
||||||
return num.inv().asSpellResult
|
return num.inv().asSpellResult
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import kotlin.math.roundToInt
|
||||||
object OpOr : ConstManaOperator {
|
object OpOr : ConstManaOperator {
|
||||||
override val argc = 2
|
override val argc = 2
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val firstParam = numOrList(args[0], 0)
|
val firstParam = numOrList(args[0], 0)
|
||||||
|
|
||||||
if (firstParam.right().isPresent) {
|
if (firstParam.right().isPresent) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
object OpToSet : ConstManaOperator {
|
object OpToSet : ConstManaOperator {
|
||||||
override val argc = 1
|
override val argc = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
return args.getChecked<SpellList>(0, argc).toSet().toList().asSpellResult
|
return args.getChecked<SpellList>(0, argc).toSet().toList().asSpellResult
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import kotlin.math.roundToInt
|
||||||
object OpXor : ConstManaOperator {
|
object OpXor : ConstManaOperator {
|
||||||
override val argc = 2
|
override val argc = 2
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val firstParam = numOrList(args[0], 0)
|
val firstParam = numOrList(args[0], 0)
|
||||||
|
|
||||||
if (firstParam.right().isPresent) {
|
if (firstParam.right().isPresent) {
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math.logic
|
package at.petrak.hexcasting.common.casting.operators.math.logic
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.Widget
|
import at.petrak.hexcasting.api.spell.Widget
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
|
|
||||||
object OpBoolAnd : ConstManaOperator {
|
object OpBoolAnd : ConstManaOperator {
|
||||||
override val argc = 2
|
override val argc = 2
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
return listOf(
|
return listOf(
|
||||||
if (args[0].payload == Widget.NULL)
|
if (args[0].payload == Widget.NULL)
|
||||||
LegacySpellDatum.make(Widget.NULL)
|
LegacySpellDatum.make(Widget.NULL)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
object OpBoolIdentityKindOf : ConstManaOperator {
|
object OpBoolIdentityKindOf : ConstManaOperator {
|
||||||
override val argc = 1
|
override val argc = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val payload = args[0].payload
|
val payload = args[0].payload
|
||||||
|
|
||||||
if (payload == Widget.NULL)
|
if (payload == Widget.NULL)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.world.phys.Vec3
|
||||||
object OpBoolNot : ConstManaOperator {
|
object OpBoolNot : ConstManaOperator {
|
||||||
override val argc = 1
|
override val argc = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val payload = args[0].payload
|
val payload = args[0].payload
|
||||||
val falsy =
|
val falsy =
|
||||||
payload == Widget.NULL || payload.tolerantEquals(0.0) || payload.tolerantEquals(Vec3.ZERO) || (payload is SpellList && !payload.nonEmpty)
|
payload == Widget.NULL || payload.tolerantEquals(0.0) || payload.tolerantEquals(Vec3.ZERO) || (payload is SpellList && !payload.nonEmpty)
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math.logic
|
package at.petrak.hexcasting.common.casting.operators.math.logic
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.Widget
|
import at.petrak.hexcasting.api.spell.Widget
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
|
|
||||||
object OpBoolOr : ConstManaOperator {
|
object OpBoolOr : ConstManaOperator {
|
||||||
override val argc = 2
|
override val argc = 2
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
return listOf(
|
return listOf(
|
||||||
if (args[0].payload == Widget.NULL)
|
if (args[0].payload == Widget.NULL)
|
||||||
args[1]
|
args[1]
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math.logic
|
package at.petrak.hexcasting.common.casting.operators.math.logic
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.Widget
|
import at.petrak.hexcasting.api.spell.Widget
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
|
|
||||||
object OpBoolXor : ConstManaOperator {
|
object OpBoolXor : ConstManaOperator {
|
||||||
override val argc = 2
|
override val argc = 2
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
return listOf(
|
return listOf(
|
||||||
if (args[0].payload != Widget.NULL && args[1].payload == Widget.NULL)
|
if (args[0].payload != Widget.NULL && args[1].payload == Widget.NULL)
|
||||||
args[0]
|
args[0]
|
||||||
|
|
|
@ -7,7 +7,7 @@ import java.util.function.BiPredicate
|
||||||
class OpCompare(val acceptsEqual: Boolean, val cmp: BiPredicate<Double, Double>) : ConstManaOperator {
|
class OpCompare(val acceptsEqual: Boolean, val cmp: BiPredicate<Double, Double>) : ConstManaOperator {
|
||||||
override val argc = 2
|
override val argc = 2
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val lhs = args.getChecked<Double>(0, argc)
|
val lhs = args.getChecked<Double>(0, argc)
|
||||||
val rhs = args.getChecked<Double>(1, argc)
|
val rhs = args.getChecked<Double>(1, argc)
|
||||||
if (lhs.tolerantEquals(rhs))
|
if (lhs.tolerantEquals(rhs))
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math.logic
|
package at.petrak.hexcasting.common.casting.operators.math.logic
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.tolerantEquals
|
import at.petrak.hexcasting.api.spell.tolerantEquals
|
||||||
|
@ -9,7 +9,7 @@ import at.petrak.hexcasting.api.spell.tolerantEquals
|
||||||
class OpEquality(val invert: Boolean) : ConstManaOperator {
|
class OpEquality(val invert: Boolean) : ConstManaOperator {
|
||||||
override val argc = 2
|
override val argc = 2
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val lhs = args[0]
|
val lhs = args[0]
|
||||||
val rhs = args[1]
|
val rhs = args[1]
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math.trig
|
package at.petrak.hexcasting.common.casting.operators.math.trig
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -13,7 +13,7 @@ object OpArcCos : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 1
|
get() = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val value = args.getChecked<Double>(0, argc)
|
val value = args.getChecked<Double>(0, argc)
|
||||||
if (value < -1 || value > 1)
|
if (value < -1 || value > 1)
|
||||||
throw MishapInvalidIota(
|
throw MishapInvalidIota(
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math.trig
|
package at.petrak.hexcasting.common.casting.operators.math.trig
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -13,7 +13,7 @@ object OpArcSin : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 1
|
get() = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val value = args.getChecked<Double>(0, argc)
|
val value = args.getChecked<Double>(0, argc)
|
||||||
if (value < -1 || value > 1)
|
if (value < -1 || value > 1)
|
||||||
throw MishapInvalidIota(
|
throw MishapInvalidIota(
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math.trig
|
package at.petrak.hexcasting.common.casting.operators.math.trig
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -11,7 +11,7 @@ object OpArcTan : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 1
|
get() = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val value = args.getChecked<Double>(0, argc)
|
val value = args.getChecked<Double>(0, argc)
|
||||||
return atan(value).asSpellResult
|
return atan(value).asSpellResult
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math.trig
|
package at.petrak.hexcasting.common.casting.operators.math.trig
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -11,7 +11,7 @@ object OpCos : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 1
|
get() = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val angle = args.getChecked<Double>(0, argc)
|
val angle = args.getChecked<Double>(0, argc)
|
||||||
return cos(angle).asSpellResult
|
return cos(angle).asSpellResult
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package at.petrak.hexcasting.common.casting.operators.math.trig
|
package at.petrak.hexcasting.common.casting.operators.math.trig
|
||||||
|
|
||||||
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.LegacySpellDatum
|
import at.petrak.hexcasting.api.spell.iota.Iota
|
||||||
import at.petrak.hexcasting.api.spell.asSpellResult
|
import at.petrak.hexcasting.api.spell.asSpellResult
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.spell.getChecked
|
import at.petrak.hexcasting.api.spell.getChecked
|
||||||
|
@ -11,7 +11,7 @@ object OpSin : ConstManaOperator {
|
||||||
override val argc: Int
|
override val argc: Int
|
||||||
get() = 1
|
get() = 1
|
||||||
|
|
||||||
override fun execute(args: List<LegacySpellDatum<*>>, ctx: CastingContext): List<LegacySpellDatum<*>> {
|
override fun execute(args: List<Iota>, ctx: CastingContext): List<Iota> {
|
||||||
val angle = args.getChecked<Double>(0, argc)
|
val angle = args.getChecked<Double>(0, argc)
|
||||||
return sin(angle).asSpellResult
|
return sin(angle).asSpellResult
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue