From d3f953686a0f17e5f434f53d1afd724eba09d29e Mon Sep 17 00:00:00 2001 From: coolGi Date: Sat, 9 Dec 2023 14:41:15 +1030 Subject: [PATCH] Fixed up screens looking incorrect on 1.20.4 mc versions (cherry picked from commit 04ddd8351951228474c0e05a7cfa7e534c1342b7) --- .../common/wrappers/gui/ClassicConfigGUI.java | 8 ++++---- .../common/wrappers/gui/MinecraftScreen.java | 8 ++++---- .../common/wrappers/gui/updater/ChangelogScreen.java | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java index 7639dc12c..ac5a98482 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/ClassicConfigGUI.java @@ -278,7 +278,7 @@ public class ClassicConfigGUI Objects.requireNonNull(minecraft).setScreen(parent); })); - this.list = new ConfigListWidget(this.minecraft, this.width * 2, this.height, 32, this.height - 32); + this.list = new ConfigListWidget(this.minecraft, this.width * 2, this.height, 32, 32, 25); if (this.minecraft != null && this.minecraft.level != null) this.list.setRenderBackground(false); @@ -537,12 +537,12 @@ public class ClassicConfigGUI { Font textRenderer; - public ConfigListWidget(Minecraft minecraftClient, int i, int j, int k, int l) + public ConfigListWidget(Minecraft minecraftClient, int canvasWidth, int canvasHeight, int topMargin, int botMargin, int itemSpacing) { #if PRE_MC_1_20_4 - super(minecraftClient, i, j, k, l, 25); + super(minecraftClient, canvasWidth, canvasHeight, topMargin, canvasHeight - botMargin, itemSpacing); #else - super(minecraftClient, i, j, k, l); + super(minecraftClient, canvasWidth, canvasHeight - (topMargin + botMargin), topMargin, itemSpacing); #endif this.centerListVertically = false; textRenderer = minecraftClient.font; diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java index e90f235f5..aaa804181 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/MinecraftScreen.java @@ -59,7 +59,7 @@ public class MinecraftScreen screen.scaledHeight = this.height; screen.init(); // Init our own config screen - this.list = new ConfigListWidget(this.minecraft, this.width, this.height, 0, this.height); // Select the area to tint + this.list = new ConfigListWidget(this.minecraft, this.width, this.height, 0, 0, 25); // Select the area to tint if (this.minecraft != null && this.minecraft.level != null) // Check if in game this.list.setRenderBackground(false); // Disable from rendering this.addWidget(this.list); // Add the tint to the things to be rendered @@ -131,12 +131,12 @@ public class MinecraftScreen public static class ConfigListWidget extends ContainerObjectSelectionList { - public ConfigListWidget(Minecraft minecraftClient, int i, int j, int k, int l) + public ConfigListWidget(Minecraft minecraftClient, int canvasWidth, int canvasHeight, int topMargin, int botMargin, int itemSpacing) { #if PRE_MC_1_20_4 - super(minecraftClient, i, j, k, l, 25); + super(minecraftClient, canvasWidth, canvasHeight, topMargin, canvasHeight - botMargin, itemSpacing); #else - super(minecraftClient, i, j, k, l); + super(minecraftClient, canvasWidth, canvasHeight - (topMargin + botMargin), topMargin, itemSpacing); #endif this.centerListVertically = false; } diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java index ccccd8cc8..0b3b493db 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/gui/updater/ChangelogScreen.java @@ -134,7 +134,7 @@ public class ChangelogScreen extends DhScreen ); - this.changelogArea = new TextArea(this.minecraft, this.width * 2, this.height, 32, this.height - 32); + this.changelogArea = new TextArea(this.minecraft, this.width * 2, this.height, 32, 32, 10); for (int i = 0; i < changelog.size(); i++) { this.changelogArea.addButton(TextOrLiteral(changelog.get(i))); @@ -185,12 +185,12 @@ public class ChangelogScreen extends DhScreen { Font textRenderer; - public TextArea(Minecraft minecraftClient, int i, int j, int k, int l) + public TextArea(Minecraft minecraftClient, int canvasWidth, int canvasHeight, int topMargin, int botMargin, int itemSpacing) { #if PRE_MC_1_20_4 - super(minecraftClient, i, j, k, l, 10); + super(minecraftClient, canvasWidth, canvasHeight, topMargin, canvasHeight - botMargin, itemSpacing); #else - super(minecraftClient, i, j, k, l); + super(minecraftClient, canvasWidth, canvasHeight - (topMargin + botMargin), topMargin, itemSpacing); #endif this.centerListVertically = false; textRenderer = minecraftClient.font;