public static void init() { BookLoader.registerPageType(ContentMaterial.ID, ContentMaterial.class); BookLoader.registerPageType(ContentModifier.ID, ContentModifier.class); BookLoader.registerPageType(ContentModifierFortify.ID, ContentModifierFortify.class); BookLoader.registerPageType(ContentTool.ID, ContentTool.class); BookLoader.registerPageType(ContentSingleStatMultMaterial.ID, ContentSingleStatMultMaterial.class); BookLoader.registerPageType(ContentImageText2.ID, ContentImageText2.class); INSTANCE.addRepository(new FileRepository(Util.resource("book"))); INSTANCE.addTransformer(new ToolSectionTransformer()); INSTANCE.addTransformer(new MaterialSectionTransformer()); INSTANCE.addTransformer(new ModifierSectionTransformer()); INSTANCE.addTransformer(new BowMaterialSectionTransformer()); INSTANCE.addTransformer(BookTransformer.IndexTranformer()); } }
public static void integrate() { INSTANCE.addRepository(new FileRepository(EnderIO.DOMAIN + ":eiobook")); INSTANCE.addTransformer(BookTransformer.IndexTranformer()); }
/** * Adds a book to the loader, and returns a reference object * Be warned that the returned BookData object is not immediately populated, and is instead populated when the resources are loaded/reloaded * * @param name The name of the book, modid: will be automatically appended to the front of the name unless that is already added * @param appendIndex Whether an index should be added to the front of the book using a BookTransformer * @param appendContentTable Whether a table of contents should be added to the front of each section using a BookTransformer * @param repositories All the repositories the book will load the sections from * @return The book object, not immediately populated */ public static BookData registerBook(String name, boolean appendIndex, boolean appendContentTable, BookRepository... repositories) { BookData info = new BookData(repositories); books.put(name.contains(":") ? name : Loader.instance().activeModContainer().getModId() + ":" + name, info); if(appendIndex) { info.addTransformer(BookTransformer.IndexTranformer()); } if(appendContentTable) { info.addTransformer(BookTransformer.contentTableTransformer()); } return info; }