8 Commits

Author SHA1 Message Date
Motschen
2137a1dbe4 Set correct version 2021-12-10 20:25:44 +01:00
Motschen
dcfbe1a41a Update Gradle 2021-12-10 20:23:19 +01:00
Motschen
48a69ed950 Merge pull request #9 from jmb05/main
Port to 1.18
2021-12-10 19:18:55 +00:00
jmb05
e9f49fbf01 Port to 1.18 2021-12-07 16:59:12 +01:00
Motschen
3640561cb6 Bump version 2021-07-12 20:26:18 +02:00
Motschen
1b03cbf07f Merge pull request #4 from hypherionmc/1.17
Ported to 1.17 and updated Cloth Config/Mod Menu dependencies
2021-07-12 20:19:47 +02:00
HypherionMC
c0796d82aa Ported to 1.17 and updated Cloth Config/Mod Menu dependencies 2021-07-12 14:17:36 +02:00
Motschen
c22877c817 Update README.md 2021-01-20 21:17:19 +01:00
13 changed files with 358 additions and 284 deletions

View File

@@ -1,2 +1,11 @@
# 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>

View File

@@ -1,10 +1,12 @@
//file:noinspection GroovyAssignabilityCheck
//file:noinspection GrDeprecatedAPIUsage
plugins {
id 'fabric-loom' version '0.5-SNAPSHOT'
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'maven-publish'
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
archivesBaseName = project.archives_base_name
version = project.mod_version
@@ -15,38 +17,31 @@ minecraft {
repositories {
maven { url "https://jitpack.io" }
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/releases" }
}
dependencies {
//to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
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 ("me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}"){
exclude module: "fabric-api"
}
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"
}
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modApi("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
modImplementation "com.terraformersmc:modmenu:${project.mod_menu_version}"
}
processResources {
inputs.property "version", project.version
from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
filesMatching("fabric.mod.json") {
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

View File

@@ -3,19 +3,19 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.16.4
yarn_mappings=1.16.4+build.7
loader_version=0.10.8
minecraft_version=1.18
yarn_mappings=1.18+build.1
loader_version=0.12.8
# Mod Properties
mod_version = 1.0.0
mod_version = 1.2.0
maven_group = eu.midnightdust
archives_base_name = customsplashscreen
# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.26.1+1.16
fabric_version=0.44.0+1.18
auto_config_version = 3.3.1
cloth_config_version = 4.8.3
mod_menu_version = 1.14.6+build.31
cloth_config_version = 6.0.42
mod_menu_version = 3.0.0

Binary file not shown.

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

270
gradlew vendored Normal file → Executable file
View 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");
# you may not use this file except in compliance with the License.
@@ -17,78 +17,113 @@
#
##############################################################################
##
## 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/master/subprojects/plugins/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
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum
warn () {
echo "$*"
}
} >&2
die () {
echo
echo "$*"
echo
exit 1
}
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -97,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
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.
Please set the JAVA_HOME variable in your environment to match the
@@ -105,84 +140,95 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# 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" ;;
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --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
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
JAVACMD=$( cygpath --unix "$JAVACMD" )
# 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
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# 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" "$@"

25
gradlew.bat vendored
View File

@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -51,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -61,28 +64,14 @@ echo location of your Java installation.
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
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %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
@rem End local scope for the variables with windows NT shell

View File

@@ -1,20 +1,13 @@
package eu.midnightdust.customsplashscreen;
import eu.midnightdust.customsplashscreen.config.CustomSplashScreenConfig;
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
import me.sargunvohra.mcmods.autoconfig1u.serializer.JanksonConfigSerializer;
import me.shedaniel.autoconfig.AutoConfig;
import me.shedaniel.autoconfig.serializer.JanksonConfigSerializer;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderingRegistry;
import net.fabricmc.fabric.impl.client.indigo.renderer.helper.TextureHelper;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.texture.TextureManager;
import net.minecraft.client.texture.TextureUtil;
import net.minecraft.data.client.model.Texture;
import org.jetbrains.annotations.Nullable;
import java.io.*;
import java.nio.file.*;
import java.util.logging.FileHandler;
public class CustomSplashScreenClient implements ClientModInitializer {

View File

@@ -1,9 +1,9 @@
package eu.midnightdust.customsplashscreen.config;
import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
import me.sargunvohra.mcmods.autoconfig1u.annotation.Config;
import me.sargunvohra.mcmods.autoconfig1u.annotation.ConfigEntry;
import me.sargunvohra.mcmods.autoconfig1u.shadowed.blue.endless.jankson.Comment;
import me.shedaniel.autoconfig.ConfigData;
import me.shedaniel.autoconfig.annotation.Config;
import me.shedaniel.autoconfig.annotation.ConfigEntry;
import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.Comment;
@Config(name = "customsplashscreen")
public class CustomSplashScreenConfig implements ConfigData {
@@ -40,7 +40,6 @@ public class CustomSplashScreenConfig implements ConfigData {
@ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON)
public BossBarType bossBarType = BossBarType.NOTCHED_6;
@ConfigEntry.Gui.CollapsibleObject
public Textures textures = new Textures();

View File

@@ -1,8 +1,8 @@
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 com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import me.shedaniel.autoconfig.AutoConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

View File

@@ -1,5 +1,6 @@
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;
@@ -8,9 +9,10 @@ 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.gui.screen.SplashOverlay;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.resource.ResourceReloadMonitor;
import net.minecraft.resource.ResourceReload;
import net.minecraft.util.Identifier;
import net.minecraft.util.Util;
import net.minecraft.util.math.MathHelper;
@@ -19,25 +21,28 @@ 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;
import java.util.Optional;
import java.util.function.Consumer;
@Mixin(SplashScreen.class)
import static net.minecraft.client.gui.DrawableHelper.drawTexture;
import static net.minecraft.client.gui.DrawableHelper.fill;
@Mixin(SplashOverlay.class)
public class SplashScreenMixin {
@Shadow @Final private static Identifier LOGO;
@Shadow @Final 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 @Final private ResourceReload reload;
@Shadow private float progress;
@Shadow private long reloadCompleteTime;
@Shadow private long reloadStartTime;
@Shadow @Final private Consumer<Optional<Throwable>> exceptionHandler;
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);
@@ -46,7 +51,7 @@ public class SplashScreenMixin {
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)
@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));
@@ -63,113 +68,134 @@ public class SplashScreenMixin {
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 //
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
int width = this.client.getWindow().getScaledWidth();
int height = this.client.getWindow().getScaledHeight();
long l = Util.getMeasuringTimeMs();
if (this.reloading && (this.reloadMonitor.isPrepareStageComplete() || this.client.currentScreen != null) && this.prepareCompleteTime == -1L) {
this.prepareCompleteTime = l;
if (this.reloading && this.reloadStartTime == -1L) {
this.reloadStartTime = 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;
float f = this.reloadCompleteTime > -1L ? (float)(l - this.reloadCompleteTime) / 1000.0F : -1.0F;
float g = this.reloadStartTime > -1L ? (float)(l - this.reloadStartTime) / 500.0F : -1.0F;
float s;
int m;
// Render our custom color
if (f >= 1.0F) {
o = 1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F);
if (this.client.currentScreen != null) {
this.client.currentScreen.render(matrices, 0, 0, delta);
}
m = MathHelper.ceil((1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F)) * 255.0F);
fill(matrices, 0, 0, width, height, withAlpha(m));
s = 1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F);
} else if (this.reloading) {
o = MathHelper.clamp(g, 0.0F, 1.0F);
if (this.client.currentScreen != null && g < 1.0F) {
this.client.currentScreen.render(matrices, mouseX, mouseY, delta);
}
m = MathHelper.ceil(MathHelper.clamp(g, 0.15D, 1.0D) * 255.0D);
fill(matrices, 0, 0, width, height, withAlpha(m));
s = MathHelper.clamp(g, 0.0F, 1.0F);
} else {
o = 1.0F;
m = getBackgroundColor();
float p = (float)(m >> 16 & 255) / 255.0F;
float q = (float)(m >> 8 & 255) / 255.0F;
float r = (float)(m & 255) / 255.0F;
GlStateManager._clearColor(p, q, r, 1.0F);
GlStateManager._clear(16384, MinecraftClient.IS_SYSTEM_MAC);
s = 1.0F;
}
m = (int)((double)this.client.getWindow().getScaledWidth() * 0.5D);
int u = (int)((double)this.client.getWindow().getScaledHeight() * 0.5D);
double d = Math.min((double)this.client.getWindow().getScaledWidth() * 0.75D, this.client.getWindow().getScaledHeight()) * 0.25D;
int v = (int)(d * 0.5D);
double e = d * 4.0D;
int w = (int)(e * 0.5D);
// Render our custom background image
if (CS_CONFIG.backgroundImage) {
RenderSystem.setShaderTexture(0, BACKGROUND_TEXTURE);
RenderSystem.enableBlend();
RenderSystem.blendEquation(32774);
RenderSystem.blendFunc(770, 1);
RenderSystem.setShader(GameRenderer::getPositionTexShader);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, s);
drawTexture(matrices, 0, 0, 0, 0, 0, width, height, width, height);
RenderSystem.defaultBlendFunc();
RenderSystem.disableBlend();
}
// Render the Logo
RenderSystem.setShaderTexture(0, CustomSplashScreenClient.CS_CONFIG.logoStyle == CustomSplashScreenConfig.LogoStyle.Aspect1to1 ? ASPECT_1to1_TEXTURE : LOGO);
RenderSystem.enableBlend();
RenderSystem.setShader(GameRenderer::getPositionTexShader);
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();
RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, s);
drawTexture(matrices, m - (w / 2), v, w, w, 0, 0, 512, 512, 512, 512);
} else if (CustomSplashScreenClient.CS_CONFIG.logoStyle == CustomSplashScreenConfig.LogoStyle.Mojang) {
RenderSystem.blendFunc(770, 1);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, s);
drawTexture(matrices, m - w, u - v, w, (int)d, -0.0625F, 0.0F, 120, 60, 120, 120);
drawTexture(matrices, m, u - v, w, (int)d, 0.0625F, 60.0F, 120, 60, 120, 120);
}
RenderSystem.defaultBlendFunc();
RenderSystem.disableBlend();
int x = (int)((double)this.client.getWindow().getScaledHeight() * 0.8325D);
float y = this.reload.getProgress();
this.progress = MathHelper.clamp(this.progress * 0.95F + y * 0.050000012F, 0.0F, 1.0F);
if (f < 1.0F) {
this.renderProgressBar(matrices, width / 2 - w, x - 5, width / 2 + w, x + 5, 1.0F - MathHelper.clamp(f, 0.0F, 1.0F), null);
}
if (f >= 2.0F) {
this.client.setOverlay(null);
}
if (this.reloadCompleteTime == -1L && this.reload.isComplete() && (!this.reloading || g >= 2.0F)) {
try {
this.reload.throwException();
this.exceptionHandler.accept(Optional.empty());
} catch (Throwable var23) {
this.exceptionHandler.accept(Optional.of(var23));
}
this.reloadCompleteTime = Util.getMeasuringTimeMs();
if (this.client.currentScreen != null) {
this.client.currentScreen.init(this.client, this.client.getWindow().getScaledWidth(), this.client.getWindow().getScaledHeight());
}
}
}
@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);
private static int getBackgroundColor() {
if (CS_CONFIG.backgroundImage) {
return BackgroundHelper.ColorMixer.getArgb(0, 0, 0, 0);
}
else {
return CustomSplashScreenClient.CS_CONFIG.backgroundColor | m << 24;
return CustomSplashScreenClient.CS_CONFIG.backgroundColor;
}
}
@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;
private static int withAlpha(int alpha) {
return getBackgroundColor() | alpha << 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 //
@Inject(at = @At("TAIL"), method = "renderProgressBar")
private void renderProgressBar(MatrixStack matrices, int x1, int y1, int x2, int y2, float opacity, CallbackInfo ci) {
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);
// Bossbar Progress Bar
if (CustomSplashScreenClient.CS_CONFIG.progressBarType == CustomSplashScreenConfig.ProgressBarType.BossBar) {
RenderSystem.setShaderTexture(0, BOSS_BAR_TEXTURE);
RenderSystem.setShader(GameRenderer::getPositionTexShader);
int overlay = 0;
if (CustomSplashScreenClient.CS_CONFIG.bossBarType == CustomSplashScreenConfig.BossBarType.NOTCHED_6) {overlay = 93;}
@@ -179,27 +205,44 @@ public class SplashScreenMixin {
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);
drawTexture(matrices, x1, y1 + 1, 0, 0, 0, x2 - x1, (int) ((y2-y1) / 1.4f), bbWidth, bbHeight);
drawTexture(matrices, x1, y1 + 1, 0, 0, 5f, i, (int) ((y2 - y1) / 1.4f), bbWidth, bbHeight);
RenderSystem.alphaFunc(516, 0.0F);
RenderSystem.enableBlend();
RenderSystem.blendEquation(32774);
RenderSystem.blendFunc(770, 1);
if (overlay != 0) {
drawTexture(matrices, x1, y1 + 1, 0, 0, overlay, x2 - x1, (int) ((y2 - y1) / 1.4f), bbHeight, bbWidth);
drawTexture(matrices, x1, y1 + 1, 0, 0, overlay, x2 - x1, (int) ((y2 - y1) / 1.4f), bbWidth, bbHeight);
}
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;
// Custom Progress Bar
if (CustomSplashScreenClient.CS_CONFIG.progressBarType == CustomSplashScreenConfig.ProgressBarType.Custom) {
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);
RenderSystem.setShaderTexture(0, CUSTOM_PROGRESS_BAR_BACKGROUND_TEXTURE);
RenderSystem.setShader(GameRenderer::getPositionTexShader);
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);
RenderSystem.setShaderTexture(0, CUSTOM_PROGRESS_BAR_TEXTURE);
RenderSystem.setShader(GameRenderer::getPositionTexShader);
drawTexture(matrices, x1, y1, 0, 0, 6, i, y2 - y1, customWidth, 10);
}
// Vanilla / With Color progress bar
if (CustomSplashScreenClient.CS_CONFIG.progressBarType == CustomSplashScreenConfig.ProgressBarType.Vanilla) {
int j = Math.round(opacity * 255.0F);
int k = CustomSplashScreenClient.CS_CONFIG.progressBarColor | 255 << 24;
int kk = CustomSplashScreenClient.CS_CONFIG.progressFrameColor | 255 << 24;
fill(matrices, x1 + 2, y1 + 2, x1 + i, y2 - 2, k);
fill(matrices, x1 + 1, y1, x2 - 1, y1 + 1, kk);
fill(matrices, x1 + 1, y2, x2 - 1, y2 - 1, kk);
fill(matrices, x1, y1, x1 + 1, y2, kk);
fill(matrices, x2, y1, x2 - 1, y2, kk);
}
}
}

View File

@@ -1,7 +1,7 @@
{
"required": true,
"package": "eu.midnightdust.customsplashscreen.mixin",
"compatibilityLevel": "JAVA_8",
"compatibilityLevel": "JAVA_17",
"client": [
"SplashScreenMixin"
],

View File

@@ -7,7 +7,8 @@
"description": "Change minecraft's loading screen to your liking! Completely configurable!",
"authors": [
"Motschen",
"TeamMidnightDust"
"TeamMidnightDust",
"HypherionSA"
],
"contact": {
"homepage": "https://www.midnightdust.eu/",
@@ -33,7 +34,6 @@
],
"depends": {
"autoconfig1u": "*",
"cloth-config2": "*"
},
"breaks": {