mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-18 11:19:20 +00:00
Make book transformers available publicly. This is needed so that the index transformer can be applied after custom transformers
This commit is contained in:
1 parent
240466c546
commit
efb34bd983
2 files changed
+9
-2
No files matched your search
@@ -133,10 +133,10 @@ public class BookLoader implements IResourceManagerReloadListener {
|
||||
books.put(name.contains(":") ? name : Loader.instance().activeModContainer().getModId() + ":" + name, info);
|
||||
|
||||
if(appendIndex) {
|
||||
info.addTransformer(new BookTransformer.IndexTranformer());
|
||||
info.addTransformer(BookTransformer.IndexTranformer());
|
||||
}
|
||||
if(appendContentTable) {
|
||||
info.addTransformer(new BookTransformer.ContentTableTransformer());
|
||||
info.addTransformer(BookTransformer.contentTableTransformer());
|
||||
}
|
||||
|
||||
return info;
|
||||
|
||||
@@ -15,6 +15,9 @@ import slimeknights.mantle.client.book.data.element.TextData;
|
||||
|
||||
public abstract class BookTransformer {
|
||||
|
||||
public static BookTransformer IndexTranformer() { return IndexTranformer.INSTANCE; }
|
||||
public static BookTransformer contentTableTransformer() { return ContentTableTransformer.INSTANCE; }
|
||||
|
||||
/**
|
||||
* Called when all the sections within the book are loaded.
|
||||
*
|
||||
@@ -24,6 +27,8 @@ public abstract class BookTransformer {
|
||||
|
||||
protected static class IndexTranformer extends BookTransformer {
|
||||
|
||||
public static final IndexTranformer INSTANCE = new IndexTranformer();
|
||||
|
||||
@Override
|
||||
public void transform(BookData book) {
|
||||
SectionData index = new SectionData(true) {
|
||||
@@ -65,6 +70,8 @@ public abstract class BookTransformer {
|
||||
|
||||
protected static class ContentTableTransformer extends BookTransformer {
|
||||
|
||||
public static final ContentTableTransformer INSTANCE = new ContentTableTransformer();
|
||||
|
||||
@Override
|
||||
public void transform(BookData book) {
|
||||
final int ENTRIES_PER_PAGE = 24;
|
||||
|
||||
Reference in new issue
Block a user