Search in sources :

Example 1 with TextData

use of slimeknights.mantle.client.book.data.element.TextData in project TinkersConstruct by SlimeKnights.

the class ContentListingCentered method addEntry.

public void addEntry(String text, @Nullable PageData link) {
    TextData data = new TextData(text);
    if (link != null) {
        data.action = "mantle:go-to-page-rtn " + link.parent.name + "." + link.name;
    }
    this.entries.add(data);
}
Also used : TextData(slimeknights.mantle.client.book.data.element.TextData)

Example 2 with TextData

use of slimeknights.mantle.client.book.data.element.TextData in project TinkersConstruct by SlimeKnights.

the class ContentMaterialSkull method build.

@Override
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
    MaterialVariantId materialVariant = getMaterialVariant();
    this.addTitle(list, getTitle(), true, MaterialTooltipCache.getColor(materialVariant).getValue());
    // the cool tools to the left/right
    this.addDisplayItems(list, rightSide ? BookScreen.PAGE_WIDTH - 18 : 0, materialVariant);
    // align page
    int top = getTitleHeight();
    int left = rightSide ? 0 : 22;
    int y = top + 5;
    int x = left + 5;
    int w = BookScreen.PAGE_WIDTH - 20;
    // skull stats, full width
    MaterialId materialId = materialVariant.getId();
    int skullTraits = this.addStatsDisplay(x, y, w, list, materialId, SkullStats.ID);
    y += 65;
    // inspirational quote, or boring description text
    String textKey = String.format(detailed ? "material.%s.%s.skull_encyclopedia" : "material.%s.%s.skull_flavor", materialId.getNamespace(), materialId.getPath());
    if (I18n.exists(textKey)) {
        // using forge instead of I18n.format as that prevents % from being interpreted as a format key
        String translated = ForgeI18n.getPattern(textKey);
        if (!detailed) {
            translated = '"' + translated + '"';
        }
        TextData flavourData = new TextData(translated);
        flavourData.italic = !detailed;
        list.add(new TextElement(x, y + 10 * skullTraits, w, 60, flavourData));
    }
}
Also used : MaterialId(slimeknights.tconstruct.library.materials.definition.MaterialId) TextElement(slimeknights.mantle.client.screen.book.element.TextElement) MaterialVariantId(slimeknights.tconstruct.library.materials.definition.MaterialVariantId) TextData(slimeknights.mantle.client.book.data.element.TextData)

Example 3 with TextData

use of slimeknights.mantle.client.book.data.element.TextData in project TinkersConstruct by SlimeKnights.

the class ContentModifier method build.

@Override
public void build(BookData book, ArrayList<BookElement> list, boolean brightSide) {
    Modifier modifier = getModifier();
    if (modifier == TinkerModifiers.empty.get() || this.recipes.isEmpty()) {
        list.add(new ImageElement(0, 0, 32, 32, ImageData.MISSING));
        System.out.println("Modifier with id " + modifierID + " not found");
        return;
    }
    this.addTitle(list, getTitle(), true, modifier.getColor());
    // description
    int y = getTitleHeight();
    int h = more_text_space ? BookScreen.PAGE_HEIGHT * 2 / 5 : BookScreen.PAGE_HEIGHT * 2 / 7;
    list.add(new TextElement(5, y, BookScreen.PAGE_WIDTH - 10, h, text));
    if (this.effects.length > 0) {
        TextData head = new TextData(I18n.get(KEY_EFFECTS));
        head.underlined = true;
        list.add(new TextElement(5, y + h, BookScreen.PAGE_WIDTH / 2 - 5, BookScreen.PAGE_HEIGHT - h - 20, head));
        List<TextData> effectData = Lists.newArrayList();
        for (String e : this.effects) {
            effectData.add(new TextData("\u25CF "));
            effectData.add(new TextData(e));
            effectData.add(new TextData("\n"));
        }
        list.add(new TextElement(5, y + 14 + h, BookScreen.PAGE_WIDTH / 2 + 5, BookScreen.PAGE_HEIGHT - h - 20, effectData));
    }
    if (recipes.size() > 1) {
        int col = book.appearance.structureButtonColor;
        int colHover = book.appearance.structureButtonColorHovered;
        list.add(new CycleRecipeElement(BookScreen.PAGE_WIDTH - ArrowButton.ArrowType.RIGHT.w - 32, 160, ArrowButton.ArrowType.RIGHT, col, colHover, this, book, list));
    }
    this.buildAndAddRecipeDisplay(book, list, this.recipes.get(this.currentRecipe), null);
}
Also used : TextElement(slimeknights.mantle.client.screen.book.element.TextElement) ImageElement(slimeknights.mantle.client.screen.book.element.ImageElement) TextData(slimeknights.mantle.client.book.data.element.TextData) CycleRecipeElement(slimeknights.tconstruct.library.client.book.elements.CycleRecipeElement) Modifier(slimeknights.tconstruct.library.modifiers.Modifier)

Example 4 with TextData

use of slimeknights.mantle.client.book.data.element.TextData in project TinkersConstruct by SlimeKnights.

the class ContentListingCentered method build.

@Override
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
    int yOff = 0;
    if (this.title != null) {
        this.addTitle(list, this.title, false);
        yOff = getTitleHeight();
    }
    int y = yOff;
    int x = 0;
    int w = BookScreen.PAGE_WIDTH;
    for (TextData data : this.entries) {
        int ex = x + w / 2 - book.fontRenderer.width(data.text) / 2;
        list.add(new ListingCenteredElement(ex, y, w, 9, data));
        y += 9;
    }
}
Also used : ListingCenteredElement(slimeknights.tconstruct.library.client.book.elements.ListingCenteredElement) TextData(slimeknights.mantle.client.book.data.element.TextData)

Aggregations

TextData (slimeknights.mantle.client.book.data.element.TextData)4 TextElement (slimeknights.mantle.client.screen.book.element.TextElement)2 ImageElement (slimeknights.mantle.client.screen.book.element.ImageElement)1 CycleRecipeElement (slimeknights.tconstruct.library.client.book.elements.CycleRecipeElement)1 ListingCenteredElement (slimeknights.tconstruct.library.client.book.elements.ListingCenteredElement)1 MaterialId (slimeknights.tconstruct.library.materials.definition.MaterialId)1 MaterialVariantId (slimeknights.tconstruct.library.materials.definition.MaterialVariantId)1 Modifier (slimeknights.tconstruct.library.modifiers.Modifier)1