From 8ab12318f7e858814ee9c002bf8ed4582de45e4c Mon Sep 17 00:00:00 2001 From: Sollace Date: Sun, 15 Oct 2023 16:52:28 +0100 Subject: [PATCH] Prevent mobs from pathfinding through spikes --- .../com/minelittlepony/unicopia/block/SpikesBlock.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/minelittlepony/unicopia/block/SpikesBlock.java b/src/main/java/com/minelittlepony/unicopia/block/SpikesBlock.java index 019d824a..aacb36e2 100644 --- a/src/main/java/com/minelittlepony/unicopia/block/SpikesBlock.java +++ b/src/main/java/com/minelittlepony/unicopia/block/SpikesBlock.java @@ -8,11 +8,13 @@ import net.minecraft.block.SideShapeType; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.ai.pathing.NavigationType; import net.minecraft.item.ItemPlacementContext; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; +import net.minecraft.world.BlockView; import net.minecraft.world.World; import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldView; @@ -82,4 +84,9 @@ public class SpikesBlock extends OrientedBlock { } return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); } + + @Override + public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) { + return false; + } }