Old thread I know, but thought I would share the behavior that caused this since it is very interesting.
One problem I found in the code above is that in the CatLieOnCatnipGoal constructor, you have this line:
this.verticalSearchStart = -2;
While counter-intuitive and a bit obfuscated, the find nearest block uses this variable like so:
for(int k = this.verticalSearchStart; k <= j; k = k > 0 ? -k : 1 - k) {
This is a part of a series of for loops to search every block within the range. The line above will perform a search going away from a vertical start in a pseudo- absolute value fashion. Basically it alternates between going up then down. If the starting value is 0, the pattern is:
START k=0
EVALUATE k= k > 0 ? -k : 1 - k (FALSE, so evaluate right side of ":")
EVALUATE k=1-k (1-0)
END k=1
(do stuff and loop again)
EVALUATE k= k > 0 ? -k : 1 - k (TRUE, so evaluate left side of ":")
EVALUATE k = -k (-1)
END k=-1
(skipping ahead)
k=2
k=-2
k=3
k=-3
By starting at -2, the search will never land on any blocks within 1 vertical block of your cats.