public static NPC[] getNearestAgressiveMob() { return NPCs.getLoaded( new Filter<NPC>() { @Override public boolean accept(NPC mob) { return mob != null && mob.getInteracting() != null && !mob.equals(Summoning.getFamiliar()) && mob.getInteracting().equals(Players.getLocal()); } }); }
public static boolean underAttack() { Filter ghoul = new Filter<NPC>() { public boolean accept(NPC npc) { return npc.getId() == 49; } }; for (NPC attackingGhoul : NPCs.getLoaded(ghoul)) { if (attackingGhoul.getInteracting() == Players.getLocal()) { return true; } } return false; }