001/* 002 * Forge Mod Loader 003 * Copyright (c) 2012-2013 cpw. 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser Public License v2.1 006 * which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 008 * 009 * Contributors: 010 * cpw - implementation 011 */ 012 013package cpw.mods.fml.common.discovery; 014 015import java.util.List; 016 017import com.google.common.base.Throwables; 018 019import cpw.mods.fml.common.ModContainer; 020 021public enum ContainerType 022{ 023 JAR(JarDiscoverer.class), 024 DIR(DirectoryDiscoverer.class); 025 026 private ITypeDiscoverer discoverer; 027 028 private ContainerType(Class<? extends ITypeDiscoverer> discovererClass) 029 { 030 try 031 { 032 this.discoverer = discovererClass.newInstance(); 033 } 034 catch (Exception e) 035 { 036 throw Throwables.propagate(e); 037 } 038 } 039 040 public List<ModContainer> findMods(ModCandidate candidate, ASMDataTable table) 041 { 042 return discoverer.discover(candidate, table); 043 } 044}