diff --git a/.gitignore b/.gitignore index e79ae3d..57fb3a1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,119 +1,8 @@ -# User-specific stuff -.idea/ - -*.iml -*.ipr -*.iws - -# IntelliJ -out/ -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Compiled class file -*.class - -# Log file -*.log - -# BlueJ files -*.ctxt - -# Package Files # -*.jar -*.war -*.nar -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* - -# General +.vscode +.idea .DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -# Windows thumbnail cache files -Thumbs.db -Thumbs.db:encryptable -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk +build .gradle -build/ - -# Ignore Gradle GUI config -gradle-app.setting - -# Cache of project -.gradletasknamecache - -**/build/ - -# Common working directory -run/ - -# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) -!gradle-wrapper.jar -gradle/ +run +bin \ No newline at end of file diff --git a/README.md b/README.md index 76b3fd4..9d61f78 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,13 @@ Adds an option to change Splash Text in Title Screen using awesome in-game CONFI splash-changer-preview +## Upgrading +- Change the values in [gradle.properties](gradle.properties) + +## Developing +Follow the guide in https://docs.fabricmc.net/develop/getting-started/setting-up-a-development-environment + +You will probably need to set up IntelliJ in order to view the sources that you will be writing mixins for. +- `gradle idea` + +Testing: `gradle runClient` \ No newline at end of file diff --git a/build.gradle b/build.gradle index db83b2e..d731d4b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.6-SNAPSHOT' + id 'fabric-loom' id 'maven-publish' } @@ -22,12 +22,12 @@ dependencies { modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" // Fabric API. This is technically optional, but you probably want it anyway. - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" - modApi("maven.modrinth:midnightlib:${project.midnight_version}") { + modApi("maven.modrinth:midnightlib:${project.midnightlib_version}") { exclude(group: "net.fabricmc.fabric-api") } - include("maven.modrinth:midnightlib:${project.midnight_version}") { + include("maven.modrinth:midnightlib:${project.midnightlib_version}") { exclude(group: "net.fabricmc.fabric-api") } } @@ -36,7 +36,7 @@ processResources { inputs.property "version", project.version inputs.property "minecraft_version", project.minecraft_version inputs.property "loader_version", project.loader_version - filteringCharset "UTF-8" + filteringCharset = "UTF-8" filesMatching("fabric.mod.json") { expand "version": project.version, @@ -62,16 +62,19 @@ java { if (JavaVersion.current() < javaVersion) { toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) } - archivesBaseName = project.archives_base_name // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task // if it is present. // If you remove this line, sources will not be generated. withSourcesJar() } +base { + archivesName = project.archives_base_name +} + jar { from("LICENSE") { - rename { "${it}_${project.archivesBaseName}"} + rename { "${it}_${project.archives_base_name}"} } } diff --git a/gradle.properties b/gradle.properties index 2f689b8..43d0235 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,17 +1,14 @@ -# Done to increase the memory available to gradle. - org.gradle.jvmargs=-Xmx1G +# https://fabricmc.net/develop/ +minecraft_version=1.21.11 +yarn_mappings=1.21.11+build.4 +loader_version=0.18.4 +loom_version=1.14-SNAPSHOT +fabric_api_version=0.141.1+1.21.11 -# Fabric Properties - # check these on https://modmuss50.me/fabric.html - minecraft_version=1.21.1 - loader_version=0.16.5 +# https://www.midnightdust.eu/wiki/midnightlib/ +midnightlib_version = 1.9.2+1.21.11-fabric # Mod Properties - mod_version = 1.1.0 - maven_group = me.mrsam7k - archives_base_name = SplashChanger - -# Dependencies - # check this on https://modmuss50.me/fabric.html - fabric_version=0.104.0+1.21.1 - midnight_version=1.6.3-fabric +mod_version = 1.1.0 +maven_group = me.mrsam7k +archives_base_name = SplashChanger diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..f8e1ee3 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37aef8d..23449a2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1aa94a4..adff685 100755 --- 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. @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -112,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. @@ -170,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" ) @@ -203,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 93e3f59..e509b2d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,92 +1,93 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -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 %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + + + +@rem Execute Gradle +"%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 +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle index f91a4fe..9ee781a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,4 +6,7 @@ pluginManagement { } gradlePluginPortal() } + plugins { + id("fabric-loom") version "${loom_version}" + } } diff --git a/src/main/java/me/mrsam7k/splashchanger/SplashChanger.java b/src/main/java/me/mrsam7k/splashchanger/SplashChanger.java index aa928e6..3eb203a 100644 --- a/src/main/java/me/mrsam7k/splashchanger/SplashChanger.java +++ b/src/main/java/me/mrsam7k/splashchanger/SplashChanger.java @@ -12,8 +12,6 @@ public class SplashChanger implements ModInitializer { public static String MOD_ID = "splashchanger"; - public static int RANDOM_SPLASH_INT = 0; - public static List CACHED_SPLASHES = new ArrayList<>(); public static User USER = null; @Override diff --git a/src/main/java/me/mrsam7k/splashchanger/config/Config.java b/src/main/java/me/mrsam7k/splashchanger/config/Config.java index 2e5fd5c..de39c74 100644 --- a/src/main/java/me/mrsam7k/splashchanger/config/Config.java +++ b/src/main/java/me/mrsam7k/splashchanger/config/Config.java @@ -9,24 +9,34 @@ public class Config extends MidnightConfig { - @Entry public static SplashModes splashMode = SplashModes.RANDOM_SPLASH; - public enum SplashModes { - SINGLE_SPLASH, RANDOM_SPLASH, ORIGINAL, NONE + @Entry + public static SplashMode splashMode = SplashMode.RANDOM_SPLASH; + + public enum SplashMode { + SINGLE_SPLASH, RANDOM_SPLASH, ORIGINAL, ORIGINAL_1_0, ORIGINAL_1_8, NONE } - @Entry public static String customSplash = "Singular Splash!"; - @Entry public static List customSplashes = Lists.newArrayList("%name, that's you... I think", "Change this in options!", "&cC&6o&el&ao&br&9e&5d&r &a&lSPLASH"); + @Entry + public static String customSplash = "Singular Splash!"; + @Entry + public static List customSplashes = Lists.newArrayList("%name, that's you... I think", + "Change this in options!", "&cC&6o&el&ao&br&9e&5d&r &a&lSPLASH"); + + @Comment + public static Comment spacer1; + @Comment(centered = true) + public static Comment customizationComment; - @Comment public static Comment spacer1; - @Comment(centered = true) public static Comment customizationComment; + @Entry + public static Colors color = Colors.YELLOW; - @Entry public static Colors color = Colors.YELLOW; public enum Colors { BLACK("0"), DARK_BLUE("1"), DARK_GREEN("2"), DARK_AQUA("3"), DARK_RED("4"), DARK_PURPLE("5"), GOLD("6"), GRAY("7"), DARK_GRAY("8"), BLUE("9"), GREEN("a"), AQUA("b"), RED("c"), LIGHT_PURPLE("d"), YELLOW("e"), WHITE("f"); private final String code; + Colors(String code) { this.code = code; } @@ -36,17 +46,24 @@ public String getCode() { } } - @Entry public static boolean OBFUSCATED = false; - @Entry public static boolean BOLD = false; - @Entry public static boolean STRIKETHROUGH = false; - @Entry public static boolean UNDERLINE = false; - @Entry public static boolean ITALIC = false; + @Entry + public static boolean OBFUSCATED = false; + @Entry + public static boolean BOLD = false; + @Entry + public static boolean STRIKETHROUGH = false; + @Entry + public static boolean UNDERLINE = false; + @Entry + public static boolean ITALIC = false; - @Comment public static Comment spacer2; + @Comment + public static Comment spacer2; - @Entry public static boolean disableButton = false; + @Entry + public static boolean disableButton = false; - public static Screen getScreen(Screen parent){ + public static Screen getMidnightScreen(Screen parent) { return MidnightConfig.getScreen(parent, SplashChanger.MOD_ID); } diff --git a/src/main/java/me/mrsam7k/splashchanger/mixin/OptionsScreen.java b/src/main/java/me/mrsam7k/splashchanger/mixin/OptionsScreen.java index 2c625a1..e741417 100644 --- a/src/main/java/me/mrsam7k/splashchanger/mixin/OptionsScreen.java +++ b/src/main/java/me/mrsam7k/splashchanger/mixin/OptionsScreen.java @@ -22,7 +22,7 @@ protected void init(CallbackInfo callbackInfo) { if(Config.disableButton) return; Minecraft mc = Minecraft.getInstance(); - this.addRenderableWidget(Button.builder(Component.literal("Splash Text"), (button) -> mc.setScreen(Config.getScreen(mc.screen)) + this.addRenderableWidget(Button.builder(Component.literal("Splash Text"), (button) -> mc.setScreen(Config.getMidnightScreen(mc.screen)) ).build()); } diff --git a/src/main/java/me/mrsam7k/splashchanger/mixin/SplashRenderer.java b/src/main/java/me/mrsam7k/splashchanger/mixin/SplashRenderer.java index 675d576..5d8234c 100644 --- a/src/main/java/me/mrsam7k/splashchanger/mixin/SplashRenderer.java +++ b/src/main/java/me/mrsam7k/splashchanger/mixin/SplashRenderer.java @@ -1,8 +1,8 @@ package me.mrsam7k.splashchanger.mixin; - import me.mrsam7k.splashchanger.SplashChanger; import me.mrsam7k.splashchanger.config.Config; +import me.mrsam7k.splashchanger.config.Config.SplashMode; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; import org.spongepowered.asm.mixin.Final; @@ -12,31 +12,27 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.Style; -import java.util.Random; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.*; @Mixin(net.minecraft.client.gui.components.SplashRenderer.class) public class SplashRenderer { - @Mutable @Shadow @Final - private String splash; + private final Random random = new Random(); - @Inject(method = "render", at = @At("HEAD")) - public void render(GuiGraphics guiGraphics, int i, Font font, int j, CallbackInfo ci) { + private Map splashStrings; - String splash = ""; - if(Config.splashMode.equals(Config.SplashModes.SINGLE_SPLASH)) - splash = Config.customSplash; - - else if(Config.splashMode.equals(Config.SplashModes.RANDOM_SPLASH)){ - if(SplashChanger.CACHED_SPLASHES == Config.customSplashes) - splash = SplashChanger.CACHED_SPLASHES.get(SplashChanger.RANDOM_SPLASH_INT); - else { - SplashChanger.RANDOM_SPLASH_INT = new Random().nextInt(Config.customSplashes.size()); - splash = Config.customSplashes.get(SplashChanger.RANDOM_SPLASH_INT); - SplashChanger.CACHED_SPLASHES = Config.customSplashes; - } + @Mutable @Shadow @Final + private Component splash; + @Inject(method = "render", at = @At("HEAD")) + public void render(GuiGraphics guiGraphics, int i, Font font, float f, CallbackInfo ci) { + if (splashStrings == null) { + initSplashStrings(); } StringBuilder sb = new StringBuilder(); @@ -51,16 +47,40 @@ else if(Config.splashMode.equals(Config.SplashModes.RANDOM_SPLASH)){ }; for (String format : formats) { - if(!format.isEmpty()) + if (!format.isEmpty()) sb.append(format); } - if(SplashChanger.USER != null) - sb.append(splash.replace("&", "§").replace("%name", SplashChanger.USER.getName())); + if (SplashChanger.USER != null) + sb.append(splashStrings.get(Config.splashMode).replace("&", "§").replace("%name", SplashChanger.USER.getName())); - if(!Config.splashMode.equals(Config.SplashModes.ORIGINAL)) - this.splash = sb.toString(); + this.splash = Component.literal(sb.toString()).setStyle(Style.EMPTY.withColor(-256)); } + private void initSplashStrings() { + splashStrings = new HashMap<>(); + + splashStrings.put(SplashMode.SINGLE_SPLASH, Config.customSplash); + splashStrings.put(SplashMode.RANDOM_SPLASH, Config.customSplashes.get(random.nextInt(Config.customSplashes.size()))); + splashStrings.put(SplashMode.ORIGINAL, this.splash.getString()); + splashStrings.put(SplashMode.ORIGINAL_1_0, randomSplashFromFile("presets/1.0.txt")); + splashStrings.put(SplashMode.ORIGINAL_1_8, randomSplashFromFile("presets/1.8.txt")); + splashStrings.put(SplashMode.NONE, ""); + } + private String randomSplashFromFile(String path) { + try { + String[] splashFileStrings = new String( + SplashRenderer.class.getClassLoader().getResourceAsStream(path).readAllBytes(), + StandardCharsets.UTF_8 + ).split("\n"); + List allSplashes = Arrays.stream(splashFileStrings) + .map(String::trim) + .filter(line -> !line.isEmpty()) + .toList(); + return allSplashes.get(random.nextInt(allSplashes.size())); + } catch (IOException e) { + throw new RuntimeException("Unexpected Error. Should be able to read resource file in jar.", e); + } + } } diff --git a/src/main/resources/assets/splashchanger/lang/en_us.json b/src/main/resources/assets/splashchanger/lang/en_us.json index 43372ab..a84120b 100644 --- a/src/main/resources/assets/splashchanger/lang/en_us.json +++ b/src/main/resources/assets/splashchanger/lang/en_us.json @@ -30,10 +30,12 @@ "splashchanger.midnightconfig.enum.Colors.WHITE": "§fWhite (&f)", - "splashchanger.midnightconfig.enum.SplashModes.SINGLE_SPLASH": "Single Splash", - "splashchanger.midnightconfig.enum.SplashModes.RANDOM_SPLASH": "Random Splash From List", - "splashchanger.midnightconfig.enum.SplashModes.ORIGINAL": "Minecraft's Splashes", - "splashchanger.midnightconfig.enum.SplashModes.NONE": "None", + "splashchanger.midnightconfig.enum.SplashMode.SINGLE_SPLASH": "Single Splash", + "splashchanger.midnightconfig.enum.SplashMode.RANDOM_SPLASH": "Random Splash From List", + "splashchanger.midnightconfig.enum.SplashMode.ORIGINAL": "Vanilla Splashes", + "splashchanger.midnightconfig.enum.SplashMode.ORIGINAL_1_0": "Minecraft 1.0", + "splashchanger.midnightconfig.enum.SplashMode.ORIGINAL_1_8": "Minecraft 1.8", + "splashchanger.midnightconfig.enum.SplashMode.NONE": "None", "splashchanger.midnightconfig.disableButton": "Disable SplashChanger's Button in Options Screen", "splashchanger.midnightconfig.disableButton.tooltip": "§cWarning: enabling this option will not let you access SplashChanger's config unless you are using Mod Menu!", diff --git a/src/main/resources/presets/1.0.txt b/src/main/resources/presets/1.0.txt new file mode 100644 index 0000000..ec45858 --- /dev/null +++ b/src/main/resources/presets/1.0.txt @@ -0,0 +1,288 @@ +As seen on TV! +Awesome! +100% pure! +May contain nuts! +Better than Prey! +More polygons! +Sexy! +Limited edition! +Flashing letters! +Made by Notch! +It's here! +Best in class! +It's finished! +Kind of dragon free! +Excitement! +More than 500 sold! +One of a kind! +Heaps of hits on YouTube! +Indev! +Spiders everywhere! +Check it out! +Holy cow, man! +It's a game! +Made in Sweden! +Uses LWJGL! +Reticulating splines! +Minecraft! +Yaaay! +Singleplayer! +Keyboard compatible! +Undocumented! +Ingots! +Exploding creepers! +That's no moon! +l33t! +Create! +Survive! +Dungeon! +Exclusive! +The bee's knees! +Down with O.P.P.! +Closed source! +Classy! +Wow! +Not on steam! +Oh man! +Awesome community! +Pixels! +Teetsuuuuoooo! +Kaaneeeedaaaa! +Now with difficulty! +Enhanced! +90% bug free! +Pretty! +12 herbs and spices! +Fat free! +Absolutely no memes! +Free dental! +Ask your doctor! +Minors welcome! +Cloud computing! +Legal in Finland! +Hard to label! +Technically good! +Bringing home the bacon! +Indie! +GOTY! +Ceci n'est pas une title screen! +Euclidian! +Now in 3D! +Inspirational! +Herregud! +Complex cellular automata! +Yes, sir! +Played by cowboys! +OpenGL 1.2! +Thousands of colors! +Try it! +Age of Wonders is better! +Try the mushroom stew! +Sensational! +Hot tamale, hot hot tamale! +Play him off, keyboard cat! +Guaranteed! +Macroscopic! +Bring it on! +Random splash! +Call your mother! +Monster infighting! +Loved by millions! +Ultimate edition! +Freaky! +You've got a brand new key! +Water proof! +Uninflammable! +Whoa, dude! +All inclusive! +Tell your friends! +NP is not in P! +Notch <3 ez! +Music by C418! +Livestreamed! +Haunted! +Polynomial! +Terrestrial! +All is full of love! +Full of stars! +Scientific! +Cooler than Spock! +Collaborate and listen! +Never dig down! +Take frequent breaks! +Not linear! +Han shot first! +Nice to meet you! +Buckets of lava! +Ride the pig! +Larger than Earth! +sqrt(-1) love you! +Phobos anomaly! +Punching wood! +Falling off cliffs! +0% sugar! +150% hyperbole! +Synecdoche! +Let's danec! +Seecret Friday update! +Reference implementation! +Lewd with two dudes with food! +Kiss the sky! +20 GOTO 10! +Verlet intregration! +Peter Griffin! +Do not distribute! +Cogito ergo sum! +4815162342 lines of code! +A skeleton popped out! +The Work of Notch! +The sum of its parts! +BTAF used to be good! +I miss ADOM! +umop-apisdn! +OICU812! +Bring me Ray Cokes! +Finger-licking! +Thematic! +Pneumatic! +Sublime! +Octagonal! +Une baguette! +Gargamel plays it! +Rita is the new top dog! +SWM forever! +Representing Edsbyn! +Matt Damon! +Supercalifragilisticexpialidocious! +Consummate V's! +Cow Tools! +Double buffered! +Fan fiction! +Flaxkikare! +Jason! Jason! Jason! +Hotter than the sun! +Internet enabled! +Autonomous! +Engage! +Fantasy! +DRR! DRR! DRR! +Kick it root down! +Regional resources! +Woo, facepunch! +Woo, somethingawful! +Woo, /v/! +Woo, tigsource! +Woo, minecraftforum! +Woo, worldofminecraft! +Woo, reddit! +Woo, 2pp! +Google anlyticsed! +Now supports åäö! +Give us Gordon! +Tip your waiter! +Very fun! +12345 is a bad password! +Vote for net neutrality! +Lives in a pineapple under the sea! +MAP11 has two names! +Omnipotent! +Gasp! +...! +Bees, bees, bees, bees! +Jag känner en bot! +This text is hard to read if you play the game at the default resolution, but at 1080p it's fine! +Haha, LOL! +Hampsterdance! +Switches and ores! +Menger sponge! +idspispopd! +Eple (original edit)! +So fresh, so clean! +Slow acting portals! +Try the Nether! +Don't look directly at the bugs! +Oh, ok, Pigmen! +Finally with ladders! +Scary! +Play Minecraft, Watch Topgear, Get Pig! +Twittered about! +Jump up, jump up, and get down! +Joel is neat! +A riddle, wrapped in a mystery! +Huge tracts of land! +Welcome to your Doom! +Stay a while, stay forever! +Stay a while and listen! +Treatment for your rash! +"Autological" is! +Information wants to be free! +"Almost never" is an interesting concept! +Lots of truthiness! +The creeper is a spy! +Turing complete! +It's groundbreaking! +Let our battle's begin! +The sky is the limit! +Jeb has amazing hair! +Casual gaming! +Undefeated! +Kinda like Lemmings! +Follow the train, CJ! +Leveraging synergy! +This message will never appear on the splash screen, isn't that weird? +DungeonQuest is unfair! +110813! +90210! +Check out the far lands! +Tyrion would love it! +Also try VVVVVV! +Also try Super Meat Boy! +Also try Terraria! +Also try Mount And Blade! +Also try Project Zomboid! +Also try World of Goo! +Also try Limbo! +Also try Pixeljunk Shooter! +Also try Braid! +That's super! +Bread is pain! +Read more books! +Khaaaaaaaaan! +Less addictive than TV Tropes! +More addictive than lemonade! +Bigger than a bread box! +Millions of peaches! +Fnord! +This is my true form! +Totally forgot about Dre! +Don't bother with the clones! +Pumpkinhead! +Hobo humping slobo babe! +Made by Jeb! +Has an ending! +Finally complete! +Feature packed! +Boots with the fur! +Stop, hammertime! +Testificates! +Conventional! +Homeomorphic to a 3-sphere! +Doesn't avoid double negatives! +Place ALL the blocks! +Does barrel rolls! +Meeting expectations! +PC gaming since 1873! +Ghoughpteighbteau tchoghs! +Déjà vu! +Déjà vu! +Got your nose! +Haley loves Elan! +Afraid of the big, black bat! +Doesn't use the U-word! +Child's play! +See you next Friday or so! +From the streets of Södermalm! +150 bpm for 400000 minutes! +Technologic! +Funk soul brother! +Pumpa kungen! diff --git a/src/main/resources/presets/1.8.txt b/src/main/resources/presets/1.8.txt new file mode 100644 index 0000000..50a87bd --- /dev/null +++ b/src/main/resources/presets/1.8.txt @@ -0,0 +1,357 @@ +As seen on TV! +Awesome! +100% pure! +May contain nuts! +Better than Prey! +More polygons! +Sexy! +Limited edition! +Flashing letters! +Made by Notch! +It's here! +Best in class! +It's finished! +Kind of dragon free! +Excitement! +More than 500 sold! +One of a kind! +Heaps of hits on YouTube! +Indev! +Spiders everywhere! +Check it out! +Holy cow, man! +It's a game! +Made in Sweden! +Uses LWJGL! +Reticulating splines! +Minecraft! +Yaaay! +Singleplayer! +Keyboard compatible! +Undocumented! +Ingots! +Exploding creepers! +That's no moon! +l33t! +Create! +Survive! +Dungeon! +Exclusive! +The bee's knees! +Down with O.P.P.! +Closed source! +Classy! +Wow! +Not on steam! +Oh man! +Awesome community! +Pixels! +Teetsuuuuoooo! +Kaaneeeedaaaa! +Now with difficulty! +Enhanced! +90% bug free! +Pretty! +12 herbs and spices! +Fat free! +Absolutely no memes! +Free dental! +Ask your doctor! +Minors welcome! +Cloud computing! +Legal in Finland! +Hard to label! +Technically good! +Bringing home the bacon! +Indie! +GOTY! +Ceci n'est pas une title screen! +Euclidian! +Now in 3D! +Inspirational! +Herregud! +Complex cellular automata! +Yes, sir! +Played by cowboys! +OpenGL 2.1 (if supported)! +Thousands of colors! +Try it! +Age of Wonders is better! +Try the mushroom stew! +Sensational! +Hot tamale, hot hot tamale! +Play him off, keyboard cat! +Guaranteed! +Macroscopic! +Bring it on! +Random splash! +Call your mother! +Monster infighting! +Loved by millions! +Ultimate edition! +Freaky! +You've got a brand new key! +Water proof! +Uninflammable! +Whoa, dude! +All inclusive! +Tell your friends! +NP is not in P! +Notch <3 ez! +Music by C418! +Livestreamed! +Haunted! +Polynomial! +Terrestrial! +All is full of love! +Full of stars! +Scientific! +Cooler than Spock! +Collaborate and listen! +Never dig down! +Take frequent breaks! +Not linear! +Han shot first! +Nice to meet you! +Buckets of lava! +Ride the pig! +Larger than Earth! +sqrt(-1) love you! +Phobos anomaly! +Punching wood! +Falling off cliffs! +0% sugar! +150% hyperbole! +Synecdoche! +Let's danec! +Seecret Friday update! +Reference implementation! +Lewd with two dudes with food! +Kiss the sky! +20 GOTO 10! +Verlet intregration! +Peter Griffin! +Do not distribute! +Cogito ergo sum! +4815162342 lines of code! +A skeleton popped out! +The Work of Notch! +The sum of its parts! +BTAF used to be good! +I miss ADOM! +umop-apisdn! +OICU812! +Bring me Ray Cokes! +Finger-licking! +Thematic! +Pneumatic! +Sublime! +Octagonal! +Une baguette! +Gargamel plays it! +Rita is the new top dog! +SWM forever! +Representing Edsbyn! +Matt Damon! +Supercalifragilisticexpialidocious! +Consummate V's! +Cow Tools! +Double buffered! +Fan fiction! +Flaxkikare! +Jason! Jason! Jason! +Hotter than the sun! +Internet enabled! +Autonomous! +Engage! +Fantasy! +DRR! DRR! DRR! +Kick it root down! +Regional resources! +Woo, facepunch! +Woo, somethingawful! +Woo, /v/! +Woo, tigsource! +Woo, minecraftforum! +Woo, worldofminecraft! +Woo, reddit! +Woo, 2pp! +Google anlyticsed! +Now supports åäö! +Give us Gordon! +Tip your waiter! +Very fun! +12345 is a bad password! +Vote for net neutrality! +Lives in a pineapple under the sea! +MAP11 has two names! +Omnipotent! +Gasp! +...! +Bees, bees, bees, bees! +Jag känner en bot! +This text is hard to read if you play the game at the default resolution, but at 1080p it's fine! +Haha, LOL! +Hampsterdance! +Switches and ores! +Menger sponge! +idspispopd! +Eple (original edit)! +So fresh, so clean! +Slow acting portals! +Try the Nether! +Don't look directly at the bugs! +Oh, ok, Pigmen! +Finally with ladders! +Scary! +Play Minecraft, Watch Topgear, Get Pig! +Twittered about! +Jump up, jump up, and get down! +Joel is neat! +A riddle, wrapped in a mystery! +Huge tracts of land! +Welcome to your Doom! +Stay a while, stay forever! +Stay a while and listen! +Treatment for your rash! +"Autological" is! +Information wants to be free! +"Almost never" is an interesting concept! +Lots of truthiness! +The creeper is a spy! +Turing complete! +It's groundbreaking! +Let our battle's begin! +The sky is the limit! +Jeb has amazing hair! +Ryan also has amazing hair! +Casual gaming! +Undefeated! +Kinda like Lemmings! +Follow the train, CJ! +Leveraging synergy! +This message will never appear on the splash screen, isn't that weird? +DungeonQuest is unfair! +110813! +90210! +Check out the far lands! +Tyrion would love it! +Also try VVVVVV! +Also try Super Meat Boy! +Also try Terraria! +Also try Mount And Blade! +Also try Project Zomboid! +Also try World of Goo! +Also try Limbo! +Also try Pixeljunk Shooter! +Also try Braid! +That's super! +Bread is pain! +Read more books! +Khaaaaaaaaan! +Less addictive than TV Tropes! +More addictive than lemonade! +Bigger than a bread box! +Millions of peaches! +Fnord! +This is my true form! +Totally forgot about Dre! +Don't bother with the clones! +Pumpkinhead! +Hobo humping slobo babe! +Made by Jeb! +Has an ending! +Finally complete! +Feature packed! +Boots with the fur! +Stop, hammertime! +Testificates! +Conventional! +Homeomorphic to a 3-sphere! +Doesn't avoid double negatives! +Place ALL the blocks! +Does barrel rolls! +Meeting expectations! +PC gaming since 1873! +Ghoughpteighbteau tchoghs! +Déjà vu! +Déjà vu! +Got your nose! +Haley loves Elan! +Afraid of the big, black bat! +Doesn't use the U-word! +Child's play! +See you next Friday or so! +From the streets of Södermalm! +150 bpm for 400000 minutes! +Technologic! +Funk soul brother! +Pumpa kungen! +日本ハロー! +한국 안녕하세요! +Helo Cymru! +Cześć Polsko! +你好中国! +Привет Россия! +Γεια σου Ελλάδα! +My life for Aiur! +Lennart lennart = new Lennart(); +I see your vocabulary has improved! +Who put it there? +You can't explain that! +if not ok then return end +§1C§2o§3l§4o§5r§6m§7a§8t§9i§ac +§kFUNKY LOL +SOPA means LOSER in Swedish! +Big Pointy Teeth! +Bekarton guards the gate! +Mmmph, mmph! +Don't feed avocados to parrots! +Swords for everyone! +Plz reply to my tweet! +.party()! +Take her pillow! +Put that cookie down! +Pretty scary! +I have a suggestion. +Now with extra hugs! +Now Java 6! +Woah. +HURNERJSGER? +What's up, Doc? +Now contains 32 random daily cats! +That's Numberwang! +pls rt +Do you want to join my server? +Put a little fence around it! +Throw a blanket over it! +One day, somewhere in the future, my work will be quoted! +Now with additional stuff! +Extra things! +Yay, puppies for everyone! +So sweet, like a nice bon bon! +Popping tags! +Very influential in its circle! +Now With Multiplayer! +Rise from your grave! +Warning! A huge battleship "STEVE" is approaching fast! +Blue warrior shot the food! +Run, coward! I hunger! +Flavor with no seasoning! +Strange, but not a stranger! +Tougher than diamonds, rich like cream! +Getting ready to show! +Getting ready to know! +Getting ready to drop! +Getting ready to shock! +Getting ready to freak! +Getting ready to speak! +It swings, it jives! +Cruising streets for gold! +Take an eggbeater and beat it against a skillet! +Make me a table, a funky table! +Take the elevator to the mezzanine! +Stop being reasonable, this is the Internet! +/give @a hugs 64 +This is good for Realms. +Any computer is a laptop if you're brave enough! \ No newline at end of file