From 91864443d58b1adc8e47db22caaa90039bfba9ed Mon Sep 17 00:00:00 2001 From: coolGi Date: Sun, 21 May 2023 20:36:01 +0930 Subject: [PATCH] Made the changelog screen look a bit nicer --- .../common/wrappers/gui/updater/ChangelogScreen.java | 11 ++++++++--- common/src/main/resources/1_18.lod.accesswidener | 1 + coreSubProjects | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/seibel/lod/common/wrappers/gui/updater/ChangelogScreen.java b/common/src/main/java/com/seibel/lod/common/wrappers/gui/updater/ChangelogScreen.java index 08c116660..0695af77a 100644 --- a/common/src/main/java/com/seibel/lod/common/wrappers/gui/updater/ChangelogScreen.java +++ b/common/src/main/java/com/seibel/lod/common/wrappers/gui/updater/ChangelogScreen.java @@ -38,6 +38,12 @@ public class ChangelogScreen extends Screen { this.versionID = versionID; this.changelog = new ArrayList<>(); + + // Put the new version name at the very top of the change log + this.changelog.add("§lChangelog for " + ModrinthGetter.releaseNames.get(versionID) + "§r"); + this.changelog.add(""); + this.changelog.add(""); + // Get the release changelog and split it by the new lines List unwrappedChangelog = List.of(new MarkdownFormatter.MinecraftFormat().convertTo( // This formats markdown to minecraft's "§" characters @@ -78,9 +84,8 @@ public class ChangelogScreen extends Screen { this.renderBackground(matrices); // Render background // Set the scroll position to the mouse height relative to the screen - this.changelogArea.setScrollAmount( - ((double) mouseY)/((double) this.height) * this.changelogArea.getMaxScroll() - ); + // This is a bit of a hack as we cannot scroll on this area + this.changelogArea.scrollAmount = ((double) mouseY)/((double) this.height) * 1.1 * this.changelogArea.getMaxScroll(); this.changelogArea.render(matrices, mouseX, mouseY, delta); // Render the changelog diff --git a/common/src/main/resources/1_18.lod.accesswidener b/common/src/main/resources/1_18.lod.accesswidener index f5fbb63b0..205df3528 100644 --- a/common/src/main/resources/1_18.lod.accesswidener +++ b/common/src/main/resources/1_18.lod.accesswidener @@ -48,3 +48,4 @@ extendable class com/mojang/math/Matrix4f # hacky stuff accessible field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore; mutable field net/minecraft/util/ThreadingDetector lock Ljava/util/concurrent/Semaphore; +accessible field net/minecraft/client/gui/components/AbstractSelectionList scrollAmount D # Hack to bypass vanilla's setScrollAmount's clamp diff --git a/coreSubProjects b/coreSubProjects index aee6c84da..195f044ee 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit aee6c84dae7a7ff835aa68585f53be01c9503138 +Subproject commit 195f044ee1a0d614e02613eb72a4b728b106efac