Search in sources :

Example 1 with BookPage

use of api.guide.BookPage in project Adventurers-Toolbox by the-realest-stu.

the class GuiBook method initPages.

public static void initPages() {
    BookPageContents home = new BookPageContents("guide.page.home.name");
    home.addLink(new ChapterLink("guide.chapter.misc.name", "misc"));
    home.addLink(new ChapterLink("guide.chapter.mat.name", "mat"));
    home.addLink(new ChapterLink("guide.chapter.tool.name", "tool"));
    home.addLink(new ChapterLink("guide.chapter.weapon.name", "weapon"));
    BookPageContents matHome = new BookPageContents("guide.page.mat.name");
    matHome.addLink(new ChapterLink("guide.chapter.head_mat.name", "head_mat"));
    matHome.addLink(new ChapterLink("guide.chapter.haft_mat.name", "haft_mat"));
    matHome.addLink(new ChapterLink("guide.chapter.handle_mat.name", "handle_mat"));
    matHome.addLink(new ChapterLink("guide.chapter.adornment_mat.name", "adornment_mat"));
    chapters.put("home", new BookChapter("home"));
    chapters.put("misc", new BookChapter("misc", "home"));
    chapters.put("mat", new BookChapter("mat", "home"));
    chapters.put("tool", new BookChapter("tool", "home"));
    chapters.put("weapon", new BookChapter("weapon", "home"));
    chapters.put("head_mat", new BookChapter("head_mat", "mat"));
    chapters.put("haft_mat", new BookChapter("haft_mat", "mat"));
    chapters.put("handle_mat", new BookChapter("handle_mat", "mat"));
    chapters.put("adornment_mat", new BookChapter("adornment_mat", "mat"));
    chapters.get("home").addPage(home);
    chapters.get("mat").addPage(matHome);
    chapters.get("misc").addPage(new BookPageText("guide.page.misc.name", "guide.page.misc.text"));
    for (HeadMaterial mat : Materials.head_registry.values()) {
        boolean hideUnavailables = true;
        // hideUnavailables = Config.HIDE_UNCRAFTABLE_HEADS;
        if (!hideUnavailables || (OreDictionary.getOres(mat.getCraftingItem()).size() > 0 && OreDictionary.getOres(mat.getSmallCraftingItem()).size() > 0)) {
            BookPageMat page = new BookPageMat(mat);
            chapters.get("head_mat").addPage(page);
        }
    }
    for (HaftMaterial mat : Materials.haft_registry.values()) {
        if (!ModRecipes.haft_map.containsValue(mat)) {
            continue;
        }
        BookPageMat page = new BookPageMat(mat);
        chapters.get("haft_mat").addPage(page);
    }
    for (HandleMaterial mat : Materials.handle_registry.values()) {
        if (!ModRecipes.handle_map.containsValue(mat)) {
            continue;
        }
        BookPageMat page = new BookPageMat(mat);
        chapters.get("handle_mat").addPage(page);
    }
    for (AdornmentMaterial mat : Materials.adornment_registry.values()) {
        if (mat == ModMaterials.ADORNMENT_NULL) {
            continue;
        }
        if (!ModRecipes.adornment_map.containsValue(mat)) {
            continue;
        }
        BookPageMat page = new BookPageMat(mat);
        chapters.get("adornment_mat").addPage(page);
    }
    chapters.get("tool").addPage(new BookPageTool("guide.tool.pickaxe.name", "guide.tool.pickaxe.desc", ModItems.pickaxe));
    chapters.get("tool").addPage(new BookPageTool("guide.tool.axe.name", "guide.tool.axe.desc", ModItems.axe));
    chapters.get("tool").addPage(new BookPageTool("guide.tool.shovel.name", "guide.tool.shovel.desc", ModItems.shovel));
    chapters.get("tool").addPage(new BookPageTool("guide.tool.hoe.name", "guide.tool.hoe.desc", ModItems.hoe));
    chapters.get("tool").addPage(new BookPageTool("guide.tool.handpick.name", "guide.tool.handpick.desc", ModItems.handpick));
    chapters.get("tool").addPage(new BookPageTool("guide.tool.hammer.name", "guide.tool.hammer.desc", ModItems.hammer));
    chapters.get("weapon").addPage(new BookPageTool("guide.weapon.sword.name", "guide.weapon.sword.desc", ModItems.sword));
    chapters.get("weapon").addPage(new BookPageTool("guide.weapon.dagger.name", "guide.weapon.dagger.desc", ModItems.dagger));
    chapters.get("weapon").addPage(new BookPageTool("guide.weapon.mace.name", "guide.weapon.mace.desc", ModItems.mace));
    for (BookChapter chapter : chapters.values()) {
        if (chapter.getPageCount() <= 0) {
            chapter.addPage(new BookPage(chapter.getName()));
        }
    }
}
Also used : AdornmentMaterial(api.materials.AdornmentMaterial) BookPageMat(api.guide.BookPageMat) HandleMaterial(api.materials.HandleMaterial) BookPageText(api.guide.BookPageText) BookChapter(api.guide.BookChapter) HeadMaterial(api.materials.HeadMaterial) BookPage(api.guide.BookPage) BookPageTool(api.guide.BookPageTool) ChapterLink(api.guide.ChapterLink) BookPageContents(api.guide.BookPageContents) HaftMaterial(api.materials.HaftMaterial)

Aggregations

BookChapter (api.guide.BookChapter)1 BookPage (api.guide.BookPage)1 BookPageContents (api.guide.BookPageContents)1 BookPageMat (api.guide.BookPageMat)1 BookPageText (api.guide.BookPageText)1 BookPageTool (api.guide.BookPageTool)1 ChapterLink (api.guide.ChapterLink)1 AdornmentMaterial (api.materials.AdornmentMaterial)1 HaftMaterial (api.materials.HaftMaterial)1 HandleMaterial (api.materials.HandleMaterial)1 HeadMaterial (api.materials.HeadMaterial)1