edify sapling is no longer a combat spell
This commit is contained in:
parent
d6cbbf57e9
commit
bbb5638fb5
3 changed files with 6 additions and 5 deletions
|
@ -1,9 +1,9 @@
|
||||||
package at.petrak.hexcasting.api.spell.mishaps
|
package at.petrak.hexcasting.api.spell.mishaps
|
||||||
|
|
||||||
|
import at.petrak.hexcasting.api.misc.FrozenColorizer
|
||||||
import at.petrak.hexcasting.api.spell.ParticleSpray
|
import at.petrak.hexcasting.api.spell.ParticleSpray
|
||||||
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 net.minecraft.core.BlockPos
|
import net.minecraft.core.BlockPos
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.network.chat.TranslatableComponent
|
import net.minecraft.network.chat.TranslatableComponent
|
||||||
|
@ -16,7 +16,7 @@ class MishapBadBlock(val pos: BlockPos, val expected: Component) : Mishap() {
|
||||||
dyeColor(DyeColor.LIME)
|
dyeColor(DyeColor.LIME)
|
||||||
|
|
||||||
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<SpellDatum<*>>) {
|
override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList<SpellDatum<*>>) {
|
||||||
ctx.world.explode(null, pos.x + 0.5, pos.y + 0.5, pos.z + 0.5, 2f, Explosion.BlockInteraction.NONE)
|
ctx.world.explode(null, pos.x + 0.5, pos.y + 0.5, pos.z + 0.5, 0.1f, Explosion.BlockInteraction.NONE)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun particleSpray(ctx: CastingContext): ParticleSpray {
|
override fun particleSpray(ctx: CastingContext): ParticleSpray {
|
||||||
|
|
|
@ -31,7 +31,7 @@ class OpGetEntitiesBy(val checker: Predicate<Entity>, val negate: Boolean) : Con
|
||||||
val entitiesGot = ctx.world.getEntities(
|
val entitiesGot = ctx.world.getEntities(
|
||||||
null,
|
null,
|
||||||
aabb
|
aabb
|
||||||
) { (checker.test(it) != negate) && ctx.isEntityInRange(it) && it.distanceToSqr(pos) <= radius * radius }
|
) { (checker.test(it) != negate) && ctx.isEntityInRange(it) && it.isAlive && !it.isSpectator && it.distanceToSqr(pos) <= radius * radius }
|
||||||
.sortedBy { it.distanceToSqr(pos) }
|
.sortedBy { it.distanceToSqr(pos) }
|
||||||
return spellListOf(entitiesGot)
|
return spellListOf(entitiesGot)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,8 @@ import at.petrak.hexcasting.api.spell.ConstManaOperator
|
||||||
import at.petrak.hexcasting.api.spell.Operator.Companion.getChecked
|
import at.petrak.hexcasting.api.spell.Operator.Companion.getChecked
|
||||||
import at.petrak.hexcasting.api.spell.Operator.Companion.spellListOf
|
import at.petrak.hexcasting.api.spell.Operator.Companion.spellListOf
|
||||||
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.Widget
|
import at.petrak.hexcasting.api.spell.Widget
|
||||||
|
import at.petrak.hexcasting.api.spell.casting.CastingContext
|
||||||
import net.minecraft.world.entity.Entity
|
import net.minecraft.world.entity.Entity
|
||||||
import net.minecraft.world.phys.AABB
|
import net.minecraft.world.phys.AABB
|
||||||
import net.minecraft.world.phys.Vec3
|
import net.minecraft.world.phys.Vec3
|
||||||
|
@ -17,7 +17,8 @@ class OpGetEntityAt(val checker: Predicate<Entity>) : ConstManaOperator {
|
||||||
val pos = args.getChecked<Vec3>(0)
|
val pos = args.getChecked<Vec3>(0)
|
||||||
ctx.assertVecInRange(pos)
|
ctx.assertVecInRange(pos)
|
||||||
val aabb = AABB(pos.add(Vec3(-0.5, -0.5, -0.5)), pos.add(Vec3(0.5, 0.5, 0.5)))
|
val aabb = AABB(pos.add(Vec3(-0.5, -0.5, -0.5)), pos.add(Vec3(0.5, 0.5, 0.5)))
|
||||||
val entitiesGot = ctx.world.getEntities(null, aabb, checker)
|
val entitiesGot = ctx.world.getEntities(null, aabb)
|
||||||
|
{ checker.test(it) && ctx.isEntityInRange(it) && it.isAlive && !it.isSpectator }
|
||||||
|
|
||||||
val entity = entitiesGot.getOrNull(0) ?: Widget.NULL
|
val entity = entitiesGot.getOrNull(0) ?: Widget.NULL
|
||||||
return spellListOf(entity)
|
return spellListOf(entity)
|
||||||
|
|
Loading…
Reference in a new issue