mirror of
https://github.com/TeamMidnightDust/CustomSplashScreen.git
synced 2025-12-16 15:55:09 +01:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
644da0493d | ||
|
|
7a900716a8 | ||
|
|
9181ed02ee | ||
|
|
ce8f659929 | ||
|
|
84042deb0d | ||
|
|
45501668c1 | ||
|
|
7b236188f6 | ||
|
|
2137a1dbe4 | ||
|
|
dcfbe1a41a | ||
|
|
48a69ed950 | ||
|
|
e9f49fbf01 | ||
|
|
3640561cb6 | ||
|
|
1b03cbf07f | ||
|
|
c0796d82aa | ||
|
|
c22877c817 |
@@ -1,2 +1,11 @@
|
|||||||
# CustomSplashScreen
|
# CustomSplashScreen
|
||||||
Change minecraft's loading screen to your liking! Completely configurable!
|
Change minecraft's loading screen to your liking! Completely configurable!
|
||||||
|
Allows you to completely change the minecraft splash screen.
|
||||||
|
Provides many config options so you can customize the loading screen to your liking.
|
||||||
|
Just look at the examples below:
|
||||||
|
<img src="https://i.ibb.co/JBpn7RX/customsplashscreen-banner.png" width="768" height="132" /></p>
|
||||||
|
<img src="https://i.ibb.co/dGGf4K8/Screenshot-2021-01-20-202835.png" width="655" height="368" /></p>
|
||||||
|
|
||||||
|
<img src="https://i.ibb.co/TkHt05n/Screenshot-2021-01-20-201930.png" width="655" height="368" /></p>
|
||||||
|
|
||||||
|
<img src="https://i.ibb.co/DWjZjd7/Screenshot-2021-01-20-201737.png" width="655" height="368" /></p>
|
||||||
|
|||||||
100
build.gradle
100
build.gradle
@@ -1,52 +1,40 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '0.5-SNAPSHOT'
|
id 'fabric-loom' version '1.7-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
|
id "me.shedaniel.unified-publishing" version "0.1.+"
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_21
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_21
|
||||||
|
|
||||||
archivesBaseName = project.archives_base_name
|
archivesBaseName = project.archives_base_name
|
||||||
version = project.mod_version
|
version = project.mod_version
|
||||||
group = project.maven_group
|
group = project.maven_group
|
||||||
|
|
||||||
minecraft {
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "https://jitpack.io" }
|
maven { url = "https://api.modrinth.com/maven" }
|
||||||
|
}
|
||||||
|
loom {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
//to change the versions see the gradle.properties file
|
//to change the versions see the gradle.properties file
|
||||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||||
modCompile "net.fabricmc:fabric-loader:${project.loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
|
|
||||||
modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
|
|
||||||
modImplementation ("me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}"){
|
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
|
||||||
exclude module: "fabric-api"
|
include "maven.modrinth:midnightlib:${project.midnightlib_version}"
|
||||||
}
|
|
||||||
modImplementation ("me.shedaniel.cloth:config-2:${project.cloth_config_version}"){
|
|
||||||
exclude module: "fabric-api"
|
|
||||||
}
|
|
||||||
modImplementation ("io.github.prospector:modmenu:${project.mod_menu_version}"){
|
|
||||||
exclude module: "fabric-api"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
inputs.property "version", project.version
|
inputs.property "version", project.version
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
filesMatching("fabric.mod.json") {
|
||||||
include "fabric.mod.json"
|
|
||||||
expand "version": project.version
|
expand "version": project.version
|
||||||
}
|
}
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
exclude "fabric.mod.json"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
||||||
@@ -54,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 {
|
||||||
@@ -76,9 +57,6 @@ publishing {
|
|||||||
artifact(remapJar) {
|
artifact(remapJar) {
|
||||||
builtBy remapJar
|
builtBy remapJar
|
||||||
}
|
}
|
||||||
artifact(sourcesJar) {
|
|
||||||
builtBy remapSourcesJar
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,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,19 +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.16.4
|
minecraft_version=1.21.3
|
||||||
yarn_mappings=1.16.4+build.7
|
yarn_mappings=1.21.3+build.2
|
||||||
loader_version=0.10.8
|
loader_version=0.16.9
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0.0
|
mod_version = 2.3.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.26.1+1.16
|
fabric_version=0.107.0+1.21.3
|
||||||
|
midnightlib_version=1.6.4-fabric
|
||||||
auto_config_version = 3.3.1
|
|
||||||
cloth_config_version = 4.8.3
|
|
||||||
mod_menu_version = 1.14.6+build.31
|
|
||||||
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-5.5.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
|
||||||
|
|||||||
295
gradlew
vendored
Normal file → Executable file
295
gradlew
vendored
Normal file → Executable file
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright 2015 the original author or authors.
|
# Copyright © 2015-2021 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -17,78 +17,111 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
#
|
||||||
## Gradle start up script for UN*X
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
##
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# 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/.
|
||||||
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
app_path=$0
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
# Need this for daisy-chained symlinks.
|
||||||
ls=`ls -ld "$PRG"`
|
while
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
[ -h "$app_path" ]
|
||||||
PRG="$link"
|
do
|
||||||
else
|
ls=$( ls -ld "$app_path" )
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
link=${ls#*' -> '}
|
||||||
fi
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >/dev/null
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
# This is normally unused
|
||||||
APP_BASE_NAME=`basename "$0"`
|
# 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.
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
warn () {
|
warn () {
|
||||||
echo "$*"
|
echo "$*"
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
die () {
|
die () {
|
||||||
echo
|
echo
|
||||||
echo "$*"
|
echo "$*"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
}
|
} >&2
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
# OS specific support (must be 'true' or 'false').
|
||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
nonstop=false
|
nonstop=false
|
||||||
case "`uname`" in
|
case "$( uname )" in #(
|
||||||
CYGWIN* )
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
cygwin=true
|
Darwin* ) darwin=true ;; #(
|
||||||
;;
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
Darwin* )
|
NONSTOP* ) nonstop=true ;;
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
NONSTOP* )
|
|
||||||
nonstop=true
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
else
|
else
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
fi
|
fi
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
@@ -97,92 +130,120 @@ Please set the JAVA_HOME variable in your environment to match the
|
|||||||
location of your Java installation."
|
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" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
case $MAX_FD in #(
|
||||||
if [ $? -eq 0 ] ; then
|
max*)
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
MAX_FD="$MAX_FD_LIMIT"
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
ulimit -n $MAX_FD
|
warn "Could not query maximum file descriptor limit"
|
||||||
if [ $? -ne 0 ] ; then
|
esac
|
||||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
case $MAX_FD in #(
|
||||||
fi
|
'' | soft) :;; #(
|
||||||
else
|
*)
|
||||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
fi
|
# shellcheck disable=SC2039,SC3045
|
||||||
fi
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
# For Darwin, add options to specify how the application appears in the dock
|
|
||||||
if $darwin; then
|
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
|
||||||
if $cygwin ; then
|
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
|
||||||
SEP=""
|
|
||||||
for dir in $ROOTDIRSRAW ; do
|
|
||||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
|
||||||
SEP="|"
|
|
||||||
done
|
|
||||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
|
||||||
# Add a user-defined pattern to the cygpath arguments
|
|
||||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
|
||||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
|
||||||
fi
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
i=0
|
|
||||||
for arg in "$@" ; do
|
|
||||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
|
||||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
|
||||||
|
|
||||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
|
||||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
|
||||||
else
|
|
||||||
eval `echo args$i`="\"$arg\""
|
|
||||||
fi
|
|
||||||
i=$((i+1))
|
|
||||||
done
|
|
||||||
case $i in
|
|
||||||
(0) set -- ;;
|
|
||||||
(1) set -- "$args0" ;;
|
|
||||||
(2) set -- "$args0" "$args1" ;;
|
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Escape application args
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
save () {
|
# * args from the command line
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
# * the main class name
|
||||||
echo " "
|
# * -classpath
|
||||||
}
|
# * -D...appname settings
|
||||||
APP_ARGS=$(save "$@")
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# 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" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
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.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|||||||
54
gradlew.bat
vendored
54
gradlew.bat
vendored
@@ -26,9 +26,13 @@ if "%OS%"=="Windows_NT" setlocal
|
|||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%"=="" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
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.
|
@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"
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@@ -37,13 +41,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
@@ -51,48 +55,36 @@ goto fail
|
|||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
|
||||||
@rem Get command-line arguments, handling Windows variants
|
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
||||||
|
|
||||||
:win9xME_args
|
|
||||||
@rem Slurp the command line arguments.
|
|
||||||
set CMD_LINE_ARGS=
|
|
||||||
set _SKIP=2
|
|
||||||
|
|
||||||
:win9xME_args_slurp
|
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@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
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|||||||
@@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,55 +1,53 @@
|
|||||||
package eu.midnightdust.customsplashscreen;
|
package eu.midnightdust.customsplashscreen;
|
||||||
|
|
||||||
import eu.midnightdust.customsplashscreen.config.CustomSplashScreenConfig;
|
import eu.midnightdust.customsplashscreen.config.CustomSplashScreenConfig;
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.serializer.JanksonConfigSerializer;
|
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderingRegistry;
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||||
import net.fabricmc.fabric.impl.client.indigo.renderer.helper.TextureHelper;
|
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.client.texture.TextureManager;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.client.texture.TextureUtil;
|
|
||||||
import net.minecraft.data.client.model.Texture;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.*;
|
import java.nio.file.*;
|
||||||
import java.util.logging.FileHandler;
|
|
||||||
|
|
||||||
public class CustomSplashScreenClient implements ClientModInitializer {
|
public class CustomSplashScreenClient implements ClientModInitializer {
|
||||||
|
|
||||||
public static CustomSplashScreenConfig CS_CONFIG;
|
|
||||||
public static File CONFIG_PATH = new File(FabricLoader.getInstance().getConfigDir() + "/customsplashscreen");
|
public static File CONFIG_PATH = new File(FabricLoader.getInstance().getConfigDir() + "/customsplashscreen");
|
||||||
private static Path BackgroundTexture = Paths.get(CONFIG_PATH + "/background.png");
|
public static final Path BackgroundTexture = Paths.get(CONFIG_PATH + "/background.png");
|
||||||
private static Path MojangTexture = Paths.get(CONFIG_PATH + "/mojangstudios.png");
|
public static final Path WideLogoTexture = Paths.get(CONFIG_PATH + "/wide_logo.png");
|
||||||
private static Path MojankTexture = Paths.get(CONFIG_PATH + "/mojank.png");
|
public static final Path SquareLogoTexture = Paths.get(CONFIG_PATH + "/square_logo.png");
|
||||||
private static Path ProgressBarTexture = Paths.get(CONFIG_PATH + "/progressbar.png");
|
public static final Path ProgressBarTexture = Paths.get(CONFIG_PATH + "/progressbar.png");
|
||||||
private static 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() {
|
||||||
AutoConfig.register(CustomSplashScreenConfig.class, JanksonConfigSerializer::new);
|
CustomSplashScreenConfig.init("customsplashscreen", CustomSplashScreenConfig.class);
|
||||||
CS_CONFIG = AutoConfig.getConfigHolder(CustomSplashScreenConfig.class).getConfig();
|
|
||||||
|
|
||||||
if (!CONFIG_PATH.exists()) { // Run when config directory is nonexistant //
|
if (!CONFIG_PATH.exists()) { // Run when config directory is nonexistant //
|
||||||
CONFIG_PATH.mkdir(); // Create our custom config directory //
|
CONFIG_PATH.mkdir(); // Create our custom config directory //
|
||||||
|
}
|
||||||
// Open Input Streams for copying the default textures to the config directory //
|
// Open Input Streams for copying the default textures to the config directory //
|
||||||
InputStream background = Thread.currentThread().getContextClassLoader().getResourceAsStream("background.png");
|
InputStream background = Thread.currentThread().getContextClassLoader().getResourceAsStream("background.png");
|
||||||
InputStream mojangstudios = Thread.currentThread().getContextClassLoader().getResourceAsStream("mojangstudios.png");
|
InputStream wide = Thread.currentThread().getContextClassLoader().getResourceAsStream("wide_logo.png");
|
||||||
InputStream mojank = Thread.currentThread().getContextClassLoader().getResourceAsStream("mojank.png");
|
InputStream square = Thread.currentThread().getContextClassLoader().getResourceAsStream("square_logo.png");
|
||||||
InputStream progressbar = Thread.currentThread().getContextClassLoader().getResourceAsStream("progressbar.png");
|
InputStream progressbar = Thread.currentThread().getContextClassLoader().getResourceAsStream("progressbar.png");
|
||||||
InputStream progressbarBG = Thread.currentThread().getContextClassLoader().getResourceAsStream("progressbar_background.png");
|
InputStream progressbarBG = Thread.currentThread().getContextClassLoader().getResourceAsStream("progressbar_background.png");
|
||||||
try {
|
try {
|
||||||
// Copy the default textures into the config directory //
|
// Copy the default textures into the config directory //
|
||||||
Files.copy(background,BackgroundTexture,StandardCopyOption.REPLACE_EXISTING);
|
if (!BackgroundTexture.toFile().exists()) Files.copy(background,BackgroundTexture,StandardCopyOption.REPLACE_EXISTING);
|
||||||
Files.copy(mojangstudios,MojangTexture,StandardCopyOption.REPLACE_EXISTING);
|
if (!WideLogoTexture.toFile().exists()) Files.copy(wide,WideLogoTexture,StandardCopyOption.REPLACE_EXISTING);
|
||||||
Files.copy(mojank,MojankTexture,StandardCopyOption.REPLACE_EXISTING);
|
if (!SquareLogoTexture.toFile().exists()) Files.copy(square,SquareLogoTexture,StandardCopyOption.REPLACE_EXISTING);
|
||||||
Files.copy(progressbar,ProgressBarTexture,StandardCopyOption.REPLACE_EXISTING);
|
if (!ProgressBarTexture.toFile().exists()) Files.copy(progressbar,ProgressBarTexture,StandardCopyOption.REPLACE_EXISTING);
|
||||||
Files.copy(progressbarBG,ProgressBarBackgroundTexture,StandardCopyOption.REPLACE_EXISTING);
|
if (!ProgressBarBackgroundTexture.toFile().exists()) Files.copy(progressbarBG,ProgressBarBackgroundTexture,StandardCopyOption.REPLACE_EXISTING);
|
||||||
} catch (IOException 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,68 +1,62 @@
|
|||||||
package eu.midnightdust.customsplashscreen.config;
|
package eu.midnightdust.customsplashscreen.config;
|
||||||
|
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
|
import eu.midnightdust.lib.config.MidnightConfig;
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.annotation.Config;
|
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.annotation.ConfigEntry;
|
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.shadowed.blue.endless.jankson.Comment;
|
|
||||||
|
|
||||||
@Config(name = "customsplashscreen")
|
public class CustomSplashScreenConfig extends MidnightConfig {
|
||||||
public class CustomSplashScreenConfig implements ConfigData {
|
public static final String general = "general";
|
||||||
|
public static final String loading = "loading_indicator";
|
||||||
|
public static final String colors = "colors";
|
||||||
|
|
||||||
@Comment(value = "Change the design of the progress bar")
|
//"Change the design of the progress bar")
|
||||||
@ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
|
@Entry(category = loading)
|
||||||
public ProgressBarType progressBarType = ProgressBarType.Vanilla;
|
public static ProgressBarType progressBarType = ProgressBarType.Vanilla;
|
||||||
|
|
||||||
@Comment(value = "Change the texture of the logo")
|
//"Change the texture of the logo")
|
||||||
@ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
|
@Entry(category = general)
|
||||||
public LogoStyle logoStyle = LogoStyle.Mojang;
|
public static LogoStyle logoStyle = LogoStyle.Mojang;
|
||||||
|
|
||||||
@Comment(value = "Enable/Disable the background image")
|
//"Enable/Disable the background image")
|
||||||
public boolean backgroundImage = false;
|
@Entry(category = general)
|
||||||
|
public static boolean backgroundImage = false;
|
||||||
|
|
||||||
@Comment(value = "Change the color of the background")
|
//"Enable/Disable logo blend")
|
||||||
@ConfigEntry.ColorPicker
|
@Entry(category = general)
|
||||||
public int backgroundColor = 15675965;
|
public static boolean logoBlend = true;
|
||||||
@Comment(value = "Change the color of the progress bar")
|
|
||||||
@ConfigEntry.ColorPicker
|
|
||||||
public int progressBarColor = 16777215;
|
|
||||||
@Comment(value = "Change the color of the progress bar frame")
|
|
||||||
@ConfigEntry.ColorPicker
|
|
||||||
public int progressFrameColor = 16777215;
|
|
||||||
|
|
||||||
@Comment(value = "Change the mode of the custom loading bar")
|
//"Change the color of the background")
|
||||||
@ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
|
@Entry(category = colors, isColor = true)
|
||||||
public ProgressBarMode customProgressBarMode = ProgressBarMode.Linear;
|
public static String splashBackgroundColor = "#EF323D";
|
||||||
|
//"Change the color of the progress bar")
|
||||||
|
@Entry(category = colors, isColor = true)
|
||||||
|
public static String splashProgressBarColor = "#FFFFFF";
|
||||||
|
//"Change the color of the progress bar frame")
|
||||||
|
@Entry(category = colors, isColor = true)
|
||||||
|
public static String splashProgressFrameColor = "#FFFFFF";
|
||||||
|
@Entry(category = colors, isColor = true)
|
||||||
|
public static String splashProgressBackgroundColor = "#000000";
|
||||||
|
|
||||||
@Comment(value = "Enable/Disable the custom progress bar background")
|
//"Enable/Disable the progress bar background")
|
||||||
public boolean customProgressBarBackground = false;
|
@Entry(category = loading)
|
||||||
|
public static boolean progressBarBackground = false;
|
||||||
|
|
||||||
@Comment(value = "Change the style of the boss loading bar")
|
//"Change the mode of the custom loading bar")
|
||||||
@ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
|
@Entry(category = loading)
|
||||||
public BossBarType bossBarType = BossBarType.NOTCHED_6;
|
public static ProgressBarMode customProgressBarMode = ProgressBarMode.Linear;
|
||||||
|
|
||||||
|
@Entry(category = loading, isSlider = true, min = 1, max = 10)
|
||||||
@ConfigEntry.Gui.CollapsibleObject
|
public static int spinningCircleSize = 2;
|
||||||
public Textures textures = new Textures();
|
@Entry(category = loading, isSlider = true, min = 1, max = 10)
|
||||||
|
public static int spinningCircleSpeed = 4;
|
||||||
public static class Textures {
|
@Entry(category = loading, isSlider = true, min = 0, max = 23)
|
||||||
public String BackgroundTexture = "background.png";
|
public static int spinningCircleTrail = 5;
|
||||||
public String MojangLogo = "mojangstudios.png";
|
|
||||||
public String Aspect1to1Logo = "mojank.png";
|
|
||||||
public String BossBarTexture = "textures/gui/bars.png";
|
|
||||||
public String CustomBarTexture = "progressbar.png";
|
|
||||||
public String CustomBarBackgroundTexture = "progressbar_background.png";
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ProgressBarType {
|
public enum ProgressBarType {
|
||||||
Vanilla, BossBar, Custom, Hidden;
|
Vanilla, Custom, SpinningCircle, Hidden;
|
||||||
}
|
}
|
||||||
public enum LogoStyle {
|
public enum LogoStyle {
|
||||||
Mojang, Aspect1to1, Hidden;
|
Mojang, Aspect1to1, Hidden;
|
||||||
}
|
}
|
||||||
public enum ProgressBarMode {
|
public enum ProgressBarMode {
|
||||||
Linear, Stretch;
|
Linear, Stretch, Slide;
|
||||||
}
|
|
||||||
public enum BossBarType {
|
|
||||||
PROGRESS, NOTCHED_6, NOTCHED_10, NOTCHED_12, NOTCHED_20;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package eu.midnightdust.customsplashscreen.config;
|
|
||||||
|
|
||||||
import io.github.prospector.modmenu.api.ConfigScreenFactory;
|
|
||||||
import io.github.prospector.modmenu.api.ModMenuApi;
|
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
|
||||||
import net.fabricmc.api.EnvType;
|
|
||||||
import net.fabricmc.api.Environment;
|
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
|
||||||
public class ModMenuIntegration implements ModMenuApi {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ConfigScreenFactory<?> getModConfigScreenFactory() { // Provide our Config Screen to Mod Menu //
|
|
||||||
return parent -> AutoConfig.getConfigScreen(CustomSplashScreenConfig.class, parent).get();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package eu.midnightdust.customsplashscreen.mixin;
|
||||||
|
|
||||||
|
import eu.midnightdust.lib.config.MidnightConfig;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.client.gui.screen.SplashOverlay;
|
||||||
|
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||||
|
import net.minecraft.resource.ResourceManager;
|
||||||
|
import net.minecraft.resource.SimpleResourceReload;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
@Mixin(value = MidnightConfig.MidnightConfigScreen.class)
|
||||||
|
public class MixinMidnightConfig extends Screen {
|
||||||
|
@Shadow(remap = false) @Final
|
||||||
|
public String modid;
|
||||||
|
|
||||||
|
protected MixinMidnightConfig(Text title) {
|
||||||
|
super(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(at = @At("HEAD"), method = "init")
|
||||||
|
protected void init(CallbackInfo ci) {
|
||||||
|
if(this.modid.equals("customsplashscreen")) {
|
||||||
|
this.addDrawableChild(ButtonWidget.builder(Text.literal("Preview"), (button) -> {
|
||||||
|
MidnightConfig.write("customsplashscreen");
|
||||||
|
(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 - 26, 50, 20).build());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,233 @@
|
|||||||
|
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;
|
||||||
|
import eu.midnightdust.customsplashscreen.texture.EmptyTexture;
|
||||||
|
import eu.midnightdust.lib.config.MidnightConfig;
|
||||||
|
import eu.midnightdust.lib.util.MidnightColorUtil;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gl.ShaderProgram;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.gui.screen.SplashOverlay;
|
||||||
|
import net.minecraft.client.render.GameRenderer;
|
||||||
|
import net.minecraft.client.render.RenderLayer;
|
||||||
|
import net.minecraft.client.render.RenderPhase;
|
||||||
|
import net.minecraft.resource.ResourceReload;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.Util;
|
||||||
|
import net.minecraft.util.math.ColorHelper;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
|
||||||
|
@Shadow @Final public static Identifier LOGO;
|
||||||
|
@Shadow @Final private MinecraftClient client;
|
||||||
|
@Shadow @Final private boolean reloading;
|
||||||
|
@Shadow private float progress;
|
||||||
|
@Shadow private long reloadCompleteTime;
|
||||||
|
@Shadow private long reloadStartTime;
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
private static int withAlpha(int color, int alpha) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Shadow @Final private static IntSupplier BRAND_ARGB;
|
||||||
|
@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 = "<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 //
|
||||||
|
if (CustomSplashScreenConfig.logoStyle.equals(CustomSplashScreenConfig.LogoStyle.Mojang))
|
||||||
|
client.getTextureManager().registerTexture(LOGO, new BlurredConfigTexture(MOJANG_TEXTURE));
|
||||||
|
else client.getTextureManager().registerTexture(LOGO, new EmptyTexture(EMPTY_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));
|
||||||
|
|
||||||
|
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", ordinal = 2))
|
||||||
|
private void css$renderSplashBackground(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||||
|
if (CustomSplashScreenConfig.backgroundImage) {
|
||||||
|
context.getMatrices().translate(0, 0, 1f);
|
||||||
|
int width = client.getWindow().getScaledWidth();
|
||||||
|
int height = client.getWindow().getScaledHeight();
|
||||||
|
float f = this.reloadCompleteTime > -1L ? (float)(Util.getMeasuringTimeMs() - this.reloadCompleteTime) / 1000.0F : -1.0F;
|
||||||
|
float g = this.reloadStartTime> -1L ? (float)(Util.getMeasuringTimeMs() - this.reloadStartTime) / 500.0F : -1.0F;
|
||||||
|
float s;
|
||||||
|
if (f >= 1.0F) s = 1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F);
|
||||||
|
else if (reloading) s = MathHelper.clamp(g, 0.0F, 1.0F);
|
||||||
|
else s = 1.0F;
|
||||||
|
RenderSystem.enableBlend();
|
||||||
|
RenderSystem.blendEquation(32774);
|
||||||
|
RenderSystem.defaultBlendFunc();
|
||||||
|
context.drawTexture(RenderLayer::getGuiTextured, BACKGROUND_TEXTURE, 0, 0, 0, 0, width, height, width, height, ColorHelper.fromFloats(s, 1.f, 1.f, 1.f));
|
||||||
|
RenderSystem.defaultBlendFunc();
|
||||||
|
RenderSystem.disableBlend();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(at = @At("TAIL"), method = "render")
|
||||||
|
public void css$render(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||||
|
if (CustomSplashScreenConfig.logoStyle == CustomSplashScreenConfig.LogoStyle.Aspect1to1) {
|
||||||
|
float f = this.reloadCompleteTime > -1L ? (float)(Util.getMeasuringTimeMs() - this.reloadCompleteTime) / 1000.0F : -1.0F;
|
||||||
|
float s = 1.0f;
|
||||||
|
|
||||||
|
if (f >= 1.0F) s = 1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F);
|
||||||
|
else if (this.reloading) s = MathHelper.clamp((this.reloadStartTime > -1L ? (float)(Util.getMeasuringTimeMs() - this.reloadStartTime) / 500.0F : -1.0F), 0.0F, 1.0F);
|
||||||
|
|
||||||
|
double d = Math.min((double)this.client.getWindow().getScaledWidth() * 0.75D, this.client.getWindow().getScaledHeight()) * 0.25D;
|
||||||
|
int w = (int)(d * 2);
|
||||||
|
// Render the Logo
|
||||||
|
RenderSystem.enableBlend();
|
||||||
|
RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
|
||||||
|
if (!CustomSplashScreenConfig.logoBlend) RenderSystem.defaultBlendFunc();
|
||||||
|
context.drawTexture(RenderLayer::getGuiTextured, ASPECT_1to1_TEXTURE,(int)(this.client.getWindow().getScaledWidth() * 0.5D) - (w / 2), (int)(d * 0.5D), 0, 0, w, w, 512, 512, 512, 512, ColorHelper.fromFloats(s, 1.f, 1.f, 1.f));
|
||||||
|
RenderSystem.defaultBlendFunc();
|
||||||
|
RenderSystem.disableBlend();
|
||||||
|
}
|
||||||
|
if (client.currentScreen != null && client.currentScreen instanceof MidnightConfig.MidnightConfigScreen) this.progress = 1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(at = @At("TAIL"), method = "renderProgressBar")
|
||||||
|
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);
|
||||||
|
|
||||||
|
// Custom Progress Bar
|
||||||
|
if (CustomSplashScreenConfig.progressBarType == CustomSplashScreenConfig.ProgressBarType.Custom) {
|
||||||
|
int regionWidth = CustomSplashScreenConfig.customProgressBarMode == CustomSplashScreenConfig.ProgressBarMode.Stretch ? x2 - x1 : i;
|
||||||
|
int height = (int) (((x2 - x1) / 400f) * 10);
|
||||||
|
int u = CustomSplashScreenConfig.customProgressBarMode.equals(CustomSplashScreenConfig.ProgressBarMode.Slide) ? x2 - x1 - i : 0;
|
||||||
|
if (CustomSplashScreenConfig.progressBarBackground) {
|
||||||
|
context.drawTexture(RenderLayer::getGuiTextured, CUSTOM_PROGRESS_BAR_BACKGROUND_TEXTURE, x1, y1, 0, 0, x2 - x1, height, x2 - x1, height, x2 - x1, height, ColorHelper.fromFloats(1.f, 1.f, 1.f, 1.f));
|
||||||
|
}
|
||||||
|
context.drawTexture(RenderLayer::getGuiTextured, CUSTOM_PROGRESS_BAR_TEXTURE, x1, y1, u, 0, i, height, regionWidth, height, x2 - x1, height, ColorHelper.fromFloats(1.f, 1.f, 1.f, 1.f));
|
||||||
|
}
|
||||||
|
// Spinning Circle Progress Indicator
|
||||||
|
if (CustomSplashScreenConfig.progressBarType == CustomSplashScreenConfig.ProgressBarType.SpinningCircle) {
|
||||||
|
int centerX = x1+(x2-x1)/2;
|
||||||
|
int centerY = y1+(y2-y1)/2;
|
||||||
|
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) (CustomSplashScreenClient.spinningProgress * 24 * CustomSplashScreenConfig.spinningCircleSpeed))%24)-1;
|
||||||
|
|
||||||
|
int color = withAlpha(MidnightColorUtil.hex2Rgb(CustomSplashScreenConfig.splashProgressBarColor).getRGB(), m);
|
||||||
|
for (int j = 0; j<=CustomSplashScreenConfig.spinningCircleTrail; j++) {
|
||||||
|
RenderSystem.enableBlend();
|
||||||
|
RenderSystem.defaultBlendFunc();
|
||||||
|
renderSpinningCircle(context,(time+j) % 24,centerY - size,centerY + size, centerX - size, centerX + size,size/5,color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Unique
|
||||||
|
private void renderSpinningCircle(DrawContext context, int time, int top, int bottom, int left, int right, int blockSize, int color) {
|
||||||
|
switch (time) {
|
||||||
|
//top
|
||||||
|
case 0 -> context.fill(left + 4*blockSize, top, left + 3*blockSize, top + blockSize, color);
|
||||||
|
case 1 -> context.fill(left + 5*blockSize, top, left + 4*blockSize, top + blockSize, color);
|
||||||
|
case 2 -> context.fill(left + 6*blockSize, top, left + 5*blockSize, top + blockSize, color);
|
||||||
|
case 3 -> context.fill(left + 7*blockSize, top, left + 6*blockSize, top + blockSize, color);
|
||||||
|
//top right
|
||||||
|
case 4 -> context.fill(right - 3*blockSize, top + blockSize, right - 2*blockSize, top + 2*blockSize, color);
|
||||||
|
case 5 -> context.fill(right - 2*blockSize, top + 2*blockSize, right - blockSize, top + 3*blockSize, color);
|
||||||
|
//right
|
||||||
|
case 6 -> context.fill(right - blockSize, top + 3*blockSize, right, top + 4*blockSize, color);
|
||||||
|
case 7 -> context.fill(right - blockSize, top + 4*blockSize, right, top + 5*blockSize, color);
|
||||||
|
case 8 -> context.fill(right - blockSize, top + 5*blockSize, right, top + 6*blockSize, color);
|
||||||
|
case 9 -> context.fill(right - blockSize, top + 6*blockSize, right, top + 7*blockSize, color);
|
||||||
|
//bottom right
|
||||||
|
case 10 -> context.fill(right - 2*blockSize, bottom - 2*blockSize, right - blockSize, bottom - 3*blockSize, color);
|
||||||
|
case 11 -> context.fill(right - 3*blockSize, bottom - blockSize, right - 2*blockSize, bottom - 2*blockSize, color);
|
||||||
|
//bottom
|
||||||
|
case 12 -> context.fill(right - 4*blockSize, bottom, right - 3*blockSize, bottom - blockSize, color);
|
||||||
|
case 13 -> context.fill(right - 5*blockSize, bottom, right - 4*blockSize, bottom - blockSize, color);
|
||||||
|
case 14 -> context.fill(right - 6*blockSize, bottom, right - 5*blockSize, bottom - blockSize, color);
|
||||||
|
case 15 -> context.fill(right - 7*blockSize, bottom, right - 6*blockSize, bottom - blockSize, color);
|
||||||
|
//bottom left
|
||||||
|
case 16 -> context.fill(left + 3*blockSize, bottom - blockSize, left + 2*blockSize, bottom - 2*blockSize, color);
|
||||||
|
case 17 -> context.fill(left + 2*blockSize, bottom - 2*blockSize, left + blockSize, bottom - 3*blockSize, color);
|
||||||
|
//left
|
||||||
|
case 18 -> context.fill(left + blockSize, bottom - 3*blockSize, left, bottom - 4*blockSize, color);
|
||||||
|
case 19 -> context.fill(left + blockSize, bottom - 4*blockSize, left, bottom - 5*blockSize, color);
|
||||||
|
case 20 -> context.fill(left + blockSize, bottom - 5*blockSize, left, bottom - 6*blockSize, color);
|
||||||
|
case 21 -> context.fill(left + blockSize, bottom - 6*blockSize, left, bottom - 7*blockSize, color);
|
||||||
|
//top left
|
||||||
|
case 22 -> context.fill(left + 2*blockSize, top + 2*blockSize, left + blockSize, top + 3*blockSize, color);
|
||||||
|
case 23 -> context.fill(left + 3*blockSize, top + blockSize, left + 2 * blockSize, top + 2*blockSize, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Replaced by the methods below for compatibility with Puzzle
|
||||||
|
// @Redirect(method = "render", at = @At(value = "INVOKE", target = "Ljava/util/function/IntSupplier;getAsInt()I"))
|
||||||
|
// private int css$modifyBackground(IntSupplier instance) { // Set the Background Color to our configured value //
|
||||||
|
// return !CustomSplashScreenConfig.backgroundImage ? MidnightColorUtil.hex2Rgb(CustomSplashScreenConfig.backgroundColor).getRGB() | 255 << 24 : 0;
|
||||||
|
// }
|
||||||
|
@Inject(method = "withAlpha", at = @At("RETURN"), cancellable = true)
|
||||||
|
private static void css$modifyBackgroundColor(int color, int alpha, CallbackInfoReturnable<Integer> cir) {
|
||||||
|
if (color == BRAND_ARGB.getAsInt()) {
|
||||||
|
int configColor = !CustomSplashScreenConfig.backgroundImage ? MidnightColorUtil.hex2Rgb(CustomSplashScreenConfig.splashBackgroundColor).getRGB() | 255 << 24 : 0;
|
||||||
|
cir.setReturnValue(configColor & 16777215 | alpha << 24);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;_clearColor(FFFF)V"))
|
||||||
|
private void css$clearModifiedColor(float red, float green, float blue, float alpha) {
|
||||||
|
int k = !CustomSplashScreenConfig.backgroundImage ? MidnightColorUtil.hex2Rgb(CustomSplashScreenConfig.splashBackgroundColor).getRGB() : 0;
|
||||||
|
float m = (float)(k >> 16 & 255) / 255.0F;
|
||||||
|
float n = (float)(k >> 8 & 255) / 255.0F;
|
||||||
|
float o = (float)(k & 255) / 255.0F;
|
||||||
|
GlStateManager._clearColor(m, n, o, 1.0F);
|
||||||
|
}
|
||||||
|
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/ColorHelper;getWhite(F)I", shift = At.Shift.AFTER))
|
||||||
|
private void css$betterBlend(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||||
|
if (!CustomSplashScreenConfig.logoBlend) RenderSystem.defaultBlendFunc();
|
||||||
|
}
|
||||||
|
@Inject(method = "renderProgressBar", at = @At("HEAD"))
|
||||||
|
private void css$addProgressBarBackground(DrawContext context, int minX, int minY, int maxX, int maxY, float opacity, CallbackInfo ci) {
|
||||||
|
if (CustomSplashScreenConfig.progressBarType.equals(CustomSplashScreenConfig.ProgressBarType.Vanilla) && CustomSplashScreenConfig.progressBarBackground) {
|
||||||
|
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);
|
||||||
|
RenderSystem.disableBlend();
|
||||||
|
context.fill(minX, minY, maxX, maxY, withAlpha(MidnightColorUtil.hex2Rgb(CustomSplashScreenConfig.splashProgressBackgroundColor).getRGB(), m));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModifyArg(method = "renderProgressBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;fill(IIIII)V"), index = 4)
|
||||||
|
private int css$modifyProgressFrame(int color) { // Set the Progress Bar Frame Color to our configured value //
|
||||||
|
return CustomSplashScreenConfig.progressBarType.equals(CustomSplashScreenConfig.ProgressBarType.Vanilla) ? MidnightColorUtil.hex2Rgb(CustomSplashScreenConfig.splashProgressFrameColor).getRGB() | 255 << 24 : 0;
|
||||||
|
}
|
||||||
|
@ModifyArg(method = "renderProgressBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;fill(IIIII)V", ordinal = 0), index = 4)
|
||||||
|
private int css$modifyProgressColor(int color) { // Set the Progress Bar Color to our configured value //
|
||||||
|
return CustomSplashScreenConfig.progressBarType.equals(CustomSplashScreenConfig.ProgressBarType.Vanilla) ? MidnightColorUtil.hex2Rgb(CustomSplashScreenConfig.splashProgressBarColor).getRGB() | 255 << 24 : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,205 +0,0 @@
|
|||||||
package eu.midnightdust.customsplashscreen.mixin;
|
|
||||||
|
|
||||||
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;
|
|
||||||
import eu.midnightdust.customsplashscreen.texture.EmptyTexture;
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.client.gui.hud.BackgroundHelper;
|
|
||||||
import net.minecraft.client.gui.screen.SplashScreen;
|
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
|
||||||
import net.minecraft.resource.ResourceReloadMonitor;
|
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import net.minecraft.util.Util;
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
import static net.minecraft.client.gui.DrawableHelper.drawTexture;
|
|
||||||
|
|
||||||
@Mixin(SplashScreen.class)
|
|
||||||
public class SplashScreenMixin {
|
|
||||||
|
|
||||||
@Shadow @Final private static Identifier LOGO;
|
|
||||||
@Shadow @Final private MinecraftClient client;
|
|
||||||
@Shadow @Final private boolean reloading;
|
|
||||||
@Shadow private long applyCompleteTime;
|
|
||||||
@Shadow @Final private ResourceReloadMonitor reloadMonitor;
|
|
||||||
@Shadow private long prepareCompleteTime;
|
|
||||||
@Shadow private float progress;
|
|
||||||
|
|
||||||
private static final CustomSplashScreenConfig CS_CONFIG = CustomSplashScreenClient.CS_CONFIG;
|
|
||||||
|
|
||||||
|
|
||||||
private static final Identifier EMPTY_TEXTURE = new Identifier("empty.png");
|
|
||||||
private static final Identifier MOJANG_TEXTURE = new Identifier(CS_CONFIG.textures.MojangLogo);
|
|
||||||
private static final Identifier ASPECT_1to1_TEXTURE = new Identifier(CS_CONFIG.textures.Aspect1to1Logo);
|
|
||||||
private static final Identifier BOSS_BAR_TEXTURE = new Identifier(CS_CONFIG.textures.BossBarTexture);
|
|
||||||
private static final Identifier CUSTOM_PROGRESS_BAR_TEXTURE = new Identifier(CS_CONFIG.textures.CustomBarTexture);
|
|
||||||
private static final Identifier CUSTOM_PROGRESS_BAR_BACKGROUND_TEXTURE = new Identifier(CS_CONFIG.textures.CustomBarBackgroundTexture);
|
|
||||||
private static final Identifier BACKGROUND_TEXTURE = new Identifier(CS_CONFIG.textures.BackgroundTexture);
|
|
||||||
|
|
||||||
@Inject(method = "init(Lnet/minecraft/client/MinecraftClient;)V", at = @At("HEAD"), cancellable=true)
|
|
||||||
private static void init(MinecraftClient client, CallbackInfo ci) { // Load our custom textures at game start //
|
|
||||||
if (CS_CONFIG.logoStyle == CustomSplashScreenConfig.LogoStyle.Mojang) {
|
|
||||||
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));
|
|
||||||
|
|
||||||
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));
|
|
||||||
|
|
||||||
ci.cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/TextureManager;bindTexture(Lnet/minecraft/util/Identifier;)V",shift = At.Shift.BEFORE), method = "render")
|
|
||||||
private void renderBackground(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { // Render our background image //
|
|
||||||
long l = Util.getMeasuringTimeMs();
|
|
||||||
if (this.reloading && (this.reloadMonitor.isPrepareStageComplete() || this.client.currentScreen != null) && this.prepareCompleteTime == -1L) {
|
|
||||||
this.prepareCompleteTime = l;
|
|
||||||
}
|
|
||||||
|
|
||||||
float f = this.applyCompleteTime > -1L ? (float)(l - this.applyCompleteTime) / 1000.0F : -1.0F;
|
|
||||||
float g = this.prepareCompleteTime > -1L ? (float)(l - this.prepareCompleteTime) / 500.0F : -1.0F;
|
|
||||||
float o;
|
|
||||||
if (f >= 1.0F) {
|
|
||||||
o = 1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F);
|
|
||||||
} else if (this.reloading) {
|
|
||||||
o = MathHelper.clamp(g, 0.0F, 1.0F);
|
|
||||||
} else {
|
|
||||||
o = 1.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
int maxX = this.client.getWindow().getScaledWidth();
|
|
||||||
int maxY = this.client.getWindow().getScaledHeight();
|
|
||||||
|
|
||||||
if (CS_CONFIG.backgroundImage) {
|
|
||||||
client.getTextureManager().bindTexture(BACKGROUND_TEXTURE);
|
|
||||||
RenderSystem.enableBlend();
|
|
||||||
RenderSystem.alphaFunc(516, 0.0F);
|
|
||||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, o);
|
|
||||||
drawTexture(matrices, 0, 0, 0, 0, 0, maxX, maxY, maxY, maxX);
|
|
||||||
RenderSystem.defaultBlendFunc();
|
|
||||||
RenderSystem.defaultAlphaFunc();
|
|
||||||
RenderSystem.disableBlend();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(at = @At("TAIL"), method = "render")
|
|
||||||
private void renderLogo(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { // Render our 1 to 1 logo //
|
|
||||||
long l = Util.getMeasuringTimeMs();
|
|
||||||
if (this.reloading && (this.reloadMonitor.isPrepareStageComplete() || this.client.currentScreen != null) && this.prepareCompleteTime == -1L) {
|
|
||||||
this.prepareCompleteTime = l;
|
|
||||||
}
|
|
||||||
float f = this.applyCompleteTime > -1L ? (float)(l - this.applyCompleteTime) / 1000.0F : -1.0F;
|
|
||||||
float g = this.prepareCompleteTime > -1L ? (float)(l - this.prepareCompleteTime) / 500.0F : -1.0F;
|
|
||||||
float o;
|
|
||||||
int m;
|
|
||||||
if (f >= 1.0F) {
|
|
||||||
o = 1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F);
|
|
||||||
} else if (this.reloading) {
|
|
||||||
o = MathHelper.clamp(g, 0.0F, 1.0F);
|
|
||||||
} else {
|
|
||||||
o = 1.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
m = (int)((double)this.client.getWindow().getScaledWidth() * 0.5D);
|
|
||||||
|
|
||||||
if (CustomSplashScreenClient.CS_CONFIG.logoStyle == CustomSplashScreenConfig.LogoStyle.Aspect1to1) {
|
|
||||||
double d = Math.min((double)this.client.getWindow().getScaledWidth() * 0.75D, this.client.getWindow().getScaledHeight()) * 0.25D;
|
|
||||||
int r = (int)(d * 0.5D);
|
|
||||||
double e = d * 4.0D;
|
|
||||||
int s = (int)(e * 0.5D);
|
|
||||||
client.getTextureManager().bindTexture(ASPECT_1to1_TEXTURE);
|
|
||||||
RenderSystem.enableBlend();
|
|
||||||
RenderSystem.alphaFunc(516, 0.0F);
|
|
||||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, o);
|
|
||||||
drawTexture(matrices, m - (s / 2), r, s, s, 0, 0, 512, 512, 512, 512);
|
|
||||||
RenderSystem.defaultBlendFunc();
|
|
||||||
RenderSystem.defaultAlphaFunc();
|
|
||||||
RenderSystem.disableBlend();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/SplashScreen;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V"), index = 5)
|
|
||||||
private int modifyBackgroundColor(int color) { // Set the Background Color to our configured value //
|
|
||||||
long l = Util.getMeasuringTimeMs();
|
|
||||||
if (this.reloading && (this.reloadMonitor.isPrepareStageComplete() || this.client.currentScreen != null) && this.prepareCompleteTime == -1L) {
|
|
||||||
this.prepareCompleteTime = l;
|
|
||||||
}
|
|
||||||
float f = this.applyCompleteTime > -1L ? (float)(l - this.applyCompleteTime) / 1000.0F : -1.0F;
|
|
||||||
int m;
|
|
||||||
m = MathHelper.ceil((1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F)) * 255.0F);
|
|
||||||
|
|
||||||
if (CS_CONFIG.backgroundImage) {
|
|
||||||
return BackgroundHelper.ColorMixer.getArgb(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return CustomSplashScreenClient.CS_CONFIG.backgroundColor | m << 24;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ModifyArg(method = "renderProgressBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/SplashScreen;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V"), index = 5)
|
|
||||||
private int modifyProgressFrame(int color) { // Set the Progress Bar Frame Color to our configured value //
|
|
||||||
if (CustomSplashScreenClient.CS_CONFIG.progressBarType == CustomSplashScreenConfig.ProgressBarType.BossBar || CS_CONFIG.progressBarType == CustomSplashScreenConfig.ProgressBarType.Hidden) {
|
|
||||||
return BackgroundHelper.ColorMixer.getArgb(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
else return CustomSplashScreenClient.CS_CONFIG.progressFrameColor | 255 << 24;
|
|
||||||
}
|
|
||||||
@ModifyArg(method = "renderProgressBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/SplashScreen;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V", ordinal = 4), index = 5)
|
|
||||||
private int modifyProgressColor(int color) { // Set the Progress Bar Color to our configured value //
|
|
||||||
if (CustomSplashScreenClient.CS_CONFIG.progressBarType == CustomSplashScreenConfig.ProgressBarType.BossBar || CS_CONFIG.progressBarType == CustomSplashScreenConfig.ProgressBarType.Hidden || CS_CONFIG.progressBarType == CustomSplashScreenConfig.ProgressBarType.Custom) {
|
|
||||||
return BackgroundHelper.ColorMixer.getArgb(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
else return CustomSplashScreenClient.CS_CONFIG.progressBarColor | 255 << 24;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(at = @At("TAIL"), method = "renderProgressBar", cancellable = true)
|
|
||||||
private void renderCSProgressBar(MatrixStack matrices, int x1, int y1, int x2, int y2, float opacity, CallbackInfo ci) { // Render our custom Progress Bar //
|
|
||||||
int i = MathHelper.ceil((float)(x2 - x1 - 2) * this.progress);
|
|
||||||
if (CustomSplashScreenClient.CS_CONFIG.progressBarType == CustomSplashScreenConfig.ProgressBarType.BossBar) { // Bossbar Style Progress Bar //
|
|
||||||
client.getTextureManager().bindTexture(BOSS_BAR_TEXTURE);
|
|
||||||
int overlay = 0;
|
|
||||||
|
|
||||||
if (CustomSplashScreenClient.CS_CONFIG.bossBarType == CustomSplashScreenConfig.BossBarType.NOTCHED_6) {overlay = 93;}
|
|
||||||
else if (CustomSplashScreenClient.CS_CONFIG.bossBarType == CustomSplashScreenConfig.BossBarType.NOTCHED_10) {overlay = 105;}
|
|
||||||
else if (CustomSplashScreenClient.CS_CONFIG.bossBarType == CustomSplashScreenConfig.BossBarType.NOTCHED_12) {overlay = 117;}
|
|
||||||
else if (CustomSplashScreenClient.CS_CONFIG.bossBarType == CustomSplashScreenConfig.BossBarType.NOTCHED_20) {overlay = 129;}
|
|
||||||
|
|
||||||
int bbWidth = (int) ((x2 - x1+1) * 1.4f);
|
|
||||||
int bbHeight = (y2 - y1) * 30;
|
|
||||||
drawTexture(matrices, x1, y1 + 1, 0, 0, 0, x2-x1, (int) ((y2-y1)/1.4f), bbHeight, bbWidth);
|
|
||||||
drawTexture(matrices, x1, y1 + 1, 0, 0, 5f, i, (int) ((y2-y1)/1.4f), bbHeight, bbWidth);
|
|
||||||
|
|
||||||
RenderSystem.alphaFunc(516, 0.0F);
|
|
||||||
RenderSystem.enableBlend();
|
|
||||||
if (overlay != 0) {
|
|
||||||
drawTexture(matrices, x1, y1 + 1, 0, 0, overlay, x2 - x1, (int) ((y2 - y1) / 1.4f), bbHeight, bbWidth);
|
|
||||||
}
|
|
||||||
RenderSystem.defaultBlendFunc();
|
|
||||||
RenderSystem.defaultAlphaFunc();
|
|
||||||
RenderSystem.disableBlend();
|
|
||||||
}
|
|
||||||
if (CustomSplashScreenClient.CS_CONFIG.progressBarType == CustomSplashScreenConfig.ProgressBarType.Custom) { // Custom Progress Bar //
|
|
||||||
int customWidth = CustomSplashScreenClient.CS_CONFIG.customProgressBarMode == CustomSplashScreenConfig.ProgressBarMode.Linear ? x2-x1 : i;
|
|
||||||
if (CS_CONFIG.customProgressBarBackground) {
|
|
||||||
client.getTextureManager().bindTexture(CUSTOM_PROGRESS_BAR_BACKGROUND_TEXTURE);
|
|
||||||
drawTexture(matrices, x1, y1, 0, 0, 6, x2-x1, y2-y1, 10, x2-x1);
|
|
||||||
}
|
|
||||||
client.getTextureManager().bindTexture(CUSTOM_PROGRESS_BAR_TEXTURE);
|
|
||||||
drawTexture(matrices, x1, y1, 0, 0, 6, i, y2-y1, 10, customWidth);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,38 +1,12 @@
|
|||||||
package eu.midnightdust.customsplashscreen.texture;
|
package eu.midnightdust.customsplashscreen.texture;
|
||||||
|
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
|
||||||
import net.minecraft.client.resource.metadata.TextureResourceMetadata;
|
|
||||||
import net.minecraft.client.texture.NativeImage;
|
|
||||||
import net.minecraft.client.texture.ResourceTexture;
|
|
||||||
import net.minecraft.resource.ResourceManager;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
public class BlurredConfigTexture extends ConfigTexture {
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
public class BlurredConfigTexture extends ResourceTexture {
|
|
||||||
// Load textures from the config directory //
|
// Load textures from the config directory //
|
||||||
|
|
||||||
public BlurredConfigTexture(Identifier location) {
|
public BlurredConfigTexture(Identifier location) {
|
||||||
super(location);
|
super(location);
|
||||||
}
|
shouldBlur = true;
|
||||||
|
|
||||||
protected TextureData loadTextureData(ResourceManager resourceManager) {
|
|
||||||
try {
|
|
||||||
InputStream input = new FileInputStream(FabricLoader.getInstance().getConfigDir()+"/customsplashscreen/"+this.location.toString().replace("minecraft:",""));
|
|
||||||
TextureData texture;
|
|
||||||
|
|
||||||
try {
|
|
||||||
texture = new TextureData(new TextureResourceMetadata(true, true), NativeImage.read(input));
|
|
||||||
} finally {
|
|
||||||
input.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
return texture;
|
|
||||||
} catch (IOException var18) {
|
|
||||||
return new TextureData(var18);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,18 +1,25 @@
|
|||||||
package eu.midnightdust.customsplashscreen.texture;
|
package eu.midnightdust.customsplashscreen.texture;
|
||||||
|
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import eu.midnightdust.customsplashscreen.CustomSplashScreenClient;
|
||||||
import net.minecraft.client.resource.metadata.TextureResourceMetadata;
|
import net.minecraft.client.resource.metadata.TextureResourceMetadata;
|
||||||
import net.minecraft.client.texture.NativeImage;
|
import net.minecraft.client.texture.NativeImage;
|
||||||
import net.minecraft.client.texture.ResourceTexture;
|
import net.minecraft.client.texture.ResourceTexture;
|
||||||
import net.minecraft.resource.ResourceManager;
|
import net.minecraft.resource.ResourceManager;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class ConfigTexture extends ResourceTexture {
|
public class ConfigTexture extends ResourceTexture {
|
||||||
|
public static int randomBackgroundId;
|
||||||
|
public static int prevBackgroundLength;
|
||||||
// Load textures from the config directory //
|
// Load textures from the config directory //
|
||||||
|
public boolean shouldBlur = false;
|
||||||
|
|
||||||
public ConfigTexture(Identifier location) {
|
public ConfigTexture(Identifier location) {
|
||||||
super(location);
|
super(location);
|
||||||
@@ -20,11 +27,22 @@ public class ConfigTexture extends ResourceTexture {
|
|||||||
|
|
||||||
protected TextureData loadTextureData(ResourceManager resourceManager) {
|
protected TextureData loadTextureData(ResourceManager resourceManager) {
|
||||||
try {
|
try {
|
||||||
InputStream input = new FileInputStream(FabricLoader.getInstance().getConfigDir()+"/customsplashscreen/"+this.location.toString().replace("minecraft:",""));
|
InputStream input = new FileInputStream(CustomSplashScreenClient.CONFIG_PATH+"/"+this.location.getPath());
|
||||||
|
if (this.location.getPath().equals("background.png") && CustomSplashScreenClient.CONFIG_PATH.toPath().resolve("backgrounds").toFile().isDirectory()) {
|
||||||
|
if (CustomSplashScreenClient.CONFIG_PATH.toPath().resolve("backgrounds").toFile().listFiles() != null) {
|
||||||
|
File[] backgrounds = Arrays.stream(Objects.requireNonNull(CustomSplashScreenClient.CONFIG_PATH.toPath().resolve("backgrounds").toFile().listFiles())).filter(file -> file.toString().endsWith(".png") || file.toString().endsWith(".jpg") || file.toString().endsWith(".jpeg")).toList().toArray(new File[0]);
|
||||||
|
if (backgrounds.length > 0) {
|
||||||
|
if (ConfigTexture.randomBackgroundId == -1 || ConfigTexture.prevBackgroundLength != backgrounds.length) ConfigTexture.randomBackgroundId = Random.create().nextInt(backgrounds.length);
|
||||||
|
input = new FileInputStream(backgrounds[ConfigTexture.randomBackgroundId]);
|
||||||
|
ConfigTexture.prevBackgroundLength = backgrounds.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TextureData texture;
|
TextureData texture;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
texture = new TextureData(new TextureResourceMetadata(false, true), NativeImage.read(input));
|
texture = new TextureData(new TextureResourceMetadata(shouldBlur, true), NativeImage.read(input));
|
||||||
} finally {
|
} finally {
|
||||||
input.close();
|
input.close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,45 @@
|
|||||||
{
|
{
|
||||||
"text.autoconfig.customsplashscreen.title":"Custom Splash Screen Config",
|
"customsplashscreen.midnightconfig.title":"Custom Splash Screen Config",
|
||||||
"text.autoconfig.customsplashscreen.option.progressBarType":"Progress Bar Type",
|
"customsplashscreen.midnightconfig.category.general":"General",
|
||||||
"text.autoconfig.customsplashscreen.option.logoStyle":"Logo Style",
|
"customsplashscreen.midnightconfig.category.loading_indicator":"Loading Indicator",
|
||||||
"text.autoconfig.customsplashscreen.option.backgroundImage":"Background Image",
|
"customsplashscreen.midnightconfig.category.colors":"Colors",
|
||||||
"text.autoconfig.customsplashscreen.option.backgroundColor":"Background Color",
|
"customsplashscreen.midnightconfig.progressBarType":"Progress Bar Type",
|
||||||
"text.autoconfig.customsplashscreen.option.progressBarColor":"Progress Bar Color",
|
"customsplashscreen.midnightconfig.enum.ProgressBarType.Vanilla":"Vanilla",
|
||||||
"text.autoconfig.customsplashscreen.option.progressFrameColor":"Progress Bar Frame Color",
|
"customsplashscreen.midnightconfig.enum.ProgressBarType.BossBar":"Boss Bar",
|
||||||
"text.autoconfig.customsplashscreen.option.customProgressBarMode":"Custom Progress Bar Mode",
|
"customsplashscreen.midnightconfig.enum.ProgressBarType.Custom":"Custom",
|
||||||
"text.autoconfig.customsplashscreen.option.customProgressBarBackground":"Custom Progress Bar Background",
|
"customsplashscreen.midnightconfig.enum.ProgressBarType.SpinningCircle":"Spinning Circle",
|
||||||
"text.autoconfig.customsplashscreen.option.bossBarType":"Boss Bar Style",
|
"customsplashscreen.midnightconfig.enum.ProgressBarType.Hidden":"Hidden",
|
||||||
"text.autoconfig.customsplashscreen.option.textures":"Texture Locations",
|
"customsplashscreen.midnightconfig.progressBarBackground":"Progress Bar Background",
|
||||||
"text.autoconfig.customsplashscreen.option.textures.MojangLogo":"Mojang Logo",
|
"customsplashscreen.midnightconfig.logoStyle":"Logo Style",
|
||||||
"text.autoconfig.customsplashscreen.option.textures.Aspect1to1Logo":"Aspect 1 to 1 Logo",
|
"customsplashscreen.midnightconfig.enum.LogoStyle.Mojang":"Wide",
|
||||||
"text.autoconfig.customsplashscreen.option.textures.BossBarTexture":"Boss Bar Texture",
|
"customsplashscreen.midnightconfig.enum.LogoStyle.Aspect1to1":"1to1",
|
||||||
"text.autoconfig.customsplashscreen.option.textures.CustomBarTexture":"Custom Progress Bar Texture",
|
"customsplashscreen.midnightconfig.enum.LogoStyle.Hidden":"Hidden",
|
||||||
"text.autoconfig.customsplashscreen.option.textures.CustomBarBackgroundTexture":"Custom Progress Bar Background Texture",
|
"customsplashscreen.midnightconfig.logoBlend":"Use Blending on Logo",
|
||||||
"text.autoconfig.customsplashscreen.option.textures.BackgroundTexture":"Background Texture"
|
"customsplashscreen.midnightconfig.backgroundImage":"Background Image",
|
||||||
|
"customsplashscreen.midnightconfig.splashBackgroundColor":"Background Color",
|
||||||
|
"customsplashscreen.midnightconfig.splashProgressBarColor":"Progress Bar Color",
|
||||||
|
"customsplashscreen.midnightconfig.splashProgressFrameColor":"Progress Bar Frame Color",
|
||||||
|
"customsplashscreen.midnightconfig.splashProgressBackgroundColor":"Progress Bar Background Color",
|
||||||
|
"customsplashscreen.midnightconfig.customProgressBarMode":"Custom Progress Bar Mode",
|
||||||
|
"customsplashscreen.midnightconfig.enum.ProgressBarMode.Linear":"Linear",
|
||||||
|
"customsplashscreen.midnightconfig.enum.ProgressBarMode.Stretch":"Stretch",
|
||||||
|
"customsplashscreen.midnightconfig.enum.ProgressBarMode.Slide": "Slide",
|
||||||
|
"customsplashscreen.midnightconfig.spinningCircleSize":"Spinning Circle Size",
|
||||||
|
"customsplashscreen.midnightconfig.spinningCircleSpeed":"Spinning Circle Speed",
|
||||||
|
"customsplashscreen.midnightconfig.spinningCircleTrail":"Spinning Circle Trail Length",
|
||||||
|
"customsplashscreen.midnightconfig.bossBarColor":"Boss Bar Color",
|
||||||
|
"customsplashscreen.midnightconfig.enum.BossBarColor.MAGENTA":"Magenta",
|
||||||
|
"customsplashscreen.midnightconfig.enum.BossBarColor.CYAN":"Cyan",
|
||||||
|
"customsplashscreen.midnightconfig.enum.BossBarColor.RED":"Red",
|
||||||
|
"customsplashscreen.midnightconfig.enum.BossBarColor.LIME":"Lime",
|
||||||
|
"customsplashscreen.midnightconfig.enum.BossBarColor.YELLOW":"Yellow",
|
||||||
|
"customsplashscreen.midnightconfig.enum.BossBarColor.PURPLE":"Purple",
|
||||||
|
"customsplashscreen.midnightconfig.enum.BossBarColor.WHITE":"White",
|
||||||
|
"customsplashscreen.midnightconfig.bossBarType":"Boss Bar Style",
|
||||||
|
"customsplashscreen.midnightconfig.enum.BossBarType.PROGRESS":"Progress",
|
||||||
|
"customsplashscreen.midnightconfig.enum.BossBarType.NOTCHED_6":"6 Notches",
|
||||||
|
"customsplashscreen.midnightconfig.enum.BossBarType.NOTCHED_10":"10 Notches",
|
||||||
|
"customsplashscreen.midnightconfig.enum.BossBarType.NOTCHED_12":"12 Notches",
|
||||||
|
"customsplashscreen.midnightconfig.enum.BossBarType.NOTCHED_20":"20 Notches",
|
||||||
|
"customsplashscreen.midnightconfig.bossBarSize":"Boss Bar Size"
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
"required": true,
|
"required": true,
|
||||||
"package": "eu.midnightdust.customsplashscreen.mixin",
|
"package": "eu.midnightdust.customsplashscreen.mixin",
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"client": [
|
"client": [
|
||||||
"SplashScreenMixin"
|
"MixinSplashScreen",
|
||||||
|
"MixinMidnightConfig"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|||||||
@@ -7,7 +7,8 @@
|
|||||||
"description": "Change minecraft's loading screen to your liking! Completely configurable!",
|
"description": "Change minecraft's loading screen to your liking! Completely configurable!",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Motschen",
|
"Motschen",
|
||||||
"TeamMidnightDust"
|
"TeamMidnightDust",
|
||||||
|
"HypherionSA"
|
||||||
],
|
],
|
||||||
"contact": {
|
"contact": {
|
||||||
"homepage": "https://www.midnightdust.eu/",
|
"homepage": "https://www.midnightdust.eu/",
|
||||||
@@ -22,9 +23,6 @@
|
|||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"client": [
|
"client": [
|
||||||
"eu.midnightdust.customsplashscreen.CustomSplashScreenClient"
|
"eu.midnightdust.customsplashscreen.CustomSplashScreenClient"
|
||||||
],
|
|
||||||
"modmenu": [
|
|
||||||
"eu.midnightdust.customsplashscreen.config.ModMenuIntegration"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -33,8 +31,7 @@
|
|||||||
],
|
],
|
||||||
|
|
||||||
"depends": {
|
"depends": {
|
||||||
"autoconfig1u": "*",
|
"midnightlib": "*"
|
||||||
"cloth-config2": "*"
|
|
||||||
},
|
},
|
||||||
"breaks": {
|
"breaks": {
|
||||||
"splash": "*",
|
"splash": "*",
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user