mirror of
https://github.com/TeamMidnightDust/CustomSplashScreen.git
synced 2025-12-13 06:35:09 +01:00
Port to 1.21 & Improve Performance
- Only the required textures are now loaded on startup -> Faster startup, less RAM usage - Removed Boss Bar loading bar design, as it became a huge maintenance burden - Added unifiedPublishing to streamline update deployment
This commit is contained in:
71
build.gradle
71
build.gradle
@@ -1,10 +1,11 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '0.12-SNAPSHOT'
|
id 'fabric-loom' version '1.6-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
|
id "me.shedaniel.unified-publishing" version "0.1.+"
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_17
|
sourceCompatibility = JavaVersion.VERSION_21
|
||||||
targetCompatibility = JavaVersion.VERSION_17
|
targetCompatibility = JavaVersion.VERSION_21
|
||||||
|
|
||||||
archivesBaseName = project.archives_base_name
|
archivesBaseName = project.archives_base_name
|
||||||
version = project.mod_version
|
version = project.mod_version
|
||||||
@@ -41,14 +42,7 @@ processResources {
|
|||||||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
options.encoding = "UTF-8"
|
options.encoding = "UTF-8"
|
||||||
}
|
it.options.release = 21
|
||||||
|
|
||||||
// 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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
@@ -63,9 +57,6 @@ publishing {
|
|||||||
artifact(remapJar) {
|
artifact(remapJar) {
|
||||||
builtBy remapJar
|
builtBy remapJar
|
||||||
}
|
}
|
||||||
artifact(sourcesJar) {
|
|
||||||
builtBy remapSourcesJar
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,3 +66,55 @@ publishing {
|
|||||||
// mavenLocal()
|
// 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,16 +3,19 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/use
|
# check these on https://fabricmc.net/use
|
||||||
minecraft_version=1.20
|
minecraft_version=1.21
|
||||||
yarn_mappings=1.20+build.1
|
yarn_mappings=1.21+build.2
|
||||||
loader_version=0.14.21
|
loader_version=0.15.11
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 2.1.1
|
mod_version = 2.2.0
|
||||||
maven_group = eu.midnightdust
|
maven_group = eu.midnightdust
|
||||||
archives_base_name = customsplashscreen
|
archives_base_name = customsplashscreen
|
||||||
|
release_type=release
|
||||||
|
curseforge_id=438252
|
||||||
|
modrinth_id=BwFQLeCh
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
# 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
|
fabric_version=0.100.1+1.21
|
||||||
midnightlib_version=1.4.1-fabric
|
midnightlib_version=1.5.7-fabric
|
||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,7 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
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
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
41
gradlew
vendored
41
gradlew
vendored
@@ -55,7 +55,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (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.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
@@ -80,13 +80,11 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
@@ -133,22 +131,29 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
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
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
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 ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
'' | soft) :;; #(
|
'' | 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" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
@@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
# double quotes to make sure that they get re-expanded; and
|
|
||||||
# * put everything else in single quotes, so that it's not re-expanded.
|
# 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 -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
@@ -205,6 +214,12 @@ set -- \
|
|||||||
org.gradle.wrapper.GradleWrapperMain \
|
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.
|
# Use "xargs" to parse quoted args.
|
||||||
#
|
#
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
|||||||
181
gradlew.bat
vendored
181
gradlew.bat
vendored
@@ -1,89 +1,92 @@
|
|||||||
@rem
|
@rem
|
||||||
@rem Copyright 2015 the original author or authors.
|
@rem Copyright 2015 the original author or authors.
|
||||||
@rem
|
@rem
|
||||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
@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 not use this file except in compliance with the License.
|
||||||
@rem You may obtain a copy of the License at
|
@rem You may obtain a copy of the License at
|
||||||
@rem
|
@rem
|
||||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
@rem
|
@rem
|
||||||
@rem Unless required by applicable law or agreed to in writing, software
|
@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 distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@rem
|
@rem
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
|
||||||
@rem Set local scope for the variables with windows NT shell
|
@rem Set local scope for the variables with windows NT shell
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
@rem This is normally unused
|
||||||
set APP_HOME=%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 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 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
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
set JAVA_EXE=java.exe
|
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
set JAVA_EXE=java.exe
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
%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. 1>&2
|
||||||
echo.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo. 1>&2
|
||||||
echo location of your Java installation.
|
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
|
|
||||||
|
goto fail
|
||||||
:findJavaFromJavaHome
|
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
:findJavaFromJavaHome
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
if exist "%JAVA_EXE%" goto execute
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
echo.
|
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo. 1>&2
|
||||||
echo.
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo. 1>&2
|
||||||
echo location of your Java installation.
|
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
|
|
||||||
|
goto fail
|
||||||
:execute
|
|
||||||
@rem Setup the command line
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
||||||
|
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 %*
|
@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
|
:end
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
@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
|
:fail
|
||||||
rem the _cmd.exe /c_ return code!
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
rem the _cmd.exe /c_ return code!
|
||||||
exit /b 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
:mainEnd
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:omega
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ pluginManagement {
|
|||||||
name = 'Fabric'
|
name = 'Fabric'
|
||||||
url = 'https://maven.fabricmc.net/'
|
url = 'https://maven.fabricmc.net/'
|
||||||
}
|
}
|
||||||
|
maven { url "https://maven.architectury.dev/" }
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package eu.midnightdust.customsplashscreen;
|
|||||||
|
|
||||||
import eu.midnightdust.customsplashscreen.config.CustomSplashScreenConfig;
|
import eu.midnightdust.customsplashscreen.config.CustomSplashScreenConfig;
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.*;
|
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 SquareLogoTexture = Paths.get(CONFIG_PATH + "/square_logo.png");
|
||||||
public static final Path ProgressBarTexture = Paths.get(CONFIG_PATH + "/progressbar.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 final Path ProgressBarBackgroundTexture = Paths.get(CONFIG_PATH + "/progressbar_background.png");
|
||||||
|
public static float spinningProgress;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
@@ -38,5 +41,13 @@ public class CustomSplashScreenClient implements ClientModInitializer {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,14 +43,6 @@ public class CustomSplashScreenConfig extends MidnightConfig {
|
|||||||
@Entry(category = loading)
|
@Entry(category = loading)
|
||||||
public static ProgressBarMode customProgressBarMode = ProgressBarMode.Linear;
|
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)
|
@Entry(category = loading, isSlider = true, min = 1, max = 10)
|
||||||
public static int spinningCircleSize = 2;
|
public static int spinningCircleSize = 2;
|
||||||
@Entry(category = loading, isSlider = true, min = 1, max = 10)
|
@Entry(category = loading, isSlider = true, min = 1, max = 10)
|
||||||
@@ -59,7 +51,7 @@ public class CustomSplashScreenConfig extends MidnightConfig {
|
|||||||
public static int spinningCircleTrail = 5;
|
public static int spinningCircleTrail = 5;
|
||||||
|
|
||||||
public enum ProgressBarType {
|
public enum ProgressBarType {
|
||||||
Vanilla, BossBar, Custom, SpinningCircle, Hidden;
|
Vanilla, Custom, SpinningCircle, Hidden;
|
||||||
}
|
}
|
||||||
public enum LogoStyle {
|
public enum LogoStyle {
|
||||||
Mojang, Aspect1to1, Hidden;
|
Mojang, Aspect1to1, Hidden;
|
||||||
@@ -67,10 +59,4 @@ public class CustomSplashScreenConfig extends MidnightConfig {
|
|||||||
public enum ProgressBarMode {
|
public enum ProgressBarMode {
|
||||||
Linear, Stretch, Slide;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class MixinMidnightConfig extends Screen {
|
|||||||
(Objects.requireNonNull(this.client)).setOverlay(
|
(Objects.requireNonNull(this.client)).setOverlay(
|
||||||
new SplashOverlay(client, SimpleResourceReload.create(ResourceManager.Empty.INSTANCE, List.of()
|
new SplashOverlay(client, SimpleResourceReload.create(ResourceManager.Empty.INSTANCE, List.of()
|
||||||
,Object::notify,Object::notify,new CompletableFuture<>()), throwable -> {}, true));
|
,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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package eu.midnightdust.customsplashscreen.mixin;
|
|||||||
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
import eu.midnightdust.customsplashscreen.CustomSplashScreenClient;
|
||||||
import eu.midnightdust.customsplashscreen.config.CustomSplashScreenConfig;
|
import eu.midnightdust.customsplashscreen.config.CustomSplashScreenConfig;
|
||||||
import eu.midnightdust.customsplashscreen.texture.BlurredConfigTexture;
|
import eu.midnightdust.customsplashscreen.texture.BlurredConfigTexture;
|
||||||
import eu.midnightdust.customsplashscreen.texture.ConfigTexture;
|
import eu.midnightdust.customsplashscreen.texture.ConfigTexture;
|
||||||
@@ -31,6 +32,8 @@ import java.util.Optional;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.IntSupplier;
|
import java.util.function.IntSupplier;
|
||||||
|
|
||||||
|
import static eu.midnightdust.customsplashscreen.CustomSplashScreenClient.id;
|
||||||
|
|
||||||
@Mixin(value = SplashOverlay.class, priority = 3000)
|
@Mixin(value = SplashOverlay.class, priority = 3000)
|
||||||
public abstract class MixinSplashScreen {
|
public abstract class MixinSplashScreen {
|
||||||
|
|
||||||
@@ -47,13 +50,12 @@ public abstract class MixinSplashScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Shadow @Final private static IntSupplier BRAND_ARGB;
|
@Shadow @Final private static IntSupplier BRAND_ARGB;
|
||||||
private static final Identifier EMPTY_TEXTURE = new Identifier("customsplashscreen","empty.png");
|
@Unique private static final Identifier EMPTY_TEXTURE = id("empty.png");
|
||||||
private static final Identifier MOJANG_TEXTURE = new Identifier("customsplashscreen", "wide_logo.png");
|
@Unique private static final Identifier MOJANG_TEXTURE = id("wide_logo.png");
|
||||||
private static final Identifier ASPECT_1to1_TEXTURE = new Identifier("customsplashscreen", "square_logo.png");
|
@Unique private static final Identifier ASPECT_1to1_TEXTURE = id("square_logo.png");
|
||||||
private static final Identifier BOSS_BAR_TEXTURE = new Identifier("textures/gui/bars.png");
|
@Unique private static final Identifier CUSTOM_PROGRESS_BAR_TEXTURE = id("progressbar.png");
|
||||||
private static final Identifier CUSTOM_PROGRESS_BAR_TEXTURE = new Identifier("customsplashscreen", "progressbar.png");
|
@Unique private static final Identifier CUSTOM_PROGRESS_BAR_BACKGROUND_TEXTURE = id("progressbar_background.png");
|
||||||
private static final Identifier CUSTOM_PROGRESS_BAR_BACKGROUND_TEXTURE = new Identifier("customsplashscreen", "progressbar_background.png");
|
@Unique private static final Identifier BACKGROUND_TEXTURE = id("background.png");
|
||||||
private static final Identifier BACKGROUND_TEXTURE = new Identifier("customsplashscreen", "background.png");
|
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("TAIL"))
|
@Inject(method = "<init>", at = @At("TAIL"))
|
||||||
private void css$init(MinecraftClient client, ResourceReload monitor, Consumer<Optional<Throwable>> exceptionHandler, boolean reloading, CallbackInfo ci) { // Load our custom textures on screen init //
|
private void css$init(MinecraftClient client, ResourceReload monitor, Consumer<Optional<Throwable>> 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));
|
client.getTextureManager().registerTexture(LOGO, new BlurredConfigTexture(MOJANG_TEXTURE));
|
||||||
else client.getTextureManager().registerTexture(LOGO, new EmptyTexture(EMPTY_TEXTURE));
|
else client.getTextureManager().registerTexture(LOGO, new EmptyTexture(EMPTY_TEXTURE));
|
||||||
|
|
||||||
client.getTextureManager().registerTexture(ASPECT_1to1_TEXTURE, new ConfigTexture(ASPECT_1to1_TEXTURE));
|
if (CustomSplashScreenConfig.logoStyle.equals(CustomSplashScreenConfig.LogoStyle.Aspect1to1)) {
|
||||||
client.getTextureManager().registerTexture(BACKGROUND_TEXTURE, new ConfigTexture(BACKGROUND_TEXTURE));
|
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));
|
if (CustomSplashScreenConfig.progressBarType.equals(CustomSplashScreenConfig.ProgressBarType.Custom)) {
|
||||||
client.getTextureManager().registerTexture(CUSTOM_PROGRESS_BAR_BACKGROUND_TEXTURE, new ConfigTexture(CUSTOM_PROGRESS_BAR_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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;getScaledWindowWidth()I", shift = At.Shift.BEFORE, ordinal = 2))
|
@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) {
|
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) {
|
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);
|
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
|
// Custom Progress Bar
|
||||||
if (CustomSplashScreenConfig.progressBarType == CustomSplashScreenConfig.ProgressBarType.Custom) {
|
if (CustomSplashScreenConfig.progressBarType == CustomSplashScreenConfig.ProgressBarType.Custom) {
|
||||||
int regionWidth = CustomSplashScreenConfig.customProgressBarMode == CustomSplashScreenConfig.ProgressBarMode.Stretch ? x2 - x1 : i;
|
int regionWidth = CustomSplashScreenConfig.customProgressBarMode == CustomSplashScreenConfig.ProgressBarMode.Stretch ? x2 - x1 : i;
|
||||||
@@ -156,7 +142,7 @@ public abstract class MixinSplashScreen {
|
|||||||
int size = (y2-y1)*CustomSplashScreenConfig.spinningCircleSize;
|
int size = (y2-y1)*CustomSplashScreenConfig.spinningCircleSize;
|
||||||
float f = this.reloadCompleteTime > -1L ? (float) (Util.getMeasuringTimeMs() - this.reloadCompleteTime) / 1000.0F : -1.0F;
|
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 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);
|
int color = withAlpha(MidnightColorUtil.hex2Rgb(CustomSplashScreenConfig.splashProgressBarColor).getRGB(), m);
|
||||||
for (int j = 0; j<=CustomSplashScreenConfig.spinningCircleTrail; j++) {
|
for (int j = 0; j<=CustomSplashScreenConfig.spinningCircleTrail; j++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user