Only do
ironRocks = getObjects().closest(n -> n.getId() == 7488 && ((n.getX() == 1234 && n.getY() == 1234) || (n.getX() == 1234 && n.getY() == 1234)));
In the actual mining state, no need to do that in a state where you won't need to know any information about that object.
Please do null-checking aswell :)