diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8fc3827..cf6ba55 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,8 +17,8 @@ jobs: - name: setup jdk uses: actions/setup-java@v4 with: - java-version: '21' - distribution: 'microsoft' + java-version: '25' + distribution: microsoft - name: make gradle wrapper executable run: chmod +x ./gradlew - name: build @@ -27,4 +27,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: Artifacts - path: build/libs/ \ No newline at end of file + path: build/libs/ diff --git a/README.md b/README.md index 74868e6..08ced41 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,11 @@

splashwrap

## Features + Enables line wrapping for long resource pack splash texts. Configurable maximum line length and minimum text scale. Compatible with [Give me a new splash text!](https://modrinth.com/mod/give-me-a-new-splash-text). ### Dependencies -[Mod Menu](https://modrinth.com/mod/modmenu) and [Cloth Config](https://modrinth.com/mod/cloth-config) optionally required to change config. \ No newline at end of file +[Mod Menu](https://modrinth.com/mod/modmenu) and [Cloth Config](https://modrinth.com/mod/cloth-config) optionally required to change config. diff --git a/build.gradle b/build.gradle index ad8ea02..96c3bb3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version "${loom_version}" + id 'net.fabricmc.fabric-loom' version "${loom_version}" id 'maven-publish' } @@ -16,15 +16,13 @@ repositories { } dependencies { - // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings loom.officialMojangMappings() - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + implementation "net.fabricmc:fabric-loader:${project.loader_version}" - modApi("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") { + api("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") { exclude(group: "net.fabricmc.fabric-api") } - modCompileOnly "com.terraformersmc:modmenu:${project.mod_menu_version}" + compileOnly "com.terraformersmc:modmenu:${project.mod_menu_version}" } processResources { @@ -35,14 +33,8 @@ processResources { } } -configurations.all { - resolutionStrategy { - force("net.fabricmc:fabric-loader:$loader_version") - } -} - tasks.withType(JavaCompile).configureEach { - it.options.release = 21 + it.options.release = 25 } java { @@ -51,8 +43,8 @@ java { // If you remove this line, sources will not be generated. withSourcesJar() - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 + sourceCompatibility = JavaVersion.VERSION_25 + targetCompatibility = JavaVersion.VERSION_25 } jar { @@ -79,4 +71,4 @@ publishing { // The repositories here will be used for publishing your artifact, not for // retrieving dependencies. } -} \ No newline at end of file +} diff --git a/gradle.properties b/gradle.properties index 54c5acf..572a683 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,18 +2,20 @@ org.gradle.jvmargs=-Xmx1G org.gradle.parallel=true +# IntelliJ IDEA is not yet fully compatible with configuration cache, see: https://github.com/FabricMC/fabric-loom/issues/1349 +org.gradle.configuration-cache=false + # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.21.11 -yarn_mappings=1.21.11+build.1 -loader_version=0.18.2 -loom_version=1.14-SNAPSHOT +minecraft_version=26.1 +loader_version=0.18.5 +loom_version=1.15-SNAPSHOT # Mod Properties -mod_version=1.0.4 +mod_version=1.0.5 maven_group=yungando.splashwrap archives_base_name=splashwrap # Dependencies -cloth_config_version=8.2.88 -mod_menu_version=5.0.2 \ No newline at end of file +cloth_config_version=26.1.154 +mod_menu_version=18.0.0-alpha.8 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index a4b76b9..61285a6 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 23449a2..19a6bde 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index f3b75f3..adff685 100644 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -172,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -205,15 +203,14 @@ fi DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # and any embedded shellness will be escaped. # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 9d21a21..c4bdd3a 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -70,11 +70,10 @@ goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell diff --git a/src/main/java/yungando/splashwrap/config/ModMenuEntrypoint.java b/src/main/java/yungando/splashwrap/config/ModMenuEntrypoint.java index 0596f97..1c3c951 100644 --- a/src/main/java/yungando/splashwrap/config/ModMenuEntrypoint.java +++ b/src/main/java/yungando/splashwrap/config/ModMenuEntrypoint.java @@ -2,12 +2,12 @@ import com.terraformersmc.modmenu.api.ConfigScreenFactory; import com.terraformersmc.modmenu.api.ModMenuApi; -import me.shedaniel.autoconfig.AutoConfig; +import me.shedaniel.autoconfig.AutoConfigClient; import yungando.splashwrap.config.SplashWrapConfig.SplashWrapAutoConfig; public class ModMenuEntrypoint implements ModMenuApi { @Override public ConfigScreenFactory getModConfigScreenFactory() { - return parent -> AutoConfig.getConfigScreen(SplashWrapAutoConfig.class, parent).get(); + return parent -> AutoConfigClient.getConfigScreen(SplashWrapAutoConfig.class, parent).get(); } } diff --git a/src/main/java/yungando/splashwrap/mixin/SplashTextRendererMixin.java b/src/main/java/yungando/splashwrap/mixin/SplashRendererMixin.java similarity index 57% rename from src/main/java/yungando/splashwrap/mixin/SplashTextRendererMixin.java rename to src/main/java/yungando/splashwrap/mixin/SplashRendererMixin.java index 881d25c..fb5a9eb 100644 --- a/src/main/java/yungando/splashwrap/mixin/SplashTextRendererMixin.java +++ b/src/main/java/yungando/splashwrap/mixin/SplashRendererMixin.java @@ -4,7 +4,7 @@ import com.llamalad7.mixinextras.sugar.Local; import net.minecraft.client.gui.ActiveTextCollector; import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.GuiGraphicsExtractor; import net.minecraft.client.gui.TextAlignment; import net.minecraft.client.gui.components.SplashRenderer; import net.minecraft.network.chat.Component; @@ -22,29 +22,29 @@ import java.util.List; @Mixin(SplashRenderer.class) -public class SplashTextRendererMixin { +public class SplashRendererMixin { @Shadow @Final private Component splash; - @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Font;width(Lnet/minecraft/network/chat/FormattedText;)I")) + @Redirect(method = "extractRenderState", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Font;width(Lnet/minecraft/network/chat/FormattedText;)I")) private int scaleSplashText(Font instance, FormattedText formattedText) { return Math.min(instance.width(this.splash), SplashWrap.config.minimumTextScale()); } - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/ActiveTextCollector;accept(Lnet/minecraft/client/gui/TextAlignment;IILnet/minecraft/client/gui/ActiveTextCollector$Parameters;Lnet/minecraft/network/chat/Component;)V")) - private void wrapSplashText(GuiGraphics guiGraphics, int i, Font font, float f, CallbackInfo ci, @Local(ordinal = 1) int j, @Local ActiveTextCollector.Parameters parameters, @Local ActiveTextCollector activeTextCollector) { + @Inject(method = "extractRenderState", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/ActiveTextCollector;accept(Lnet/minecraft/client/gui/TextAlignment;IILnet/minecraft/client/gui/ActiveTextCollector$Parameters;Lnet/minecraft/network/chat/Component;)V")) + private void wrapSplashText(GuiGraphicsExtractor guiGraphicsExtractor, int screenWidth, Font font, float alpha, CallbackInfo ci, @Local(name = "renderParameters") ActiveTextCollector.Parameters parameters, @Local(name = "textRenderer") ActiveTextCollector activeTextCollector) { FormattedText splashText = this.splash; List splashTextLines = font.split(splashText, SplashWrap.config.maximumLineWidth()); int y = -8; for (FormattedCharSequence splashLine : splashTextLines) { - activeTextCollector.accept(TextAlignment.CENTER, 0, y, parameters, splashLine); + activeTextCollector.accept(TextAlignment.LEFT, -font.width(splashLine) / 2, y, parameters, splashLine); y += 9; } } - @WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/ActiveTextCollector;accept(Lnet/minecraft/client/gui/TextAlignment;IILnet/minecraft/client/gui/ActiveTextCollector$Parameters;Lnet/minecraft/network/chat/Component;)V")) + @WrapWithCondition(method = "extractRenderState", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/ActiveTextCollector;accept(Lnet/minecraft/client/gui/TextAlignment;IILnet/minecraft/client/gui/ActiveTextCollector$Parameters;Lnet/minecraft/network/chat/Component;)V")) private boolean cancelVanillaDraw(ActiveTextCollector instance, TextAlignment textAlignment, int i, int j, ActiveTextCollector.Parameters parameters, Component component) { return false; } diff --git a/src/main/resources/assets/splashwrap/lang/en_us.json b/src/main/resources/assets/splashwrap/lang/en_us.json index 3a0169d..2bf1e46 100644 --- a/src/main/resources/assets/splashwrap/lang/en_us.json +++ b/src/main/resources/assets/splashwrap/lang/en_us.json @@ -4,4 +4,4 @@ "text.autoconfig.splashwrap.option.maximumLineWidth.@Tooltip": "The maximum width splash texts can be before wrapping to a new line.", "text.autoconfig.splashwrap.option.minimumTextScale": "Minimum Text Scale", "text.autoconfig.splashwrap.option.minimumTextScale.@Tooltip": "The minimum width that can be used to generate splash text scale. (Bigger number = smaller splash text)" -} \ No newline at end of file +} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index bed5f36..fa9dd0e 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -28,7 +28,7 @@ ], "depends": { "fabricloader": ">=0.16.14", - "minecraft": ">=1.21.6", - "java": ">=21" + "minecraft": ">=26.1", + "java": ">=25" } -} \ No newline at end of file +} diff --git a/src/main/resources/splashwrap.mixins.json b/src/main/resources/splashwrap.mixins.json index ea21161..b6dc7c1 100644 --- a/src/main/resources/splashwrap.mixins.json +++ b/src/main/resources/splashwrap.mixins.json @@ -1,11 +1,14 @@ { "required": true, "package": "yungando.splashwrap.mixin", - "compatibilityLevel": "JAVA_21", + "compatibilityLevel": "JAVA_25", "injectors": { "defaultRequire": 1 }, + "overwrites": { + "requireAnnotations": true + }, "client": [ - "SplashTextRendererMixin" + "SplashRendererMixin" ] -} \ No newline at end of file +}