diff --git a/build.gradle b/build.gradle index 4d707e1..ea6c4d3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,11 @@ plugins { - id 'fabric-loom' version '0.12-SNAPSHOT' + id 'fabric-loom' version '1.6-SNAPSHOT' id 'maven-publish' + id "me.shedaniel.unified-publishing" version "0.1.+" } -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 +sourceCompatibility = JavaVersion.VERSION_21 +targetCompatibility = JavaVersion.VERSION_21 archivesBaseName = project.archives_base_name version = project.mod_version @@ -41,14 +42,7 @@ processResources { // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html tasks.withType(JavaCompile) { options.encoding = "UTF-8" -} - -// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task -// if it is present. -// If you remove this task, sources will not be generated. -task sourcesJar(type: Jar, dependsOn: classes) { - classifier = "sources" - from sourceSets.main.allSource + it.options.release = 21 } jar { @@ -63,9 +57,6 @@ publishing { artifact(remapJar) { builtBy remapJar } - artifact(sourcesJar) { - builtBy remapSourcesJar - } } } @@ -75,3 +66,55 @@ publishing { // mavenLocal() } } + +ext { + releaseChangelog = { + def changes = new StringBuilder() + changes << "## Custom Splash Screen v$project.version for $project.minecraft_version\n[View the changelog](https://www.github.com/TeamMidnightDust/CustomSplashScreen/commits/)" + def proc = "git log --max-count=1 --pretty=format:%s".execute() + proc.in.eachLine { line -> + def processedLine = line.toString() + if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) { + changes << "\n- ${processedLine.capitalize()}" + } + } + proc.waitFor() + return changes.toString() + } +} + +unifiedPublishing { + project { + displayName = "CustomSplashScreen v$project.version - Fabric $project.minecraft_version" + releaseType = "$project.release_type" + changelog = releaseChangelog() + gameVersions = [] + gameLoaders = ["fabric","quilt"] + mainPublication remapJar + relations { + includes { + curseforge = "midnightlib" + modrinth = "midnightlib" + } + } + + var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN") + if (CURSEFORGE_TOKEN != null) { + curseforge { + token = CURSEFORGE_TOKEN + id = rootProject.curseforge_id + gameVersions.addAll "Java 21", project.minecraft_version + } + } + + var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN") + if (MODRINTH_TOKEN != null) { + modrinth { + token = MODRINTH_TOKEN + id = rootProject.modrinth_id + version = "$project.version" + gameVersions.addAll project.minecraft_version + } + } + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 93e710e..1543ac7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,16 +3,19 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use - minecraft_version=1.20 - yarn_mappings=1.20+build.1 - loader_version=0.14.21 + minecraft_version=1.21 + yarn_mappings=1.21+build.2 + loader_version=0.15.11 # Mod Properties - mod_version = 2.1.1 + mod_version = 2.2.0 maven_group = eu.midnightdust archives_base_name = customsplashscreen + release_type=release + curseforge_id=438252 + modrinth_id=BwFQLeCh # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api - fabric_version=0.83.0+1.20 - midnightlib_version=1.4.1-fabric \ No newline at end of file + fabric_version=0.100.1+1.21 + midnightlib_version=1.5.7-fabric \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..e644113 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 84d1f85..a441313 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787..b740cf1 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/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/. @@ -80,13 +80,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# 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 # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +131,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +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, +# 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" \ @@ -205,6 +214,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd3..7101f8e 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,89 +1,92 @@ -@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=. -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%" == "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%"=="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! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -: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 + +@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 + +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 diff --git a/settings.gradle b/settings.gradle index 5b60df3..0de6ae7 100644 --- a/settings.gradle +++ b/settings.gradle @@ -5,6 +5,7 @@ pluginManagement { name = 'Fabric' url = 'https://maven.fabricmc.net/' } + maven { url "https://maven.architectury.dev/" } gradlePluginPortal() } } diff --git a/src/main/java/eu/midnightdust/customsplashscreen/CustomSplashScreenClient.java b/src/main/java/eu/midnightdust/customsplashscreen/CustomSplashScreenClient.java index 2b49eeb..90cf886 100644 --- a/src/main/java/eu/midnightdust/customsplashscreen/CustomSplashScreenClient.java +++ b/src/main/java/eu/midnightdust/customsplashscreen/CustomSplashScreenClient.java @@ -2,7 +2,9 @@ package eu.midnightdust.customsplashscreen; import eu.midnightdust.customsplashscreen.config.CustomSplashScreenConfig; import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.util.Identifier; import java.io.*; import java.nio.file.*; @@ -14,6 +16,7 @@ public class CustomSplashScreenClient implements ClientModInitializer { public static final Path SquareLogoTexture = Paths.get(CONFIG_PATH + "/square_logo.png"); public static final Path ProgressBarTexture = Paths.get(CONFIG_PATH + "/progressbar.png"); public static final Path ProgressBarBackgroundTexture = Paths.get(CONFIG_PATH + "/progressbar_background.png"); + public static float spinningProgress; @Override public void onInitializeClient() { @@ -38,5 +41,13 @@ public class CustomSplashScreenClient implements ClientModInitializer { } catch (Exception e) { e.printStackTrace(); } + ClientTickEvents.END_CLIENT_TICK.register((client -> { + if (spinningProgress > 1) spinningProgress = 0f; + spinningProgress = spinningProgress + 0.01f; + })); + } + + public static Identifier id(String path) { + return Identifier.of("customsplashscreen", path); } } diff --git a/src/main/java/eu/midnightdust/customsplashscreen/config/CustomSplashScreenConfig.java b/src/main/java/eu/midnightdust/customsplashscreen/config/CustomSplashScreenConfig.java index 71eb6d2..a0a4da9 100644 --- a/src/main/java/eu/midnightdust/customsplashscreen/config/CustomSplashScreenConfig.java +++ b/src/main/java/eu/midnightdust/customsplashscreen/config/CustomSplashScreenConfig.java @@ -43,14 +43,6 @@ public class CustomSplashScreenConfig extends MidnightConfig { @Entry(category = loading) public static ProgressBarMode customProgressBarMode = ProgressBarMode.Linear; - //"Change the color of the boss loading bar") - @Entry(category = loading) - public static BossBarColor bossBarColor = BossBarColor.MAGENTA; - //"Change the style of the boss loading bar") - @Entry(category = loading) - public static BossBarType bossBarType = BossBarType.NOTCHED_6; - @Entry(category = loading, isSlider = true, min = 15, max = 100) - public static int bossBarSize = 85; @Entry(category = loading, isSlider = true, min = 1, max = 10) public static int spinningCircleSize = 2; @Entry(category = loading, isSlider = true, min = 1, max = 10) @@ -59,7 +51,7 @@ public class CustomSplashScreenConfig extends MidnightConfig { public static int spinningCircleTrail = 5; public enum ProgressBarType { - Vanilla, BossBar, Custom, SpinningCircle, Hidden; + Vanilla, Custom, SpinningCircle, Hidden; } public enum LogoStyle { Mojang, Aspect1to1, Hidden; @@ -67,10 +59,4 @@ public class CustomSplashScreenConfig extends MidnightConfig { public enum ProgressBarMode { Linear, Stretch, Slide; } - public enum BossBarColor { - MAGENTA, CYAN, RED, LIME, YELLOW, PURPLE, WHITE; - } - public enum BossBarType { - PROGRESS, NOTCHED_6, NOTCHED_10, NOTCHED_12, NOTCHED_20; - } } diff --git a/src/main/java/eu/midnightdust/customsplashscreen/mixin/MixinMidnightConfig.java b/src/main/java/eu/midnightdust/customsplashscreen/mixin/MixinMidnightConfig.java index b743309..4095124 100644 --- a/src/main/java/eu/midnightdust/customsplashscreen/mixin/MixinMidnightConfig.java +++ b/src/main/java/eu/midnightdust/customsplashscreen/mixin/MixinMidnightConfig.java @@ -35,7 +35,7 @@ public class MixinMidnightConfig extends Screen { (Objects.requireNonNull(this.client)).setOverlay( new SplashOverlay(client, SimpleResourceReload.create(ResourceManager.Empty.INSTANCE, List.of() ,Object::notify,Object::notify,new CompletableFuture<>()), throwable -> {}, true)); - }).dimensions(this.width / 2 + 157, this.height - 28, 50, 20).build()); + }).dimensions(this.width / 2 + 157, this.height - 26, 50, 20).build()); } } } diff --git a/src/main/java/eu/midnightdust/customsplashscreen/mixin/MixinSplashScreen.java b/src/main/java/eu/midnightdust/customsplashscreen/mixin/MixinSplashScreen.java index fda5402..cd66267 100644 --- a/src/main/java/eu/midnightdust/customsplashscreen/mixin/MixinSplashScreen.java +++ b/src/main/java/eu/midnightdust/customsplashscreen/mixin/MixinSplashScreen.java @@ -2,6 +2,7 @@ package eu.midnightdust.customsplashscreen.mixin; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; +import eu.midnightdust.customsplashscreen.CustomSplashScreenClient; import eu.midnightdust.customsplashscreen.config.CustomSplashScreenConfig; import eu.midnightdust.customsplashscreen.texture.BlurredConfigTexture; import eu.midnightdust.customsplashscreen.texture.ConfigTexture; @@ -31,6 +32,8 @@ import java.util.Optional; import java.util.function.Consumer; import java.util.function.IntSupplier; +import static eu.midnightdust.customsplashscreen.CustomSplashScreenClient.id; + @Mixin(value = SplashOverlay.class, priority = 3000) public abstract class MixinSplashScreen { @@ -47,13 +50,12 @@ public abstract class MixinSplashScreen { } @Shadow @Final private static IntSupplier BRAND_ARGB; - private static final Identifier EMPTY_TEXTURE = new Identifier("customsplashscreen","empty.png"); - private static final Identifier MOJANG_TEXTURE = new Identifier("customsplashscreen", "wide_logo.png"); - private static final Identifier ASPECT_1to1_TEXTURE = new Identifier("customsplashscreen", "square_logo.png"); - private static final Identifier BOSS_BAR_TEXTURE = new Identifier("textures/gui/bars.png"); - private static final Identifier CUSTOM_PROGRESS_BAR_TEXTURE = new Identifier("customsplashscreen", "progressbar.png"); - private static final Identifier CUSTOM_PROGRESS_BAR_BACKGROUND_TEXTURE = new Identifier("customsplashscreen", "progressbar_background.png"); - private static final Identifier BACKGROUND_TEXTURE = new Identifier("customsplashscreen", "background.png"); + @Unique private static final Identifier EMPTY_TEXTURE = id("empty.png"); + @Unique private static final Identifier MOJANG_TEXTURE = id("wide_logo.png"); + @Unique private static final Identifier ASPECT_1to1_TEXTURE = id("square_logo.png"); + @Unique private static final Identifier CUSTOM_PROGRESS_BAR_TEXTURE = id("progressbar.png"); + @Unique private static final Identifier CUSTOM_PROGRESS_BAR_BACKGROUND_TEXTURE = id("progressbar_background.png"); + @Unique private static final Identifier BACKGROUND_TEXTURE = id("background.png"); @Inject(method = "", at = @At("TAIL")) private void css$init(MinecraftClient client, ResourceReload monitor, Consumer> exceptionHandler, boolean reloading, CallbackInfo ci) { // Load our custom textures on screen init // @@ -61,11 +63,15 @@ public abstract class MixinSplashScreen { client.getTextureManager().registerTexture(LOGO, new BlurredConfigTexture(MOJANG_TEXTURE)); else client.getTextureManager().registerTexture(LOGO, new EmptyTexture(EMPTY_TEXTURE)); - client.getTextureManager().registerTexture(ASPECT_1to1_TEXTURE, new ConfigTexture(ASPECT_1to1_TEXTURE)); - client.getTextureManager().registerTexture(BACKGROUND_TEXTURE, new ConfigTexture(BACKGROUND_TEXTURE)); + if (CustomSplashScreenConfig.logoStyle.equals(CustomSplashScreenConfig.LogoStyle.Aspect1to1)) { + client.getTextureManager().registerTexture(ASPECT_1to1_TEXTURE, new ConfigTexture(ASPECT_1to1_TEXTURE)); + } + if (CustomSplashScreenConfig.backgroundImage) client.getTextureManager().registerTexture(BACKGROUND_TEXTURE, new ConfigTexture(BACKGROUND_TEXTURE)); - client.getTextureManager().registerTexture(CUSTOM_PROGRESS_BAR_TEXTURE, new ConfigTexture(CUSTOM_PROGRESS_BAR_TEXTURE)); - client.getTextureManager().registerTexture(CUSTOM_PROGRESS_BAR_BACKGROUND_TEXTURE, new ConfigTexture(CUSTOM_PROGRESS_BAR_BACKGROUND_TEXTURE)); + if (CustomSplashScreenConfig.progressBarType.equals(CustomSplashScreenConfig.ProgressBarType.Custom)) { + client.getTextureManager().registerTexture(CUSTOM_PROGRESS_BAR_TEXTURE, new ConfigTexture(CUSTOM_PROGRESS_BAR_TEXTURE)); + client.getTextureManager().registerTexture(CUSTOM_PROGRESS_BAR_BACKGROUND_TEXTURE, new ConfigTexture(CUSTOM_PROGRESS_BAR_BACKGROUND_TEXTURE)); + } } @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;getScaledWindowWidth()I", shift = At.Shift.BEFORE, ordinal = 2)) private void css$renderSplashBackground(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { @@ -117,26 +123,6 @@ public abstract class MixinSplashScreen { private void css$renderProgressBar(DrawContext context, int x1, int y1, int x2, int y2, float opacity, CallbackInfo ci) { int i = MathHelper.ceil((float)(x2 - x1 - 2) * this.progress); - // Bossbar Progress Bar - if (CustomSplashScreenConfig.progressBarType == CustomSplashScreenConfig.ProgressBarType.BossBar) { - int color = CustomSplashScreenConfig.bossBarColor.ordinal() * 10; - RenderSystem.setShader(GameRenderer::getPositionTexProgram); - - int overlay = 70 + CustomSplashScreenConfig.bossBarType.ordinal()*10; - int width = (int) ((x2 - x1) * (CustomSplashScreenConfig.bossBarSize * 0.01f)); - int offset = ((x2 - x1) - width) / 2; - i = MathHelper.ceil((float)(width - 2) * this.progress); - - context.drawTexture(BOSS_BAR_TEXTURE, x1 + offset, y1 + 1, width, (int) ((width / 182f) * 5), 0, color, 182, 5,256, 256); - context.drawTexture(BOSS_BAR_TEXTURE, x1 + offset, y1 + 1, i, (int) ((width / 182f) * 5), 0, color+5, (int) (180 * this.progress), 5, 256, 256); - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); - if (overlay != 120) { - context.drawTexture(BOSS_BAR_TEXTURE, x1 + offset, y1 + 1, width, (int) ((width / 182f) * 5), 0, overlay, 182, 5,256, 256); - } - RenderSystem.disableBlend(); - } - // Custom Progress Bar if (CustomSplashScreenConfig.progressBarType == CustomSplashScreenConfig.ProgressBarType.Custom) { int regionWidth = CustomSplashScreenConfig.customProgressBarMode == CustomSplashScreenConfig.ProgressBarMode.Stretch ? x2 - x1 : i; @@ -156,7 +142,7 @@ public abstract class MixinSplashScreen { int size = (y2-y1)*CustomSplashScreenConfig.spinningCircleSize; float f = this.reloadCompleteTime > -1L ? (float) (Util.getMeasuringTimeMs() - this.reloadCompleteTime) / 1000.0F : -1.0F; int m = MathHelper.ceil((1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F)) * 255.0F); - int time = (((int) (MidnightColorUtil.hue * 24 * CustomSplashScreenConfig.spinningCircleSpeed))%24)-1; + int time = (((int) (CustomSplashScreenClient.spinningProgress * 24 * CustomSplashScreenConfig.spinningCircleSpeed))%24)-1; int color = withAlpha(MidnightColorUtil.hex2Rgb(CustomSplashScreenConfig.splashProgressBarColor).getRGB(), m); for (int j = 0; j<=CustomSplashScreenConfig.spinningCircleTrail; j++) {