forked from TAIGA/TAIGA
Some fixes for page-template of tinker book
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.sosnitzka.taiga;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.sosnitzka.taiga.book.ContentOre;
|
||||
import com.sosnitzka.taiga.proxy.CommonProxy;
|
||||
import com.sosnitzka.taiga.recipes.CraftingRegistry;
|
||||
import com.sosnitzka.taiga.recipes.SmeltingRegistry;
|
||||
@@ -23,6 +24,7 @@ import static com.sosnitzka.taiga.Fluids.*;
|
||||
import static com.sosnitzka.taiga.MaterialTraits.*;
|
||||
import static com.sosnitzka.taiga.util.Utils.integrateMaterial;
|
||||
import static com.sosnitzka.taiga.util.Utils.integrateOre;
|
||||
import static slimeknights.mantle.client.book.BookLoader.registerPageType;
|
||||
import static slimeknights.tconstruct.library.utils.HarvestLevels.*;
|
||||
|
||||
@Mod(modid = TAIGA.MODID, version = TAIGA.VERSION, guiFactory = TAIGA.GUIFACTORY, dependencies = "required-after:tconstruct@[1.10.2-2.5.0,);" + "required-after:mantle@[1.10.2-1.0.0,)")
|
||||
@@ -66,6 +68,8 @@ public class TAIGA {
|
||||
for (MaterialIntegration m : integrateList) {
|
||||
m.integrateRecipes();
|
||||
}
|
||||
|
||||
registerPageType("taigaore", ContentOre.class);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
package com.sosnitzka.taiga.book;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import slimeknights.mantle.client.book.data.BookData;
|
||||
import slimeknights.mantle.client.book.data.content.PageContent;
|
||||
import slimeknights.mantle.client.book.data.element.ImageData;
|
||||
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.ElementImage;
|
||||
import slimeknights.mantle.client.gui.book.element.ElementItem;
|
||||
import slimeknights.mantle.client.gui.book.element.ElementText;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static slimeknights.mantle.client.gui.book.Textures.TEX_SMELTING;
|
||||
|
||||
public class ContentSmelting extends PageContent {
|
||||
|
||||
public static final transient int TEX_SIZE = 128;
|
||||
public static final transient ImageData IMG_SMELTING = new ImageData(TEX_SMELTING, 0, 0, 110, 114, TEX_SIZE, TEX_SIZE);
|
||||
|
||||
public static final transient int INPUT_X = 5;
|
||||
public static final transient int INPUT_Y = 5;
|
||||
public static final transient int RESULT_X = 74;
|
||||
public static final transient int RESULT_Y = 41;
|
||||
public static final transient int FUEL_X = 5;
|
||||
public static final transient int FUEL_Y = 77;
|
||||
|
||||
public static final transient float ITEM_SCALE = 2.0F;
|
||||
|
||||
public String title = "Smelting";
|
||||
public ItemStackData input;
|
||||
public ItemStackData result;
|
||||
public TextData[] description;
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
int x = GuiBook.PAGE_WIDTH / 2 - IMG_SMELTING.width / 2;
|
||||
int y = TITLE_HEIGHT;
|
||||
|
||||
TextData tdTitle = new TextData(title);
|
||||
tdTitle.underlined = true;
|
||||
list.add(new ElementText(0, 0, GuiBook.PAGE_WIDTH, 9, new TextData[]{tdTitle}));
|
||||
list.add(new ElementImage(x, y, IMG_SMELTING.width, IMG_SMELTING.height, IMG_SMELTING, book.appearance.slotColor));
|
||||
|
||||
if (input != null && !input.id.equals("")) {
|
||||
list.add(new ElementItem(x + INPUT_X, y + INPUT_Y, ITEM_SCALE, input.getItems(), input.action));
|
||||
}
|
||||
|
||||
if (result != null && !result.id.equals("")) {
|
||||
list.add(new ElementItem(x + RESULT_X, y + RESULT_Y, ITEM_SCALE, result.getItems(), result.action));
|
||||
}
|
||||
|
||||
list.add(new ElementItem(x + FUEL_X, y + FUEL_Y, ITEM_SCALE, getFuelsList()));
|
||||
|
||||
if (description != null && description.length > 0) {
|
||||
list.add(new ElementText(0, IMG_SMELTING.height + y + 5, GuiBook.PAGE_WIDTH, GuiBook.PAGE_HEIGHT - y - 5, description));
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack[] getFuelsList() {
|
||||
//TODO ask JEI for fuel list if it is present
|
||||
|
||||
ItemStack[] fuels = new ItemStack[13];
|
||||
fuels[0] = new ItemStack(Blocks.WOODEN_SLAB);
|
||||
fuels[1] = new ItemStack(Blocks.PLANKS);
|
||||
fuels[2] = new ItemStack(Blocks.COAL_BLOCK);
|
||||
fuels[3] = new ItemStack(Items.WOODEN_PICKAXE);
|
||||
fuels[4] = new ItemStack(Items.WOODEN_SWORD);
|
||||
fuels[5] = new ItemStack(Items.WOODEN_HOE);
|
||||
fuels[6] = new ItemStack(Items.STICK);
|
||||
fuels[7] = new ItemStack(Items.COAL);
|
||||
fuels[8] = new ItemStack(Items.LAVA_BUCKET);
|
||||
fuels[9] = new ItemStack(Blocks.SAPLING);
|
||||
fuels[10] = new ItemStack(Items.BLAZE_ROD);
|
||||
fuels[11] = new ItemStack(Items.WOODEN_SHOVEL);
|
||||
fuels[12] = new ItemStack(Items.WOODEN_AXE);
|
||||
|
||||
return fuels;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user