Search in sources :

Example 1 with ContentListing

use of slimeknights.tconstruct.library.book.content.ContentListing in project EnderIO by SleepyTrousers.

the class OurBookTransformer method transform.

@Override
public void transform(BookData book) {
    SectionData section1 = null, section2 = null;
    for (SectionData section : book.sections) {
        if (section.name.equals("modifiers")) {
            section1 = section;
        }
        if (section.name.equals("eiomodifiers")) {
            section2 = section;
        }
    }
    if (section1 != null && section2 != null) {
        for (PageData page : section2.pages) {
            page.parent = section1;
            section1.pages.add(page);
        }
        PageData pageData = section1.pages.get(0);
        PageContent content = pageData.content;
        if (content instanceof ContentListing) {
            ContentListing listing = (ContentListing) content;
            for (PageData page : section2.pages) {
                page.parent = section1;
                if (page.content instanceof ContentModifier) {
                    IModifier modifier = TinkerRegistry.getModifier(((ContentModifier) page.content).modifierName);
                    if (modifier != null) {
                        page.name = "page-eio-" + modifier.getIdentifier();
                        listing.addEntry(modifier.getLocalizedName(), page);
                    }
                }
            }
        }
        section2.pages.clear();
        book.sections.remove(section2);
    }
}
Also used : PageContent(slimeknights.mantle.client.book.data.content.PageContent) PageData(slimeknights.mantle.client.book.data.PageData) ContentListing(slimeknights.tconstruct.library.book.content.ContentListing) ContentModifier(slimeknights.tconstruct.library.book.content.ContentModifier) SectionData(slimeknights.mantle.client.book.data.SectionData) IModifier(slimeknights.tconstruct.library.modifiers.IModifier)

Aggregations

PageData (slimeknights.mantle.client.book.data.PageData)1 SectionData (slimeknights.mantle.client.book.data.SectionData)1 PageContent (slimeknights.mantle.client.book.data.content.PageContent)1 ContentListing (slimeknights.tconstruct.library.book.content.ContentListing)1 ContentModifier (slimeknights.tconstruct.library.book.content.ContentModifier)1 IModifier (slimeknights.tconstruct.library.modifiers.IModifier)1