2023-01-20 20:27:35 +01:00
|
|
|
package at.petrak.hexcasting.api.casting.mishaps
|
2022-03-26 17:45:31 +01:00
|
|
|
|
2023-01-22 03:29:09 +01:00
|
|
|
import at.petrak.hexcasting.api.casting.eval.CastingEnvironment
|
2023-01-20 20:27:35 +01:00
|
|
|
import at.petrak.hexcasting.api.casting.iota.Iota
|
|
|
|
import at.petrak.hexcasting.api.casting.iota.Vec3Iota
|
2023-04-27 21:26:15 +02:00
|
|
|
import at.petrak.hexcasting.api.pigment.FrozenPigment
|
2022-05-25 22:34:46 +02:00
|
|
|
import net.minecraft.network.chat.Component
|
2022-03-26 17:45:31 +01:00
|
|
|
import net.minecraft.world.item.DyeColor
|
|
|
|
import net.minecraft.world.phys.Vec3
|
|
|
|
|
2023-04-24 20:34:11 +02:00
|
|
|
class MishapBadLocation(val location: Vec3, val type: String = "too_far") : Mishap() {
|
2023-04-27 21:26:15 +02:00
|
|
|
override fun accentColor(ctx: CastingEnvironment, errorCtx: Context): FrozenPigment =
|
2022-03-26 17:45:31 +01:00
|
|
|
dyeColor(DyeColor.MAGENTA)
|
|
|
|
|
2023-01-22 03:29:09 +01:00
|
|
|
override fun execute(ctx: CastingEnvironment, errorCtx: Context, stack: MutableList<Iota>) {
|
2023-02-15 07:26:28 +01:00
|
|
|
ctx.mishapEnvironment.yeetHeldItemsTowards(this.location)
|
2022-03-26 17:45:31 +01:00
|
|
|
}
|
|
|
|
|
2023-01-22 03:29:09 +01:00
|
|
|
override fun errorMessage(ctx: CastingEnvironment, errorCtx: Context): Component =
|
2023-01-20 20:27:35 +01:00
|
|
|
error("location_$type", Vec3Iota.display(location))
|
2022-04-12 21:13:51 +02:00
|
|
|
}
|