Search in sources :

Example 1 with IGuideBook

use of amerifrance.guideapi.api.IGuideBook in project Guide-API by TeamAmeriFrance.

the class AnnotationHandler method registerBooks.

public static void registerBooks(ASMDataTable dataTable) {
    for (ASMDataTable.ASMData data : dataTable.getAll(GuideBook.class.getCanonicalName())) {
        try {
            Class<?> genericClass = Class.forName(data.getClassName());
            if (!IGuideBook.class.isAssignableFrom(genericClass))
                continue;
            IGuideBook guideBook = (IGuideBook) genericClass.newInstance();
            Book book = guideBook.buildBook();
            if (book == null)
                continue;
            APISetter.registerBook(book);
            BOOK_CLASSES.add(Pair.of(book, guideBook));
        } catch (Exception e) {
            LogHelper.error("Error registering book for class " + data.getClassName());
            e.printStackTrace();
        }
    }
    APISetter.setIndexedBooks(Lists.newArrayList(GuideAPI.getBooks().values()));
}
Also used : GuideBook(amerifrance.guideapi.api.GuideBook) IGuideBook(amerifrance.guideapi.api.IGuideBook) ASMDataTable(net.minecraftforge.fml.common.discovery.ASMDataTable) GuideBook(amerifrance.guideapi.api.GuideBook) IGuideBook(amerifrance.guideapi.api.IGuideBook) Book(amerifrance.guideapi.api.impl.Book) IGuideBook(amerifrance.guideapi.api.IGuideBook)

Aggregations

GuideBook (amerifrance.guideapi.api.GuideBook)1 IGuideBook (amerifrance.guideapi.api.IGuideBook)1 Book (amerifrance.guideapi.api.impl.Book)1 ASMDataTable (net.minecraftforge.fml.common.discovery.ASMDataTable)1