forked from TAIGA/TAIGA
Some fixes for page-template of tinker book
This commit is contained in:
64
src/main/java/com/sosnitzka/taiga/book/ContentOre.java
Normal file
64
src/main/java/com/sosnitzka/taiga/book/ContentOre.java
Normal file
@@ -0,0 +1,64 @@
|
||||
package com.sosnitzka.taiga.book;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import slimeknights.mantle.client.book.data.BookData;
|
||||
import slimeknights.mantle.client.book.data.element.ItemStackData;
|
||||
import slimeknights.mantle.client.book.data.element.TextData;
|
||||
import slimeknights.mantle.client.gui.book.GuiBook;
|
||||
import slimeknights.mantle.client.gui.book.element.BookElement;
|
||||
import slimeknights.mantle.client.gui.book.element.ElementItem;
|
||||
import slimeknights.mantle.client.gui.book.element.ElementText;
|
||||
import slimeknights.tconstruct.library.book.TinkerPage;
|
||||
import slimeknights.tconstruct.library.client.CustomFontColor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ContentOre extends TinkerPage {
|
||||
|
||||
public static final transient int INPUT_X = 100;
|
||||
public static final transient int INPUT_Y = 80;
|
||||
|
||||
public static final transient float ITEM_SCALE = 1.75F;
|
||||
|
||||
public String title = "Ore";
|
||||
public ItemStackData input;
|
||||
public TextData[] description;
|
||||
public String[] informations;
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
|
||||
|
||||
TextData tdTitle = new TextData(title);
|
||||
tdTitle.underlined = true;
|
||||
//list.add(new ElementText(GuiBook.PAGE_WIDTH/2, 0, GuiBook.PAGE_WIDTH, 9, new TextData[]{tdTitle}));
|
||||
|
||||
addTitle(list, CustomFontColor.encodeColor(0xcccccc) + title, true);
|
||||
|
||||
if (input != null && !input.id.equals("")) {
|
||||
list.add(new ElementItem(INPUT_X, INPUT_Y, ITEM_SCALE * 2.5f, input.getItems(), input.action));
|
||||
}
|
||||
|
||||
if (description != null && description.length > 0) {
|
||||
list.add(new ElementText(0, 15, GuiBook.PAGE_WIDTH, GuiBook.PAGE_HEIGHT - 15, description));
|
||||
}
|
||||
|
||||
int h = GuiBook.PAGE_WIDTH / 3 - 10;
|
||||
if (informations.length > 0) {
|
||||
TextData head = new TextData(parent.translate("modifier.informations"));
|
||||
head.underlined = true;
|
||||
list.add(new ElementText(10, 20 + h, GuiBook.PAGE_WIDTH / 2 - 5, GuiBook.PAGE_HEIGHT - h - 20, head));
|
||||
|
||||
List<TextData> effectData = Lists.newArrayList();
|
||||
for (String e : informations) {
|
||||
effectData.add(new TextData("\u25CF "));
|
||||
effectData.add(new TextData(e));
|
||||
effectData.add(new TextData("\n"));
|
||||
}
|
||||
|
||||
list.add(new ElementText(10, 30 + h, GuiBook.PAGE_WIDTH / 2 + 5, GuiBook.PAGE_HEIGHT - h - 20, effectData));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user