Check range of y in HasNearLog

Fixes #803
Merge pull request #1357 from mc-server/leafFix

Check range of y in HasNearLog