allow RenderedSpells to modify the stack/userdata.

This commit is contained in:
Talia-12 2023-07-10 11:51:45 +10:00
parent b50d12464a
commit 3c426a89ee
4 changed files with 9 additions and 3 deletions

View file

@ -1,7 +1,13 @@
package at.petrak.hexcasting.api.casting
import at.petrak.hexcasting.api.casting.eval.CastingEnvironment
import at.petrak.hexcasting.api.casting.eval.vm.CastingImage
interface RenderedSpell {
fun cast(env: CastingEnvironment)
fun cast(env: CastingEnvironment, image: CastingImage): CastingImage? {
cast(env)
return null
}
}

View file

@ -47,7 +47,7 @@ public abstract class PlayerBasedCastEnv extends CastingEnvironment {
}
@Override
public @Nullable ServerPlayer getCaster() {
public ServerPlayer getCaster() {
return this.caster;
}

View file

@ -39,7 +39,7 @@ sealed class OperatorSideEffect {
) :
OperatorSideEffect() {
override fun performEffect(harness: CastingVM): Boolean {
this.spell.cast(harness.env)
this.spell.cast(harness.env, harness.image)?.let { harness.image = it }
if (awardStat)
harness.env.caster?.awardStat(HexStatistics.SPELLS_CAST)

View file

@ -10,7 +10,7 @@ jetbrainsAnnotationsVersion=23.0.0
minecraftVersion=1.20.1
kotlinVersion=1.7.20
modVersion=0.11.1-4
modVersion=0.11.1-5
paucalVersion=0.6.0
patchouliVersion=80