blob: 11a6aaacbf2b35ff9c9061fe08f53ca36aaef458 [file] [log] [blame] [raw]
package li.cil.oc.driver;
import cpw.mods.fml.common.Loader;
import net.minecraft.item.ItemStack;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public final class Registry {
private static final Set<IModHandler> handlers = new HashSet<IModHandler>();
private Registry() {
}
public static void add(final IModHandler mod) {
final boolean alwaysEnabled = mod.getModId() == null || mod.getModId().isEmpty();
if ((alwaysEnabled || Loader.isModLoaded(mod.getModId())) && handlers.add(mod)) {
System.out.println("Loading up: "+mod.getModId());
mod.initialize();
}
}
public static Map<String, Object> toMap(final ItemStack value) {
if (value == null) {
return null;
}
final Map<String, Object> map = new HashMap<String, Object>();
for (IModHandler handler : handlers) {
handler.populate(map, value);
}
return map;
}
}