Prevent mobs from pathfinding through spikes

This commit is contained in:
Sollace 2023-10-15 16:52:28 +01:00
parent c23fead5f2
commit 8ab12318f7
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -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;
}
}