fix it but again
This commit is contained in:
parent
13c04f2348
commit
2d64c4ec18
1 changed files with 6 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
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.SpellDatum
|
||||||
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
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<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<SpellDatum<*>>) {
|
||||||
// Knock the player's items out of their hands
|
// Knock the player's items out of their hands
|
||||||
val items = listOf(
|
val items = mutableListOf<ItemStack>()
|
||||||
ctx.caster.mainHandItem.copy(),
|
|
||||||
ctx.caster.offhandItem.copy()
|
|
||||||
)
|
|
||||||
for (hand in InteractionHand.values()) {
|
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)
|
val delta = entity.position().subtract(ctx.position).normalize().scale(0.5)
|
||||||
|
|
Loading…
Reference in a new issue