Some fixes for page-template of tinker book

This commit is contained in:
Robert Sosnitzka
2017-01-08 23:41:01 +01:00
parent 4f9a734581
commit 9afe6b1b99
16 changed files with 112 additions and 258 deletions

View File

@@ -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

View 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));
}
}
}

View File

@@ -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;
}
}

View File

@@ -1,14 +0,0 @@
{
"title": "Interacting with Blocks",
"input": {
"itemList": "items/records.json"
},
"block": {
"id": "minecraft:jukebox"
},
"description": [
{
"text": "That's my jam!"
}
]
}

View File

@@ -1,46 +0,0 @@
{
"title": "Crafting a Thing",
"grid_size": "large",
"grid": [
[
{},
{
"id": "minecraft:redstone_torch"
}
],
[
{
"id": "minecraft:redstone_torch"
},
{
"id": "minecraft:quartz"
},
{
"id": "minecraft:redstone_torch"
}
],
[
{
"id": "minecraft:stone"
},
{
"id": "minecraft:stone"
},
{
"id": "minecraft:stone"
}
]
],
"result": {
"id": "minecraft:comparator"
},
"description": [
{
"text": "This item does stuff and, of course, "
},
{
"text": "things.",
"underlined": true
}
]
}

View File

@@ -1,34 +0,0 @@
{
"title": "Crafting a Thing",
"grid_size": "small",
"grid": [
[
{
"id": "minecraft:stick"
},
{
"id": "minecraft:planks"
}
],
[
{
"id": "minecraft:planks"
},
{
"id": "minecraft:stick"
}
]
],
"result": {
"id": "tconstruct:stencil"
},
"description": [
{
"text": "This item does stuff and, of course, "
},
{
"text": "things.",
"underlined": true
}
]
}

View File

@@ -1,14 +0,0 @@
{
"title": "Smelting a Thing",
"input": {
"id": "minecraft:iron_ore"
},
"result": {
"id": "minecraft:iron_ingot"
},
"description": [
{
"text": "Very delicious iron."
}
]
}

View File

@@ -1,33 +0,0 @@
{
"title": "Smithing a Thing",
"input": {
"id": "minecraft:diamond_sword"
},
"modifier": {
"id": "minecraft:enchanted_book",
"nbt": {
"ench": [
{
"id": 16,
"lvl": 5
}
]
}
},
"result": {
"id": "minecraft:diamond_sword",
"nbt": {
"ench": [
{
"id": 16,
"lvl": 5
}
]
}
},
"description": [
{
"text": "Ow, that's sharp."
}
]
}

View File

@@ -1 +1,2 @@
index_title=TAIGA
index_title=TAIGA
modifier.informations=Informations

View File

@@ -0,0 +1,11 @@
{
"title": "Basalt",
"input": {
"id": "taiga:basalt_block"
},
"description": [
{
"text": "This is basalt. Basalt is a block, which can be found in the overworld at the top of lava lakes. If you don't want to fall into the lava you have to mine it carefully. Try to build some blocks underneath to be on the safe side."
}
]
}

View File

@@ -0,0 +1,15 @@
{
"title": "Meteorite",
"input": {
"id": "taiga:meteorite_block"
},
"description": [
{
"text": "You have to be patient, to find meteorite in your surroundings. Many hundrets of thounsands years ago they fell from the sky. Most of them are buried under dirt and grass and you have to dig a lot."
}
],
"informations": [
"Deals massive damage to spiders and silverfish",
"Multiple levels"
]
}

View File

@@ -0,0 +1,11 @@
{
"title": "Obsidiorite",
"input": {
"id": "taiga:obsidiorite_block"
},
"description": [
{
"text": "They are flying in the end!"
}
]
}

View File

@@ -10,36 +10,8 @@
"data": "ores/firstwords.json"
},
{
"name": "basalt",
"type": "text with right image etch",
"data": "ores/basalt.json"
},
{
"type": "blank"
},
{
"name": "PageCrafter",
"type": "crafting",
"data": "bsp/pagecrafting.json"
},
{
"name": "PageSmallCrafter",
"type": "crafting",
"data": "bsp/pagecraftingsmall.json"
},
{
"name": "PageSmelting",
"type": "smelting",
"data": "bsp/pagesmelting.json"
},
{
"name": "PageSmithing",
"type": "smithing",
"data": "bsp/pagesmithing.json"
},
{
"name": "PageBlockInteraction",
"type": "block interaction",
"data": "bsp/pageblkinteraction.json"
"name": "meteorite",
"type": "taigaore",
"data": "ore/meteorite.json"
}
]

View File

@@ -1,3 +1,5 @@
modifier.informations=Informations
material.basalt.name=Basalt
material.dilithium.name=Dilithium
material.tiberium.name=Tiberium

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

BIN
src/tinker_tank.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB