diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpIgnite.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpIgnite.kt index 4e6e7d345..eeb7fae5c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpIgnite.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/actions/spells/OpIgnite.kt @@ -5,7 +5,11 @@ import at.petrak.hexcasting.api.casting.RenderedSpell import at.petrak.hexcasting.api.casting.castables.SpellAction import at.petrak.hexcasting.api.casting.eval.CastingEnvironment import at.petrak.hexcasting.api.casting.getBlockPos +import at.petrak.hexcasting.api.casting.getEntity +import at.petrak.hexcasting.api.casting.iota.EntityIota import at.petrak.hexcasting.api.casting.iota.Iota +import at.petrak.hexcasting.api.casting.iota.Vec3Iota +import at.petrak.hexcasting.api.casting.mishaps.MishapInvalidIota import at.petrak.hexcasting.api.misc.MediaConstants import at.petrak.hexcasting.ktxt.UseOnContext import at.petrak.hexcasting.xplat.IXplatAbstractions @@ -13,6 +17,7 @@ import net.minecraft.core.BlockPos import net.minecraft.core.Direction import net.minecraft.server.level.ServerPlayer import net.minecraft.world.InteractionHand +import net.minecraft.world.entity.Entity import net.minecraft.world.item.Item import net.minecraft.world.item.ItemStack import net.minecraft.world.item.Items @@ -25,17 +30,30 @@ object OpIgnite : SpellAction { args: List, env: CastingEnvironment ): SpellAction.Result { - val target = args.getBlockPos(0, argc) - env.assertPosInRangeForEditing(target) - - return SpellAction.Result( - Spell(target), - MediaConstants.DUST_UNIT, - listOf(ParticleSpray.burst(Vec3.atCenterOf(BlockPos(target)), 1.0)) - ) + when (val target = args[0]) { + is EntityIota -> { + val entity = args.getEntity(0, argc) + env.assertEntityInRange(entity) + return SpellAction.Result( + EntitySpell(entity), + MediaConstants.DUST_UNIT, + listOf(ParticleSpray.burst(entity.position(), 1.0)) + ) + } + is Vec3Iota -> { + val block = args.getBlockPos(0, argc) + env.assertPosInRangeForEditing(block) + return SpellAction.Result( + BlockSpell(block), + MediaConstants.DUST_UNIT, + listOf(ParticleSpray.burst(Vec3.atCenterOf(BlockPos(block)), 1.0)) + ) + } + else -> throw MishapInvalidIota.ofType(target, 0, "entity_or_vector") + } } - private data class Spell(val pos: BlockPos) : RenderedSpell { + private data class BlockSpell(val pos: BlockPos) : RenderedSpell { override fun cast(env: CastingEnvironment) { // help if (!tryToClick(env, pos, Items.FIRE_CHARGE)) { @@ -56,4 +74,10 @@ object OpIgnite : SpellAction { ).consumesAction() } } -} + + private data class EntitySpell(val entity: Entity) : RenderedSpell { + override fun cast(env: CastingEnvironment) { + entity.setSecondsOnFire(8) + } + } +} \ No newline at end of file diff --git a/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 b/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 index cf89613f5..784494f1c 100644 --- a/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 +++ b/Common/src/main/resources/assets/hexcasting/lang/en_us.flatten.json5 @@ -929,6 +929,8 @@ living: "a living entity", }, + entity_or_vector: "an entity or a vector", + unknown: "(unknown, uh-oh, this is a bug)", }, @@ -1834,7 +1836,7 @@ conjure_light: "Conjure a magical light that softly glows with my pigment at the given position. Costs about one $(l:items/amethyst)$(item)Amethyst Dust/$.", bonemeal: "Encourage a plant or sapling at the target position to grow, as if $(item)Bonemeal/$ was applied. Costs a bit more than one $(l:items/amethyst)$(item)Amethyst Dust/$.", edify: "Forcibly infuse _media into the sapling at the target position, causing it to grow into an $(l:items/edified)$(thing)Edified Tree/$. Costs about one $(l:items/amethyst)$(item)Charged Amethyst/$.", - ignite: "Start a fire on top of the given location, as if a $(item)Fire Charge/$ was applied. Costs about one $(l:items/amethyst)$(item)Amethyst Dust/$.", + ignite: "Start a fire on top of the given location, as if a $(item)Fire Charge/$ was applied, or sets fire to a creature. Costs about one $(l:items/amethyst)$(item)Amethyst Dust/$.", extinguish: "Extinguish blocks in a large area. Costs about six $(l:items/amethyst)$(item)Amethyst Dust/$.", }, diff --git a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/spells/blockworks.json b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/spells/blockworks.json index 7a414d9ea..f39e871d4 100644 --- a/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/spells/blockworks.json +++ b/Common/src/main/resources/assets/hexcasting/patchouli_books/thehexbook/en_us/entries/patterns/spells/blockworks.json @@ -74,7 +74,7 @@ "type": "hexcasting:pattern", "op_id": "hexcasting:ignite", "anchor": "hexcasting:ignite", - "input": "vector", + "input": "entity | vector", "output": "", "text": "hexcasting.page.blockworks.ignite" }, @@ -87,4 +87,4 @@ "text": "hexcasting.page.blockworks.extinguish" } ] -} +} \ No newline at end of file