mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-26 14:53:04 +00:00
More book convenience
This commit is contained in:
1 parent
214328c239
commit
1bd2c73a09
3 files changed
+21
-4
No files matched your search
@@ -17,6 +17,7 @@ public abstract class BookTransformer {
|
||||
|
||||
public static BookTransformer IndexTranformer() { return IndexTranformer.INSTANCE; }
|
||||
public static BookTransformer contentTableTransformer() { return ContentTableTransformer.INSTANCE; }
|
||||
public static BookTransformer contentTableTransformerForSection(String sectionName) { return new ContentTableTransformer(sectionName); }
|
||||
|
||||
/**
|
||||
* Called when all the sections within the book are loaded.
|
||||
@@ -72,6 +73,16 @@ public abstract class BookTransformer {
|
||||
|
||||
public static final ContentTableTransformer INSTANCE = new ContentTableTransformer();
|
||||
|
||||
private final String sectionToTransform;
|
||||
|
||||
public ContentTableTransformer(String sectionToTransform) {
|
||||
this.sectionToTransform = sectionToTransform;
|
||||
}
|
||||
|
||||
public ContentTableTransformer() {
|
||||
this.sectionToTransform = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(BookData book) {
|
||||
final int ENTRIES_PER_PAGE = 24;
|
||||
@@ -80,6 +91,9 @@ public abstract class BookTransformer {
|
||||
if(section.name.equals("index")) {
|
||||
continue;
|
||||
}
|
||||
if(sectionToTransform != null && !section.name.equals(sectionToTransform)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int genPages = (int) Math.ceil(section.getPageCount() * 1.F / ENTRIES_PER_PAGE);
|
||||
|
||||
|
||||
Reference in new issue
Block a user