/* * Returns true if the given npch already has an occupant. */ public static boolean hasOccupant(World worldIn, NPCHouse npch) { List<Entity> inHouse = new ArrayList(); List<Entity> allEntities = worldIn.loadedEntityList; for (Entity ent : allEntities) { if (BlockHelper.isInside(worldIn, ent.getPosition(), npch)) { inHouse.add(ent); } } for (Entity inside : inHouse) { if (inside instanceof EntityNPC) { EntityNPC temp = (EntityNPC) inside; if (npch.isEqual(temp.getNPCHouse())) { return true; } } } return false; }