Hey Tom,
TJ/WJ 4.0L Engine blocks underwent clean sheet design changes effective in the 1999 WJ Grand and 2000 TJ Wrangler. These re-designed WJ/TJ engine blocks are not bolt on interchangeable with XJ/ZJ blocks. The motor mount bolt holes and belt driven accessory mounting bolt holes are in different locations, or not present at all, TJ/WJ vs. XJ/ZJ. It is possible to drill and tap the necessary holes and to adapt the motor mount brackets. If I recall correctly, somebody, probably BrownDog, makes motor mounts that will do the job.
Any 1990-2001 XJ Cherokee or 1993-98 ZJ Grand Cherokee 4.0 L engine block will interchange. 1997-1999 4.0L TJ Wrangler blocks will also fit in XJ/ZJ. 87-95 YJ engine blocks will probably also fit.
Remove and re-use as needed or required: Intake/Exhaust manifolds, flex plate, cylinder head, distributor-less ignition or distributor assembly, fan belt driven accessories, sensors. If your donor engine has a distributor, the distributor can be removed and a distributor-less ignition assembly can be installed in it place.
If you have a cracked 0331 head, buy a good used redesigned and more durable TUPY 0331 head from a 2002+ 4.0L TJ Wrangler or WJ Grand Cherokee.