Skip to content

Commit

Permalink
Add staffs to books and fix tool index transformers
Browse files Browse the repository at this point in the history
  • Loading branch information
KnightMiner committed Feb 12, 2023
1 parent 728164d commit 26edf27
Show file tree
Hide file tree
Showing 14 changed files with 150 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public static void initBook() {
MIGHTY_SMELTING.addTransformer(ToolSectionTransformer.INSTANCE);
FANTASTIC_FOUNDRY.addTransformer(armorTransformer);
TINKERS_GADGETRY.addTransformer(armorTransformer);
ENCYCLOPEDIA.addTransformer(new ToolSectionTransformer("small_tools"));
ENCYCLOPEDIA.addTransformer(new ToolSectionTransformer("large_tools"));
TINKERS_GADGETRY.addTransformer(new ToolSectionTransformer("staffs"));
ENCYCLOPEDIA.addTransformer(new ToolSectionTransformer("tools"));
ENCYCLOPEDIA.addTransformer(armorTransformer);

// material tier transformers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
import net.minecraft.world.item.Items;
import slimeknights.mantle.client.book.data.BookData;
import slimeknights.mantle.client.book.data.PageData;
import slimeknights.mantle.client.book.data.content.ContentListing;
import slimeknights.mantle.client.book.transformer.ContentListingSectionTransformer;
import slimeknights.mantle.client.book.transformer.ContentGroupingSectionTransformer;
import slimeknights.tconstruct.library.client.book.content.ContentTool;

/** Section transformer to generate an index with tool names */
public class ToolSectionTransformer extends ContentListingSectionTransformer {
public class ToolSectionTransformer extends ContentGroupingSectionTransformer {
public static final ToolSectionTransformer INSTANCE = new ToolSectionTransformer("tools");

public ToolSectionTransformer(String name, boolean largeTitle, boolean centerTitle) {
Expand All @@ -20,10 +19,26 @@ public ToolSectionTransformer(String name) {
}

@Override
protected boolean processPage(BookData book, ContentListing listing, PageData page) {
protected boolean processPage(BookData book, GroupingBuilder builder, PageData page) {
// only add tool pages if the tool exists, barrier is the fallback item for missing
if (!(page.content instanceof ContentTool tool && tool.getTool().asItem() == Items.BARRIER)) {
super.processPage(book, listing, page);
if (page.content instanceof ContentTool tool) {
if (tool.getTool().asItem() != Items.BARRIER) {
builder.addPage(page.getTitle(), page);
return true;
}
return false;
} else if (page.name.startsWith("group_")) {
// skip adding the page if no data
if (page.data.isEmpty()) {
builder.addGroup(page.getTitle(), null);
return false;
} else {
builder.addGroup(page.getTitle(), page);
return true;
}
// anything other than hidden continues same column
} else if (!page.name.equals("hidden")) {
builder.addPage(page.getTitle(), page);
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ intro=Introduction
tools=Tools
tools.group_small=Small Tools
tools.group_large=Broad Tools
tools.group_staff=Staffs
armor=Armor

materials_harvest_1=Tier 1 Melee Harvest Materials
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"title": "Staffs",
"text": [
{ "text": "Staffs are highly modifiable tools. While they lack any melee potential the make up for it the wide range of abilities they can use on both interaction and attacking." },
{ "text": "Staffs abilities can be configured using the modifier worktable.", "paragraph": true }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"tool": "tconstruct:earth_staff",
"text": [
{ "text": "Earthslime Staff is a high defense staff variant." }
],
"properties": [
"800 Durability",
"50% speed while using",
"2 Upgrade Slots",
"3 Defense Slots",
"2 Ability Slots"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"tool": "tconstruct:ichor_staff",
"text": [
{ "text": "Ichor Staff is a high ability slot staff variant." }
],
"properties": [
"1225 Durability",
"50% speed while using",
"2 Upgrade Slots",
"3 Ability Slots"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"tool": "tconstruct:sky_staff",
"text": [
{ "text": "Skyslime Staff is a highly upgradable staff variant." }
],
"properties": [
"375 Durability",
"50% speed while using",
"5 Upgrade Slots",
"2 Ability Slots"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,26 @@
"name": "longbow",
"type": "tconstruct:tool",
"data": "tools/large/longbow.json"
},

{
"name": "group_staff",
"type": "mantle:text",
"data": "tools/staff.json"
},
{
"name": "sky_staff",
"type": "tconstruct:tool",
"data": "tools/staff/sky.json"
},
{
"name": "earth_staff",
"type": "tconstruct:tool",
"data": "tools/staff/earth.json"
},
{
"name": "ichor_staff",
"type": "tconstruct:tool",
"data": "tools/staff/ichor.json"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ exploration.enderslime_geode=Enderslime
armor=Armor
armor.subtext=Mixing slime with various mob parts produces an interesting set of armor. Its not the most defensive, but it can really enhance your abilities.

staffs=Staffs
staffs.subtext=Combining slime crystals and slime wood aids in creation of very flexible tools. Just need a bit of metal to hold the whole thing together.

materials=Skull Materials
materials.subtext=Placing one of these skulls in a casting basin and adding enderslime can enhance their ability as a helmet.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"tool": "tconstruct:earth_staff",
"text": [
{ "text": "Using the power of green slime, you can make the most defensive of magic staffs." }
],
"properties": [
"Mid Durability",
"2 Upgrade Slots",
"3 Defense Slots",
"2 Ability Slots"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"tool": "tconstruct:ichor_staff",
"text": [
{ "text": "Ichor is uncommon stuff, but allows making some of the strongest staffs." }
],
"properties": [
"High Durability",
"2 Upgrade Slots",
"3 Ability Slots"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"tool": "tconstruct:sky_staff",
"text": [
{ "text": "Skyslime staffs leave a lot of room for modification." }
],
"properties": [
"Low Durability",
"5 Upgrade Slots",
"2 Ability Slots"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
"item": "tconstruct:sky_slime_sapling"
}
},
{
"name": "staffs",
"data": "sections/staffs.json",
"icon": {
"item": "tconstruct:sky_staff"
}
},
{
"name": "armor",
"data": "sections/armor.json",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{
"name": "sky_staff",
"type": "tconstruct:tool",
"data": "staffs/sky.json"
},
{
"name": "earth_staff",
"type": "tconstruct:tool",
"data": "staffs/earth.json"
},
{
"name": "ichor_staff",
"type": "tconstruct:tool",
"data": "staffs/ichor.json"
}
]

0 comments on commit 26edf27

Please sign in to comment.