fix it but again

This commit is contained in:
yrsegal@gmail.com 2022-04-13 17:05:50 -04:00
parent 13c04f2348
commit 2d64c4ec18

View file

@ -1,5 +1,6 @@
package at.petrak.hexcasting.api.spell.mishaps
import at.petrak.hexcasting.api.item.CasterItem
import at.petrak.hexcasting.api.spell.SpellDatum
import at.petrak.hexcasting.api.spell.casting.CastingContext
import at.petrak.hexcasting.api.misc.FrozenColorizer
@ -15,12 +16,12 @@ class MishapEntityTooFarAway(val entity: Entity) : Mishap() {
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<SpellDatum<*>>) {
// Knock the player's items out of their hands
val items = listOf(
ctx.caster.mainHandItem.copy(),
ctx.caster.offhandItem.copy()
)
val items = mutableListOf<ItemStack>()
for (hand in InteractionHand.values()) {
ctx.caster.setItemInHand(hand, ItemStack.EMPTY.copy())
if (hand != ctx.castingHand || ctx.caster.getItemInHand(hand).item !is CasterItem) {
items.add(ctx.caster.getItemInHand(hand).copy())
ctx.caster.setItemInHand(hand, ItemStack.EMPTY)
}
}
val delta = entity.position().subtract(ctx.position).normalize().scale(0.5)