From 46cfa01a6ac94b0cf93e31e410f8795cdb0c68cb Mon Sep 17 00:00:00 2001 From: Sollace Date: Sun, 5 Mar 2023 16:37:04 +0000 Subject: [PATCH] Spells should not affect bedrock. Fixes #103 --- .../com/minelittlepony/unicopia/ability/magic/Caster.java | 4 ++++ .../unicopia/ability/magic/spell/effect/CatapultSpell.java | 1 + 2 files changed, 5 insertions(+) diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/Caster.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/Caster.java index f757f030..e3dd13ee 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/Caster.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/Caster.java @@ -65,6 +65,10 @@ public interface Caster extends default boolean canModifyAt(BlockPos pos, ModificationType mod) { if (mod.checkPhysical()) { + if (asWorld().getBlockState(pos).getHardness(asWorld(), pos) < 0) { + return false; + } + if (getMaster() instanceof PlayerEntity player) { if (!asWorld().canPlayerModifyAt(player, pos)) { return false; diff --git a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/CatapultSpell.java b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/CatapultSpell.java index f00d9020..e67881f6 100644 --- a/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/CatapultSpell.java +++ b/src/main/java/com/minelittlepony/unicopia/ability/magic/spell/effect/CatapultSpell.java @@ -12,6 +12,7 @@ import com.minelittlepony.unicopia.mixin.MixinFallingBlockEntity; import com.minelittlepony.unicopia.projectile.MagicProjectileEntity; import com.minelittlepony.unicopia.projectile.ProjectileDelegate; +import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.FallingBlockEntity; import net.minecraft.util.hit.BlockHitResult;