Use a filter to get a proper chicken:
NPC chicken = getNpcs().closest(new Filter<NPC>() {
@[member=Override]
public boolean match(NPC npc) {
return npc != null && npc.getName().equals("Chicken") && !npc.isUnderAttack() && npc.getHealthPercent() > 0;
}
});