Created
January 2, 2023 05:07
-
-
Save mworzala/9a8d86803784c9c81aac77d9a7f9fb2b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/BookScreen.java b/BookScreen.java | |
index d803582..2befb20 100644 | |
--- a/BookScreen.java | |
+++ b/BookScreen.java | |
@@ -72,17 +72,19 @@ public class BookScreen extends Screen { | |
} | |
protected void addCloseButton() { | |
- this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, 196, 200, 20, ScreenTexts.DONE, (button) -> { | |
+ int y = (this.height - 192) / 2; | |
+ this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, y + 196, 200, 20, ScreenTexts.DONE, (button) -> { | |
this.client.setScreen((Screen)null); | |
})); | |
} | |
protected void addPageButtons() { | |
int i = (this.width - 192) / 2; | |
- this.nextPageButton = (PageTurnWidget)this.addDrawableChild(new PageTurnWidget(i + 116, 159, true, (button) -> { | |
+ int y = (this.height - 192) / 2; | |
+ this.nextPageButton = (PageTurnWidget)this.addDrawableChild(new PageTurnWidget(i + 116, y + 159, true, (button) -> { | |
this.goToNextPage(); | |
}, this.pageTurnSound)); | |
- this.previousPageButton = (PageTurnWidget)this.addDrawableChild(new PageTurnWidget(i + 43, 159, false, (button) -> { | |
+ this.previousPageButton = (PageTurnWidget)this.addDrawableChild(new PageTurnWidget(i + 43, y + 159, false, (button) -> { | |
this.goToPreviousPage(); | |
}, this.pageTurnSound)); | |
this.updatePageButtons(); | |
@@ -136,7 +138,8 @@ public class BookScreen extends Screen { | |
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); | |
RenderSystem.setShaderTexture(0, BOOK_TEXTURE); | |
int i = (this.width - 192) / 2; | |
- this.drawTexture(matrices, i, 2, 0, 0, 192, 192); | |
+ int y = (this.height - 192) / 2; | |
+ this.drawTexture(matrices, i, y + 2, 0, 0, 192, 192); | |
if (this.cachedPageIndex != this.pageIndex) { | |
StringVisitable stringVisitable = this.contents.getPage(this.pageIndex); | |
this.cachedPage = this.textRenderer.wrapLines(stringVisitable, 114); | |
@@ -145,7 +148,7 @@ public class BookScreen extends Screen { | |
this.cachedPageIndex = this.pageIndex; | |
int k = this.textRenderer.getWidth(this.pageIndexText); | |
- this.textRenderer.draw(matrices, this.pageIndexText, (float)(i - k + 192 - 44), 18.0F, 0); | |
+ this.textRenderer.draw(matrices, this.pageIndexText, (float)(i - k + 192 - 44), y + 18.0F, 0); | |
Objects.requireNonNull(this.textRenderer); | |
int l = Math.min(128 / 9, this.cachedPage.size()); | |
@@ -154,7 +157,7 @@ public class BookScreen extends Screen { | |
TextRenderer var10000 = this.textRenderer; | |
float var10003 = (float)(i + 36); | |
Objects.requireNonNull(this.textRenderer); | |
- var10000.draw(matrices, orderedText, var10003, (float)(32 + m * 9), 0); | |
+ var10000.draw(matrices, orderedText, var10003, y + (float)(32 + m * 9), 0); | |
} | |
Style style = this.getTextStyleAt((double)mouseX, (double)mouseY); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment