Fixed up screens looking incorrect on 1.20.4 mc versions

(cherry picked from commit 04ddd83519)
This commit is contained in:
coolGi
2023-12-09 14:41:15 +10:30
parent 67901d82c5
commit d3f953686a
3 changed files with 12 additions and 12 deletions
@@ -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;
@@ -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;
}
@@ -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;