Consistency with Explosion
And slight rewording.
This commit is contained in:
parent
904dd05504
commit
ffc5435d69
4 changed files with 12 additions and 53 deletions
|
@ -109,9 +109,9 @@ public class RegisterPatterns {
|
|||
PatternRegistry.mapPattern(HexPattern.FromAnglesSig("dedwedade", HexDir.SOUTH_WEST), prefix("destroy_water"),
|
||||
OpDestroyWater.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.FromAnglesSig("qqa", HexDir.NORTH_EAST), prefix("conjure_block"),
|
||||
OpConjureBlock.INSTANCE);
|
||||
new OpConjure(false));
|
||||
PatternRegistry.mapPattern(HexPattern.FromAnglesSig("qqd", HexDir.NORTH_EAST), prefix("conjure_light"),
|
||||
OpConjureLight.INSTANCE);
|
||||
new OpConjure(true));
|
||||
PatternRegistry.mapPattern(HexPattern.FromAnglesSig("waawawaawa", HexDir.NORTH_EAST), prefix("bonemeal"),
|
||||
OpTheOnlyReasonAnyoneDownloadedPsi.INSTANCE);
|
||||
PatternRegistry.mapPattern(HexPattern.FromAnglesSig("qqqqqwaeaeaeaeaea", HexDir.NORTH_WEST),
|
||||
|
|
|
@ -7,28 +7,31 @@ import at.petrak.hexcasting.api.SpellOperator
|
|||
import at.petrak.hexcasting.common.blocks.BlockConjured
|
||||
import at.petrak.hexcasting.common.blocks.HexBlocks
|
||||
import at.petrak.hexcasting.common.casting.CastingContext
|
||||
import at.petrak.hexcasting.common.casting.colors.CapPreferredColorizer
|
||||
import at.petrak.hexcasting.common.lib.HexCapabilities
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.world.phys.Vec3
|
||||
|
||||
object OpConjureBlock : SpellOperator {
|
||||
class OpConjure(val light: Boolean) : SpellOperator {
|
||||
override val argc = 1
|
||||
override fun execute(args: List<SpellDatum<*>>, ctx: CastingContext): Triple<RenderedSpell, Int, List<Vec3>> {
|
||||
val target = args.getChecked<Vec3>(0)
|
||||
ctx.assertVecInRange(target)
|
||||
|
||||
return Triple(
|
||||
Spell(target),
|
||||
Spell(target, light),
|
||||
10_000,
|
||||
listOf(target)
|
||||
)
|
||||
}
|
||||
|
||||
private data class Spell(val target: Vec3) : RenderedSpell {
|
||||
private data class Spell(val target: Vec3, val light: Boolean) : RenderedSpell {
|
||||
override fun cast(ctx: CastingContext) {
|
||||
if (ctx.world.getBlockState(BlockPos(target)).isAir) {
|
||||
ctx.world.setBlock(BlockPos(target), HexBlocks.CONJURED.get().defaultBlockState(), 2)
|
||||
var state = HexBlocks.CONJURED.get().defaultBlockState()
|
||||
if (this.light) {
|
||||
state = state.setValue(BlockConjured.LIGHT, true)
|
||||
}
|
||||
ctx.world.setBlock(BlockPos(target), state, 2)
|
||||
|
||||
val maybeCap = ctx.caster.getCapability(HexCapabilities.PREFERRED_COLORIZER).resolve()
|
||||
if (!maybeCap.isPresent)
|
|
@ -1,44 +0,0 @@
|
|||
package at.petrak.hexcasting.common.casting.operators.spells
|
||||
|
||||
import at.petrak.hexcasting.api.Operator.Companion.getChecked
|
||||
import at.petrak.hexcasting.api.RenderedSpell
|
||||
import at.petrak.hexcasting.api.SpellDatum
|
||||
import at.petrak.hexcasting.api.SpellOperator
|
||||
import at.petrak.hexcasting.common.blocks.BlockConjured
|
||||
import at.petrak.hexcasting.common.blocks.HexBlocks
|
||||
import at.petrak.hexcasting.common.casting.CastingContext
|
||||
import at.petrak.hexcasting.common.casting.colors.CapPreferredColorizer
|
||||
import at.petrak.hexcasting.common.lib.HexCapabilities
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.world.phys.Vec3
|
||||
|
||||
object OpConjureLight : SpellOperator {
|
||||
override val argc = 1
|
||||
override fun execute(args: List<SpellDatum<*>>, ctx: CastingContext): Triple<RenderedSpell, Int, List<Vec3>> {
|
||||
val target = args.getChecked<Vec3>(0)
|
||||
ctx.assertVecInRange(target)
|
||||
|
||||
return Triple(
|
||||
Spell(target),
|
||||
10_000,
|
||||
listOf(target)
|
||||
)
|
||||
}
|
||||
|
||||
private data class Spell(val target: Vec3) : RenderedSpell {
|
||||
override fun cast(ctx: CastingContext) {
|
||||
if (ctx.world.getBlockState(BlockPos(target)).isAir) {
|
||||
ctx.world.setBlock(BlockPos(target), HexBlocks.CONJURED.get().defaultBlockState().setValue(BlockConjured.LIGHT, true), 2)
|
||||
|
||||
val maybeCap = ctx.caster.getCapability(HexCapabilities.PREFERRED_COLORIZER).resolve()
|
||||
if (!maybeCap.isPresent)
|
||||
return
|
||||
val cap = maybeCap.get()
|
||||
|
||||
if (ctx.world.getBlockState(BlockPos(target)).block is BlockConjured) {
|
||||
BlockConjured.setColor(ctx.world, BlockPos(target), cap.colorizer)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,7 +44,7 @@
|
|||
"anchor": "hexcasting:conjure_block",
|
||||
"input": "vector",
|
||||
"output": "",
|
||||
"text": "Conjure a barrier which can be colored with a colorizer. Costs about one $(item)Amethyst Dust/$."
|
||||
"text": "Conjure a barrier, using your colorizer. Costs about one $(item)Amethyst Dust/$."
|
||||
},
|
||||
{
|
||||
"type": "hexcasting:pattern",
|
||||
|
@ -52,7 +52,7 @@
|
|||
"anchor": "hexcasting:conjure_light",
|
||||
"input": "vector",
|
||||
"output": "",
|
||||
"text": "Conjure a magical light which can be colored with a colorizer. Costs about one $(item)Amethyst Dust/$."
|
||||
"text": "Conjure a magical light, using your colorizer. Costs about one $(item)Amethyst Dust/$."
|
||||
},
|
||||
{
|
||||
"type": "hexcasting:pattern",
|
||||
|
|
Loading…
Reference in a new issue