mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-27 15:23:12 +00:00
Book repository system
- Books may now have several 'repositories' which they load sections from - Page numbers dynamically calculated
This commit is contained in:
1 parent
4b5c849893
commit
59e9e52a2a
10 files changed
+131
-77
No files matched your search
@@ -14,15 +14,13 @@ import static slimeknights.mantle.client.book.ResourceHelper.resourceToString;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class SectionData implements IDataItem {
|
||||
|
||||
public String name = BookLoader.randomName();
|
||||
public String name = null;
|
||||
public String title = "";
|
||||
public ImageData icon = new ImageData();
|
||||
public CriteriaData[] unlockCriteria = new CriteriaData[0];
|
||||
public String data = "";
|
||||
|
||||
public int pageCount;
|
||||
|
||||
public transient int unnamedPageCounter = 0;
|
||||
public transient BookData parent;
|
||||
public transient ArrayList<PageData> pages = new ArrayList<>();
|
||||
|
||||
@@ -36,7 +34,10 @@ public class SectionData implements IDataItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int cascadeLoad() {
|
||||
public void load() {
|
||||
if(name == null)
|
||||
name = "section" + parent.unnamedSectionCounter++;
|
||||
|
||||
name = name.toLowerCase();
|
||||
|
||||
if (!data.equals("no-load")) {
|
||||
@@ -50,13 +51,13 @@ public class SectionData implements IDataItem {
|
||||
|
||||
for (PageData page : pages) {
|
||||
page.parent = this;
|
||||
page.cascadeLoad();
|
||||
page.load();
|
||||
}
|
||||
|
||||
icon.location = getResourceLocation(icon.file, true);
|
||||
}
|
||||
|
||||
pageCount = pages.size();
|
||||
|
||||
return pageCount;
|
||||
public int getPageCount() {
|
||||
return pages.size();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user