mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-21 04:22:22 +00:00
Add a parameter that indicates whether the page is a left or right side
This commit is contained in:
1 parent
ffd38cf8e8
commit
5e537bd3ee
18 files changed
+20
-20
No files matched your search
@@ -12,6 +12,6 @@ import slimeknights.mantle.client.gui.book.element.BookElement;
|
||||
public class ContentBlank extends PageContent {
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list) {
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -33,7 +33,7 @@ public class ContentBlockInteraction extends PageContent {
|
||||
public TextData[] description;
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list) {
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
int x = GuiBook.PAGE_WIDTH / 2 - IMG_SMITHING.width / 2 - 10;
|
||||
int y = TITLE_HEIGHT;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ContentCrafting extends PageContent {
|
||||
public TextData[] description;
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list) {
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
int x = 0;
|
||||
int y = 16;
|
||||
int height = 100;
|
||||
|
||||
@@ -12,7 +12,7 @@ import slimeknights.mantle.client.gui.book.element.BookElement;
|
||||
public class ContentDummy extends PageContent {
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list) {
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
//TODO load from JSON
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class ContentError extends PageContent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list) {
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
addTitle(list, "Error");
|
||||
|
||||
TextData[] text = new TextData[1 + (exception != null ? 2 : 0)];
|
||||
|
||||
@@ -18,7 +18,7 @@ public class ContentImage extends PageContent {
|
||||
public ImageData image;
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list) {
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
int y = TITLE_HEIGHT;
|
||||
|
||||
if(title == null || title.isEmpty()) {
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ContentImageText extends PageContent {
|
||||
public TextData[] text;
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list) {
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
int y = TITLE_HEIGHT;
|
||||
|
||||
if(title == null || title.isEmpty()) {
|
||||
|
||||
@@ -16,7 +16,7 @@ public class ContentSectionList extends PageContent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list) {
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
int width = (ElementSection.WIDTH + 5) * 3 - 5;
|
||||
int height = (ElementSection.HEIGHT + 5) * 3 - 5;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ContentSmelting extends PageContent {
|
||||
public TextData[] description;
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list) {
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
int x = GuiBook.PAGE_WIDTH / 2 - IMG_SMELTING.width / 2;
|
||||
int y = TITLE_HEIGHT;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ContentSmithing extends PageContent {
|
||||
public TextData[] description;
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list) {
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
int x = GuiBook.PAGE_WIDTH / 2 - IMG_SMITHING.width / 2;
|
||||
int y = TITLE_HEIGHT;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ContentStructure extends PageContent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list) {
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
int y = TITLE_HEIGHT;
|
||||
if(title == null || title.isEmpty()) {
|
||||
y = 0;
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ public class ContentTableOfContents extends PageContent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list) {
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
int y = 0;
|
||||
|
||||
if(title != null && !title.trim().isEmpty()) {
|
||||
|
||||
@@ -18,7 +18,7 @@ public class ContentText extends PageContent {
|
||||
public TextData[] text;
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list) {
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
int y = TITLE_HEIGHT;
|
||||
|
||||
if(title == null || title.isEmpty()) {
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ContentTextImage extends PageContent {
|
||||
public ImageData image;
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list) {
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
int y = TITLE_HEIGHT;
|
||||
|
||||
if(title == null || title.isEmpty()) {
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ public class ContentTextLeftImage extends PageContent {
|
||||
public TextData[] text2;
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list) {
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
int y = TITLE_HEIGHT;
|
||||
|
||||
if(title == null || title.isEmpty()) {
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ public class ContentTextRightImage extends PageContent {
|
||||
public ImageData image;
|
||||
|
||||
@Override
|
||||
public void build(BookData book, ArrayList<BookElement> list) {
|
||||
public void build(BookData book, ArrayList<BookElement> list, boolean rightSide) {
|
||||
int y = TITLE_HEIGHT;
|
||||
|
||||
if(title == null || title.isEmpty()) {
|
||||
|
||||
@@ -24,7 +24,7 @@ public abstract class PageContent {
|
||||
public void load() {
|
||||
}
|
||||
|
||||
public abstract void build(BookData book, ArrayList<BookElement> list);
|
||||
public abstract void build(BookData book, ArrayList<BookElement> list, boolean rightSide);
|
||||
|
||||
public void addTitle(ArrayList<BookElement> list, String title) {
|
||||
TextData tdTitle = new TextData(title);
|
||||
|
||||
@@ -341,17 +341,17 @@ public class GuiBook extends GuiScreen implements IProgressMeter {
|
||||
PageData page = book.findPage(0, statFile);
|
||||
|
||||
if(page != null) {
|
||||
page.content.build(book, rightElements);
|
||||
page.content.build(book, rightElements, false);
|
||||
}
|
||||
} else {
|
||||
PageData leftPage = book.findPage((page - 1) * 2 + 1, statFile);
|
||||
PageData rightPage = book.findPage((page - 1) * 2 + 2, statFile);
|
||||
|
||||
if(leftPage != null) {
|
||||
leftPage.content.build(book, leftElements);
|
||||
leftPage.content.build(book, leftElements, false);
|
||||
}
|
||||
if(rightPage != null) {
|
||||
rightPage.content.build(book, rightElements);
|
||||
rightPage.content.build(book, rightElements, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user