use of api.guide.BookPageContents 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()));
}
}
}
use of api.guide.BookPageContents in project Adventurers-Toolbox by the-realest-stu.
the class GuiBook method resetPage.
private void resetPage() {
this.buttonList.clear();
int i = 0;
if (currentPage instanceof BookPageContents) {
List<ChapterLink> links = ((BookPageContents) currentPage).getLinks();
for (ChapterLink link : links) {
this.addButton(new ChapterLinkButton(i, left + 16, top + 24 + (i * 12), link.text, link.chapter));
i++;
}
}
if (currentPageNum < chapters.get(currentChapter).getPageCount() - 1) {
this.addButton(new PageTurnButton(i, left + 100, top + 154, true));
i++;
}
if (currentPageNum > 0) {
this.addButton(new PageTurnButton(i, left + 18, top + 154, false));
i++;
}
}
Aggregations