Skip to content

Commit

Permalink
Partial cleanup of ManualInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickMG authored and Dream-Master committed Jan 28, 2024
1 parent b40bbce commit f741fe5
Showing 1 changed file with 16 additions and 28 deletions.
44 changes: 16 additions & 28 deletions src/main/java/tconstruct/tools/items/ManualInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,65 +9,53 @@
import cpw.mods.fml.relauncher.Side;
import mantle.books.BookData;
import mantle.books.BookDataStore;
import tconstruct.TConstruct;
import tconstruct.client.TProxyClient;

/**
* This class is now just a constructor with side effects, so a glorified method call. TODO: Clean up when breaking API
* change is deemed acceptable.
*/
public class ManualInfo {
// static String[] name = new String[] { "beginner", "toolstation", "smeltery", "diary" };
// static String[] textureName = new String[] { "tinkerbook_diary", "tinkerbook_toolstation",
// "tinkerbook_smeltery", "tinkerbook_blue" };

BookData beginner = new BookData();
BookData toolStation = new BookData();
BookData smeltery = new BookData();
BookData diary = new BookData();
BookData weaponry = new BookData();

/*
* diary = readManual("/assets/tinker/manuals/diary.xml", dbFactory); volume1 =
* readManual("/assets/tinker/manuals/firstday.xml", dbFactory); volume2 =
* readManual("/assets/tinker/manuals/materials.xml", dbFactory); smelter =
* readManual("/assets/tinker/manuals/smeltery.xml", dbFactory);
*/

public ManualInfo() {
Side side = FMLCommonHandler.instance().getEffectiveSide();
beginner = initManual(
beginner,
initManual(
new BookData(),
"tconstruct.manual.beginner",
"\u00a7o" + StatCollector.translateToLocal("manual1.tooltip"),
side == Side.CLIENT ? TProxyClient.volume1 : null,
"tinker:tinkerbook_diary");
toolStation = initManual(
toolStation,
initManual(
new BookData(),
"tconstruct.manual.toolstation",
"\u00a7o" + StatCollector.translateToLocal("manual2.tooltip"),
side == Side.CLIENT ? TProxyClient.volume2 : null,
"tinker:tinkerbook_toolstation");
smeltery = initManual(
smeltery,
initManual(
new BookData(),
"tconstruct.manual.smeltery",
"\u00a7o" + StatCollector.translateToLocal("manual3.tooltip"),
side == Side.CLIENT ? TProxyClient.smelter : null,
"tinker:tinkerbook_smeltery");
diary = initManual(
diary,
initManual(
new BookData(),
"tconstruct.manual.diary",
"\u00a7o" + StatCollector.translateToLocal("manual4.tooltip"),
side == Side.CLIENT ? TProxyClient.diary : null,
"tinker:tinkerbook_blue");
weaponry = initManual(
weaponry,
initManual(
new BookData(),
"tconstruct.manual.weaponry",
"\u00a7o" + StatCollector.translateToLocal("manual5.tooltip"),
side == Side.CLIENT ? TProxyClient.weaponry : null,
"tinker:tinkerbook_green");
}

public BookData initManual(BookData data, String unlocName, String toolTip, Document xmlDoc, String itemImage) {
// proxy.readManuals();
data.unlocalizedName = unlocName;
data.toolTip = unlocName;
data.modID = "TConstruct";
data.modID = TConstruct.modID;
data.itemImage = new ResourceLocation(data.modID, itemImage);
data.doc = xmlDoc;
BookDataStore.addBook(data);
Expand Down

0 comments on commit f741fe5

Please sign in to comment.