Exclude doors from the catapult spell's effects

This commit is contained in:
Sollace 2023-08-27 18:59:07 +01:00
parent 8c7bb8c700
commit 2bf0cb63db
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
3 changed files with 15 additions and 0 deletions

View file

@ -36,6 +36,7 @@ public interface UTags {
TagKey<Block> GLASS_BLOCKS = block("glass_blocks");
TagKey<Block> FRAGILE = block("fragile");
TagKey<Block> INTERESTING = block("interesting");
TagKey<Block> CATAPULT_IMMUNE = block("catapult_immune");
TagKey<Block> CRYSTAL_HEART_BASE = block("crystal_heart_base");
TagKey<Block> CRYSTAL_HEART_ORNAMENT = block("crystal_heart_ornament");

View file

@ -4,6 +4,7 @@ import java.util.function.Consumer;
import org.jetbrains.annotations.Nullable;
import com.minelittlepony.unicopia.UTags;
import com.minelittlepony.unicopia.ability.magic.Caster;
import com.minelittlepony.unicopia.ability.magic.spell.Situation;
import com.minelittlepony.unicopia.ability.magic.spell.trait.SpellTraits;
@ -12,6 +13,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;
@ -82,6 +84,11 @@ public class CatapultSpell extends AbstractSpell implements ProjectileDelegate.B
return;
}
BlockState state = world.getBlockState(bpos);
if (state.isIn(UTags.CATAPULT_IMMUNE)) {
return;
}
Vec3d pos = Vec3d.ofBottomCenter(bpos);
FallingBlockEntity e = MixinFallingBlockEntity.createInstance(world, pos.x, pos.y, pos.z, world.getBlockState(bpos));
world.removeBlock(bpos, true);

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"minecraft:bedrock",
"#minecraft:doors"
]
}