From bbb5638fb5c79b4b497f84dcd69db6753c78b43d Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Fri, 29 Apr 2022 15:22:31 -0400 Subject: [PATCH] edify sapling is no longer a combat spell --- .../at/petrak/hexcasting/api/spell/mishaps/MishapBadBlock.kt | 4 ++-- .../common/casting/operators/selectors/OpGetEntitiesBy.kt | 2 +- .../common/casting/operators/selectors/OpGetEntityAt.kt | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadBlock.kt b/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadBlock.kt index 80dd1bcf..c572345a 100644 --- a/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadBlock.kt +++ b/Common/src/main/java/at/petrak/hexcasting/api/spell/mishaps/MishapBadBlock.kt @@ -1,9 +1,9 @@ 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.SpellDatum import at.petrak.hexcasting.api.spell.casting.CastingContext -import at.petrak.hexcasting.api.misc.FrozenColorizer import net.minecraft.core.BlockPos import net.minecraft.network.chat.Component import net.minecraft.network.chat.TranslatableComponent @@ -16,7 +16,7 @@ class MishapBadBlock(val pos: BlockPos, val expected: Component) : Mishap() { dyeColor(DyeColor.LIME) override fun execute(ctx: CastingContext, errorCtx: Context, stack: MutableList>) { - 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 { diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntitiesBy.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntitiesBy.kt index 575bf8d5..b9cfc538 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntitiesBy.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntitiesBy.kt @@ -31,7 +31,7 @@ class OpGetEntitiesBy(val checker: Predicate, val negate: Boolean) : Con val entitiesGot = ctx.world.getEntities( null, 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) } return spellListOf(entitiesGot) } diff --git a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntityAt.kt b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntityAt.kt index 3d6b1afa..51c6491c 100644 --- a/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntityAt.kt +++ b/Common/src/main/java/at/petrak/hexcasting/common/casting/operators/selectors/OpGetEntityAt.kt @@ -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.spellListOf 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.casting.CastingContext import net.minecraft.world.entity.Entity import net.minecraft.world.phys.AABB import net.minecraft.world.phys.Vec3 @@ -17,7 +17,8 @@ class OpGetEntityAt(val checker: Predicate) : ConstManaOperator { val pos = args.getChecked(0) 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 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 return spellListOf(entity)