Lock On Mod (1.19.2, 1.18.2) adds a key that locks on to nearby entities. It is similar to the lock-on feature in Legend of Zelda Ocarina of Time. Tab can be used to switch targets while locked on. Or, press the lock keybind to exit lock-on mode. Lock on mode will be triggered by killing the current target or the target not being visible. Lock on will only track entities within 10 blocks of the target.