mirror of
				https://github.com/chylex/Minecraft-Window-Title.git
				synced 2025-11-03 19:40:13 +01:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			425eb3f380
			...
			1.12/older
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| cc06491313 | |||
| bba8a16afb | 
@@ -1,61 +0,0 @@
 | 
			
		||||
import subprocess
 | 
			
		||||
import platform
 | 
			
		||||
import sys
 | 
			
		||||
import os
 | 
			
		||||
import time
 | 
			
		||||
import shutil
 | 
			
		||||
import zipfile
 | 
			
		||||
 | 
			
		||||
root = os.path.abspath(sys.path[0])
 | 
			
		||||
builds = os.path.join(root, "Build")
 | 
			
		||||
combined = os.path.join(builds, "Combined")
 | 
			
		||||
outputjar = "CustomWindowTitle.jar"
 | 
			
		||||
 | 
			
		||||
gradlew = "gradlew.bat" if platform.system() == "Windows" else "gradlew"
 | 
			
		||||
 | 
			
		||||
def build(folder):
 | 
			
		||||
    separator = "========={}".format("=" * len(folder))
 | 
			
		||||
    
 | 
			
		||||
    print(separator)
 | 
			
		||||
    print("Building {}".format(folder))
 | 
			
		||||
    print(separator)
 | 
			
		||||
    
 | 
			
		||||
    libs = os.path.join(root, folder, "build", "libs")
 | 
			
		||||
    shutil.rmtree(libs)
 | 
			
		||||
    
 | 
			
		||||
    os.chdir(os.path.join(root, folder))
 | 
			
		||||
    subprocess.run([gradlew, "build"])
 | 
			
		||||
    
 | 
			
		||||
    for fname in os.listdir(libs):
 | 
			
		||||
        if "-dev" not in fname:
 | 
			
		||||
            global outputjar
 | 
			
		||||
            outputjar = fname
 | 
			
		||||
            
 | 
			
		||||
            jar = os.path.join(builds, "{}.{}".format(folder, fname))
 | 
			
		||||
            shutil.copyfile(os.path.join(libs, fname), jar)
 | 
			
		||||
            
 | 
			
		||||
            jar = zipfile.ZipFile(jar)
 | 
			
		||||
            jar.extractall(combined)
 | 
			
		||||
            jar.close()
 | 
			
		||||
            
 | 
			
		||||
            break
 | 
			
		||||
 | 
			
		||||
if os.path.isdir(builds):
 | 
			
		||||
    shutil.rmtree(builds)
 | 
			
		||||
    time.sleep(0.25)
 | 
			
		||||
 | 
			
		||||
os.mkdir(builds)
 | 
			
		||||
os.mkdir(combined)
 | 
			
		||||
 | 
			
		||||
# Forge must run last to overwrite MANIFEST.MF
 | 
			
		||||
build("Fabric")
 | 
			
		||||
build("Forge")
 | 
			
		||||
 | 
			
		||||
os.chdir(builds)
 | 
			
		||||
 | 
			
		||||
with zipfile.ZipFile(outputjar, "w", compression = zipfile.ZIP_DEFLATED, compresslevel = 9) as jar:
 | 
			
		||||
    for root, dirs, files in os.walk(combined):
 | 
			
		||||
        for fname in files:
 | 
			
		||||
            fname = os.path.join(root, fname)
 | 
			
		||||
            fname = os.path.normpath(fname)
 | 
			
		||||
            jar.write(fname, os.path.relpath(fname, combined))
 | 
			
		||||
							
								
								
									
										25
									
								
								Fabric/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										25
									
								
								Fabric/.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,25 +0,0 @@
 | 
			
		||||
# gradle
 | 
			
		||||
 | 
			
		||||
.gradle/
 | 
			
		||||
build/
 | 
			
		||||
out/
 | 
			
		||||
classes/
 | 
			
		||||
 | 
			
		||||
# idea
 | 
			
		||||
 | 
			
		||||
.idea/
 | 
			
		||||
*.iml
 | 
			
		||||
*.ipr
 | 
			
		||||
*.iws
 | 
			
		||||
 | 
			
		||||
# vscode
 | 
			
		||||
 | 
			
		||||
.settings/
 | 
			
		||||
.vscode/
 | 
			
		||||
bin/
 | 
			
		||||
.classpath
 | 
			
		||||
.project
 | 
			
		||||
 | 
			
		||||
# fabric
 | 
			
		||||
 | 
			
		||||
run/
 | 
			
		||||
@@ -1,47 +0,0 @@
 | 
			
		||||
plugins{
 | 
			
		||||
	id 'fabric-loom' version '0.2.6-SNAPSHOT'
 | 
			
		||||
	id 'maven-publish'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sourceCompatibility = JavaVersion.VERSION_1_8
 | 
			
		||||
targetCompatibility = JavaVersion.VERSION_1_8
 | 
			
		||||
 | 
			
		||||
archivesBaseName = project.archives_base_name + '-' + project.minecraft_version
 | 
			
		||||
version = project.mod_version
 | 
			
		||||
group = project.maven_group
 | 
			
		||||
 | 
			
		||||
minecraft{}
 | 
			
		||||
 | 
			
		||||
dependencies{
 | 
			
		||||
	minecraft "com.mojang:minecraft:${project.minecraft_version}"
 | 
			
		||||
	mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
 | 
			
		||||
	modCompile "net.fabricmc:fabric-loader:${project.loader_version}"
 | 
			
		||||
	modCompile "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
processResources{
 | 
			
		||||
	inputs.property "version", project.version
 | 
			
		||||
 | 
			
		||||
	from(sourceSets.main.resources.srcDirs){
 | 
			
		||||
		include "fabric.mod.json"
 | 
			
		||||
		expand "version": project.version
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	from(sourceSets.main.resources.srcDirs){
 | 
			
		||||
		exclude "fabric.mod.json"
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// fix jar file name
 | 
			
		||||
version = 'v' + version
 | 
			
		||||
 | 
			
		||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
 | 
			
		||||
// this fixes some edge cases with special characters not displaying correctly
 | 
			
		||||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
 | 
			
		||||
tasks.withType(JavaCompile){
 | 
			
		||||
	options.encoding = "UTF-8"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
jar{
 | 
			
		||||
	from "../LICENSE"
 | 
			
		||||
}
 | 
			
		||||
@@ -1,17 +0,0 @@
 | 
			
		||||
# Done to increase the memory available to gradle.
 | 
			
		||||
org.gradle.jvmargs=-Xmx1G
 | 
			
		||||
 | 
			
		||||
# Fabric Properties
 | 
			
		||||
	# check these on https://fabricmc.net/use
 | 
			
		||||
	minecraft_version=1.15.2
 | 
			
		||||
	yarn_mappings=1.15.2+build.1
 | 
			
		||||
	loader_version=0.7.5+build.178
 | 
			
		||||
 | 
			
		||||
# Mod Properties
 | 
			
		||||
	mod_version = 1.0.0
 | 
			
		||||
	maven_group = chylex.customwindowtitle.fabric
 | 
			
		||||
	archives_base_name = CustomWindowTitle
 | 
			
		||||
 | 
			
		||||
# 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.4.29+build.290-1.15
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								Fabric/gradle/wrapper/gradle-wrapper.jar
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Fabric/gradle/wrapper/gradle-wrapper.jar
									
									
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -1,5 +0,0 @@
 | 
			
		||||
distributionBase=GRADLE_USER_HOME
 | 
			
		||||
distributionPath=wrapper/dists
 | 
			
		||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip
 | 
			
		||||
zipStoreBase=GRADLE_USER_HOME
 | 
			
		||||
zipStorePath=wrapper/dists
 | 
			
		||||
							
								
								
									
										188
									
								
								Fabric/gradlew
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										188
									
								
								Fabric/gradlew
									
									
									
									
										vendored
									
									
								
							@@ -1,188 +0,0 @@
 | 
			
		||||
#!/usr/bin/env sh
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Copyright 2015 the original author or authors.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
# You may obtain a copy of the License at
 | 
			
		||||
#
 | 
			
		||||
#      https://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
#
 | 
			
		||||
# Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
# distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
# See the License for the specific language governing permissions and
 | 
			
		||||
# limitations under the License.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
##############################################################################
 | 
			
		||||
##
 | 
			
		||||
##  Gradle start up script for UN*X
 | 
			
		||||
##
 | 
			
		||||
##############################################################################
 | 
			
		||||
 | 
			
		||||
# 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
 | 
			
		||||
done
 | 
			
		||||
SAVED="`pwd`"
 | 
			
		||||
cd "`dirname \"$PRG\"`/" >/dev/null
 | 
			
		||||
APP_HOME="`pwd -P`"
 | 
			
		||||
cd "$SAVED" >/dev/null
 | 
			
		||||
 | 
			
		||||
APP_NAME="Gradle"
 | 
			
		||||
APP_BASE_NAME=`basename "$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"
 | 
			
		||||
 | 
			
		||||
warn () {
 | 
			
		||||
    echo "$*"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
die () {
 | 
			
		||||
    echo
 | 
			
		||||
    echo "$*"
 | 
			
		||||
    echo
 | 
			
		||||
    exit 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# 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
 | 
			
		||||
    ;;
 | 
			
		||||
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"
 | 
			
		||||
    else
 | 
			
		||||
        JAVACMD="$JAVA_HOME/bin/java"
 | 
			
		||||
    fi
 | 
			
		||||
    if [ ! -x "$JAVACMD" ] ; then
 | 
			
		||||
        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
 | 
			
		||||
 | 
			
		||||
Please set the JAVA_HOME variable in your environment to match the
 | 
			
		||||
location of your Java installation."
 | 
			
		||||
    fi
 | 
			
		||||
else
 | 
			
		||||
    JAVACMD="java"
 | 
			
		||||
    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
 | 
			
		||||
 | 
			
		||||
Please set the JAVA_HOME variable in your environment to match the
 | 
			
		||||
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" ;;
 | 
			
		||||
    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, 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"
 | 
			
		||||
 | 
			
		||||
# 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")"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
exec "$JAVACMD" "$@"
 | 
			
		||||
							
								
								
									
										100
									
								
								Fabric/gradlew.bat
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										100
									
								
								Fabric/gradlew.bat
									
									
									
									
										vendored
									
									
								
							@@ -1,100 +0,0 @@
 | 
			
		||||
@rem
 | 
			
		||||
@rem Copyright 2015 the original author or authors.
 | 
			
		||||
@rem
 | 
			
		||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
@rem you may not use this file except in compliance with the License.
 | 
			
		||||
@rem You may obtain a copy of the License at
 | 
			
		||||
@rem
 | 
			
		||||
@rem      https://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
@rem
 | 
			
		||||
@rem Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
@rem See the License for the specific language governing permissions and
 | 
			
		||||
@rem limitations under the License.
 | 
			
		||||
@rem
 | 
			
		||||
 | 
			
		||||
@if "%DEBUG%" == "" @echo off
 | 
			
		||||
@rem ##########################################################################
 | 
			
		||||
@rem
 | 
			
		||||
@rem  Gradle startup script for Windows
 | 
			
		||||
@rem
 | 
			
		||||
@rem ##########################################################################
 | 
			
		||||
 | 
			
		||||
@rem Set local scope for the variables with windows NT shell
 | 
			
		||||
if "%OS%"=="Windows_NT" setlocal
 | 
			
		||||
 | 
			
		||||
set DIRNAME=%~dp0
 | 
			
		||||
if "%DIRNAME%" == "" set DIRNAME=.
 | 
			
		||||
set APP_BASE_NAME=%~n0
 | 
			
		||||
set APP_HOME=%DIRNAME%
 | 
			
		||||
 | 
			
		||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
 | 
			
		||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
 | 
			
		||||
 | 
			
		||||
@rem Find java.exe
 | 
			
		||||
if defined JAVA_HOME goto findJavaFromJavaHome
 | 
			
		||||
 | 
			
		||||
set JAVA_EXE=java.exe
 | 
			
		||||
%JAVA_EXE% -version >NUL 2>&1
 | 
			
		||||
if "%ERRORLEVEL%" == "0" goto init
 | 
			
		||||
 | 
			
		||||
echo.
 | 
			
		||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
 | 
			
		||||
echo.
 | 
			
		||||
echo Please set the JAVA_HOME variable in your environment to match the
 | 
			
		||||
echo location of your Java installation.
 | 
			
		||||
 | 
			
		||||
goto fail
 | 
			
		||||
 | 
			
		||||
:findJavaFromJavaHome
 | 
			
		||||
set JAVA_HOME=%JAVA_HOME:"=%
 | 
			
		||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
 | 
			
		||||
 | 
			
		||||
if exist "%JAVA_EXE%" goto init
 | 
			
		||||
 | 
			
		||||
echo.
 | 
			
		||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
 | 
			
		||||
echo.
 | 
			
		||||
echo Please set the JAVA_HOME variable in your environment to match the
 | 
			
		||||
echo location of your Java installation.
 | 
			
		||||
 | 
			
		||||
goto fail
 | 
			
		||||
 | 
			
		||||
: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%
 | 
			
		||||
 | 
			
		||||
:end
 | 
			
		||||
@rem End local scope for the variables with windows NT shell
 | 
			
		||||
if "%ERRORLEVEL%"=="0" goto mainEnd
 | 
			
		||||
 | 
			
		||||
:fail
 | 
			
		||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
 | 
			
		||||
rem the _cmd.exe /c_ return code!
 | 
			
		||||
if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
 | 
			
		||||
exit /b 1
 | 
			
		||||
 | 
			
		||||
:mainEnd
 | 
			
		||||
if "%OS%"=="Windows_NT" endlocal
 | 
			
		||||
 | 
			
		||||
:omega
 | 
			
		||||
@@ -1,10 +0,0 @@
 | 
			
		||||
pluginManagement {
 | 
			
		||||
    repositories {
 | 
			
		||||
        jcenter()
 | 
			
		||||
        maven {
 | 
			
		||||
            name = 'Fabric'
 | 
			
		||||
            url = 'https://maven.fabricmc.net/'
 | 
			
		||||
        }
 | 
			
		||||
        gradlePluginPortal()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,46 +0,0 @@
 | 
			
		||||
package chylex.customwindowtitle;
 | 
			
		||||
import org.apache.commons.lang3.ArrayUtils;
 | 
			
		||||
import org.apache.commons.lang3.StringUtils;
 | 
			
		||||
import org.apache.logging.log4j.LogManager;
 | 
			
		||||
import org.apache.logging.log4j.Logger;
 | 
			
		||||
import java.util.regex.Matcher;
 | 
			
		||||
import java.util.regex.Pattern;
 | 
			
		||||
 | 
			
		||||
public final class TitleParser{
 | 
			
		||||
	private static final Pattern tokenRegex = Pattern.compile("\\{([a-z]+)(?::([^}]+))?}");
 | 
			
		||||
	private static final Logger logger = LogManager.getLogger("CustomWindowTitle");
 | 
			
		||||
	
 | 
			
		||||
	public static String parse(String input){
 | 
			
		||||
		StringBuffer buffer = new StringBuffer();
 | 
			
		||||
		Matcher matcher = tokenRegex.matcher(input);
 | 
			
		||||
		
 | 
			
		||||
		while(matcher.find()){
 | 
			
		||||
			String token = matcher.group(1);
 | 
			
		||||
			String[] args = StringUtils.split(matcher.group(2), ',');
 | 
			
		||||
			
 | 
			
		||||
			String result = null;
 | 
			
		||||
			
 | 
			
		||||
			try{
 | 
			
		||||
				result = TitleTokens.getTokenFunction(token).apply(args == null ? ArrayUtils.EMPTY_STRING_ARRAY : args);
 | 
			
		||||
			}catch(TokenException e){
 | 
			
		||||
				logger.warn("Error processing token '" + token + "': " + e.getMessage());
 | 
			
		||||
			}catch(Throwable t){
 | 
			
		||||
				logger.warn("Error processing token '" + token + "': " + t.getMessage(), t);
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			if (result == null){
 | 
			
		||||
				matcher.appendReplacement(buffer, input.substring(matcher.start(), matcher.end()));
 | 
			
		||||
			}
 | 
			
		||||
			else{
 | 
			
		||||
				matcher.appendReplacement(buffer, result);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		matcher.appendTail(buffer);
 | 
			
		||||
		return buffer.toString();
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Static class
 | 
			
		||||
	
 | 
			
		||||
	private TitleParser(){}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,43 +0,0 @@
 | 
			
		||||
package chylex.customwindowtitle;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.function.Function;
 | 
			
		||||
import java.util.function.Supplier;
 | 
			
		||||
import java.util.function.UnaryOperator;
 | 
			
		||||
 | 
			
		||||
public final class TitleTokens{
 | 
			
		||||
	
 | 
			
		||||
	// Registry
 | 
			
		||||
	
 | 
			
		||||
	private static final Map<String, Function<String[], String>> tokenMap = new HashMap<>();
 | 
			
		||||
	
 | 
			
		||||
	public static void registerToken(String token, Function<String[], String> processor){
 | 
			
		||||
		tokenMap.putIfAbsent(token, processor);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static Function<String[], String> getTokenFunction(String token){
 | 
			
		||||
		return tokenMap.getOrDefault(token, args -> null);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Arguments
 | 
			
		||||
	
 | 
			
		||||
	public static Function<String[], String> noArgs(Supplier<String> func){
 | 
			
		||||
		return args -> args.length > 0 ? fail("expected no arguments, got " + args.length) : func.get();
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static Function<String[], String> oneArg(UnaryOperator<String> func){
 | 
			
		||||
		return args -> args.length != 1 ? fail("expected 1 argument, got " + args.length) : func.apply(args[0]);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static Function<String[], String> rangeArgs(int min, int max, Function<String[], String> func){
 | 
			
		||||
		return args -> args.length < min || args.length > max ? fail("expected between " + min + " and " + max + " arguments, got " + args.length) : func.apply(args);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private static String fail(String message){
 | 
			
		||||
		throw new TokenException(message);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	// Static class
 | 
			
		||||
	
 | 
			
		||||
	private TitleTokens(){}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
package chylex.customwindowtitle;
 | 
			
		||||
 | 
			
		||||
public class TokenException extends RuntimeException{
 | 
			
		||||
	public TokenException(String message){
 | 
			
		||||
		super(message);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,49 +0,0 @@
 | 
			
		||||
package chylex.customwindowtitle.fabric;
 | 
			
		||||
import chylex.customwindowtitle.TitleParser;
 | 
			
		||||
import net.fabricmc.api.ClientModInitializer;
 | 
			
		||||
import net.fabricmc.loader.api.FabricLoader;
 | 
			
		||||
import net.minecraft.client.MinecraftClient;
 | 
			
		||||
import org.apache.commons.lang3.StringUtils;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.nio.charset.StandardCharsets;
 | 
			
		||||
import java.nio.file.Files;
 | 
			
		||||
import java.nio.file.Path;
 | 
			
		||||
import java.nio.file.Paths;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
 | 
			
		||||
public class CustomWindowTitle implements ClientModInitializer{
 | 
			
		||||
	private static final String defaultTitle = "Minecraft {mcversion}";
 | 
			
		||||
	private String configTitle;
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public void onInitializeClient(){
 | 
			
		||||
		Path configFile = Paths.get(FabricLoader.getInstance().getConfigDirectory().getAbsolutePath(), "customwindowtitle-client.toml");
 | 
			
		||||
		
 | 
			
		||||
		try{
 | 
			
		||||
			String prefix = "title = ";
 | 
			
		||||
			
 | 
			
		||||
			if (!Files.exists(configFile)){
 | 
			
		||||
				Files.write(configFile, Collections.singletonList(prefix + '"' + defaultTitle + '"'), StandardCharsets.UTF_8);
 | 
			
		||||
				configTitle = defaultTitle;
 | 
			
		||||
			}
 | 
			
		||||
			else{
 | 
			
		||||
				configTitle = Files
 | 
			
		||||
					.readAllLines(configFile, StandardCharsets.UTF_8)
 | 
			
		||||
					.stream()
 | 
			
		||||
					.filter(line -> line.startsWith(prefix))
 | 
			
		||||
					.map(line -> StringUtils.strip(StringUtils.removeStart(line, prefix).trim(), "\""))
 | 
			
		||||
					.findFirst()
 | 
			
		||||
					.orElse(defaultTitle);
 | 
			
		||||
			}
 | 
			
		||||
		}catch(IOException e){
 | 
			
		||||
			throw new RuntimeException("CustomWindowTitle configuration error", e);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		TokenData.register();
 | 
			
		||||
		MinecraftClient.getInstance().execute(this::updateTitle);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private void updateTitle(){
 | 
			
		||||
		MinecraftClient.getInstance().getWindow().setTitle(TitleParser.parse(configTitle));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,22 +0,0 @@
 | 
			
		||||
package chylex.customwindowtitle.fabric;
 | 
			
		||||
import chylex.customwindowtitle.TokenException;
 | 
			
		||||
import net.fabricmc.loader.api.FabricLoader;
 | 
			
		||||
import net.minecraft.SharedConstants;
 | 
			
		||||
import static chylex.customwindowtitle.TitleTokens.noArgs;
 | 
			
		||||
import static chylex.customwindowtitle.TitleTokens.oneArg;
 | 
			
		||||
import static chylex.customwindowtitle.TitleTokens.registerToken;
 | 
			
		||||
 | 
			
		||||
final class TokenData{
 | 
			
		||||
	static void register(){
 | 
			
		||||
		registerToken("mcversion", noArgs(TokenData::getMinecraftVersion));
 | 
			
		||||
		registerToken("modversion", oneArg(TokenData::getModVersion));
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	static String getMinecraftVersion(){
 | 
			
		||||
		return SharedConstants.getGameVersion().getName();
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	static String getModVersion(String modId){
 | 
			
		||||
		return FabricLoader.getInstance().getModContainer(modId).orElseThrow(() -> new TokenException("mod info for '" + modId + "' not found")).getMetadata().getVersion().getFriendlyString();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,14 +0,0 @@
 | 
			
		||||
package chylex.customwindowtitle.fabric.mixin;
 | 
			
		||||
import net.minecraft.client.MinecraftClient;
 | 
			
		||||
import org.spongepowered.asm.mixin.Mixin;
 | 
			
		||||
import org.spongepowered.asm.mixin.injection.At;
 | 
			
		||||
import org.spongepowered.asm.mixin.injection.Inject;
 | 
			
		||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 | 
			
		||||
 | 
			
		||||
@Mixin(MinecraftClient.class)
 | 
			
		||||
public final class DisableVanillaTitle{
 | 
			
		||||
	@Inject(method = "updateWindowTitle()V", at = @At("HEAD"), cancellable = true)
 | 
			
		||||
	private void updateTitle(CallbackInfo info){
 | 
			
		||||
		info.cancel();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,32 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "schemaVersion": 1,
 | 
			
		||||
  "id": "customwindowtitle",
 | 
			
		||||
  "version": "${version}",
 | 
			
		||||
 | 
			
		||||
  "name": "Custom Window Title",
 | 
			
		||||
  "authors": [
 | 
			
		||||
    "chylex"
 | 
			
		||||
  ],
 | 
			
		||||
  "contact": {
 | 
			
		||||
    "homepage": "https://chylex.com",
 | 
			
		||||
    "sources": "https://github.com/chylex/Minecraft-Window-Title",
 | 
			
		||||
    "issues": "https://github.com/chylex/Minecraft-Window-Title/issues"
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  "license": "Unlicense",
 | 
			
		||||
 | 
			
		||||
  "environment": "client",
 | 
			
		||||
  "entrypoints": {
 | 
			
		||||
    "client": [
 | 
			
		||||
      "chylex.customwindowtitle.fabric.CustomWindowTitle"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  "mixins": [
 | 
			
		||||
    "mixins.json"
 | 
			
		||||
  ],
 | 
			
		||||
 | 
			
		||||
  "depends": {
 | 
			
		||||
    "fabricloader": ">=0.7.2",
 | 
			
		||||
    "minecraft": "1.15.x"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,13 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "required": true,
 | 
			
		||||
  "package": "chylex.customwindowtitle.fabric.mixin",
 | 
			
		||||
  "compatibilityLevel": "JAVA_8",
 | 
			
		||||
  "mixins": [
 | 
			
		||||
  ],
 | 
			
		||||
  "client": [
 | 
			
		||||
    "DisableVanillaTitle"
 | 
			
		||||
  ],
 | 
			
		||||
  "injectors": {
 | 
			
		||||
    "defaultRequire": 1
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -2,26 +2,20 @@ buildscript{
 | 
			
		||||
    repositories{
 | 
			
		||||
        maven{ url = 'https://files.minecraftforge.net/maven' }
 | 
			
		||||
        jcenter()
 | 
			
		||||
        mavenCentral()
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    dependencies{
 | 
			
		||||
        classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
 | 
			
		||||
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
apply plugin: 'net.minecraftforge.gradle'
 | 
			
		||||
apply plugin: 'eclipse'
 | 
			
		||||
apply plugin: 'net.minecraftforge.gradle.forge'
 | 
			
		||||
 | 
			
		||||
def mcversion = "1.15.2"
 | 
			
		||||
def forgeversion = "31.0.14"
 | 
			
		||||
def mcversion = "1.12.2"
 | 
			
		||||
def forgeversion = "14.23.5.2847"
 | 
			
		||||
 | 
			
		||||
def prefixName = 'displayName = '
 | 
			
		||||
def prefixVersion = 'version = '
 | 
			
		||||
 | 
			
		||||
def metaLines = file('src/main/resources/META-INF/mods.toml').readLines()
 | 
			
		||||
def metaName = metaLines.find { line -> line.startsWith(prefixName) }.substring(prefixName.length())[1..-2]
 | 
			
		||||
def metaVersion = metaLines.find { line -> line.startsWith(prefixVersion) }.substring(prefixVersion.length())[1..-2]
 | 
			
		||||
def metaName = "Custom Window Title"
 | 
			
		||||
def metaVersion = "1.0.0"
 | 
			
		||||
 | 
			
		||||
group = 'chylex.customwindowtitle.forge'
 | 
			
		||||
version = metaVersion
 | 
			
		||||
@@ -30,53 +24,16 @@ archivesBaseName = metaName.replaceAll('\\s', '')
 | 
			
		||||
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
 | 
			
		||||
 | 
			
		||||
minecraft{
 | 
			
		||||
    mappings channel: 'snapshot', version: '20200130-1.15.1'
 | 
			
		||||
 | 
			
		||||
    runs{
 | 
			
		||||
        client{
 | 
			
		||||
            workingDirectory file('run')
 | 
			
		||||
 | 
			
		||||
            mods{
 | 
			
		||||
                customwindowtitle{
 | 
			
		||||
                    source sourceSets.main
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        server{
 | 
			
		||||
            workingDirectory file('run')
 | 
			
		||||
 | 
			
		||||
            mods{
 | 
			
		||||
                customwindowtitle{
 | 
			
		||||
                    source sourceSets.main
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
dependencies{
 | 
			
		||||
    minecraft 'net.minecraftforge:forge:' + mcversion + '-' + forgeversion
 | 
			
		||||
    version = mcversion + '-' + forgeversion
 | 
			
		||||
    runDir = "run"
 | 
			
		||||
    mappings = "snapshot_20180814"
 | 
			
		||||
    makeObfSourceJar = false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
jar{
 | 
			
		||||
    archiveName = archivesBaseName + '-' + mcversion + '-v' + version + '.jar'
 | 
			
		||||
    archiveName = archivesBaseName + '-Legacy-v' + version + '.jar'
 | 
			
		||||
 | 
			
		||||
    from('../'){
 | 
			
		||||
        include 'LICENSE'
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    manifest{
 | 
			
		||||
        attributes([
 | 
			
		||||
                'Specification-Title'  : 'customwindowtitle',
 | 
			
		||||
                'Specification-Version': '1',
 | 
			
		||||
                'Specification-Vendor' : 'chylex',
 | 
			
		||||
 | 
			
		||||
                'Implementation-Title'  : metaName,
 | 
			
		||||
                'Implementation-Version': metaVersion,
 | 
			
		||||
                'Implementation-Vendor' : 'chylex',
 | 
			
		||||
 | 
			
		||||
                'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
 | 
			
		||||
        ])
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,36 +1,51 @@
 | 
			
		||||
package chylex.customwindowtitle.forge;
 | 
			
		||||
import chylex.customwindowtitle.TitleParser;
 | 
			
		||||
import net.minecraft.client.Minecraft;
 | 
			
		||||
import net.minecraftforge.common.ForgeConfigSpec;
 | 
			
		||||
import net.minecraftforge.common.ForgeConfigSpec.ConfigValue;
 | 
			
		||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
 | 
			
		||||
import net.minecraftforge.fml.ModLoadingContext;
 | 
			
		||||
import net.minecraftforge.fml.common.Mod;
 | 
			
		||||
import net.minecraftforge.fml.config.ModConfig.Type;
 | 
			
		||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
 | 
			
		||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
 | 
			
		||||
import net.minecraftforge.fml.common.Mod.EventHandler;
 | 
			
		||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
 | 
			
		||||
import org.apache.commons.lang3.StringUtils;
 | 
			
		||||
import org.lwjgl.opengl.Display;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.nio.charset.StandardCharsets;
 | 
			
		||||
import java.nio.file.Files;
 | 
			
		||||
import java.nio.file.Path;
 | 
			
		||||
import java.nio.file.Paths;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
 | 
			
		||||
@Mod("customwindowtitle")
 | 
			
		||||
@Mod(modid = "customwindowtitle", useMetadata = true, clientSideOnly = true, acceptedMinecraftVersions = "*", acceptableRemoteVersions = "*")
 | 
			
		||||
public class CustomWindowTitle{
 | 
			
		||||
	private final ConfigValue<String> configTitle;
 | 
			
		||||
	private static final String defaultTitle = "Minecraft {mcversion}";
 | 
			
		||||
	private String configTitle;
 | 
			
		||||
	
 | 
			
		||||
	public CustomWindowTitle(){
 | 
			
		||||
		ForgeConfigSpec.Builder configBuilder = new ForgeConfigSpec.Builder();
 | 
			
		||||
	@EventHandler
 | 
			
		||||
	public void onPreInit(FMLPreInitializationEvent e){
 | 
			
		||||
		Path configFile = Paths.get(e.getModConfigurationDirectory().getAbsolutePath(), "customwindowtitle-client.toml");
 | 
			
		||||
		
 | 
			
		||||
		configTitle = configBuilder.define("title", "Minecraft {mcversion}");
 | 
			
		||||
		
 | 
			
		||||
		ModLoadingContext.get().registerConfig(Type.CLIENT, configBuilder.build());
 | 
			
		||||
		FMLJavaModLoadingContext.get().getModEventBus().register(this);
 | 
			
		||||
		try{
 | 
			
		||||
			String prefix = "title = ";
 | 
			
		||||
			
 | 
			
		||||
			if (!Files.exists(configFile)){
 | 
			
		||||
				Files.write(configFile, Collections.singletonList(prefix + '"' + defaultTitle + '"'), StandardCharsets.UTF_8);
 | 
			
		||||
				configTitle = defaultTitle;
 | 
			
		||||
			}
 | 
			
		||||
			else{
 | 
			
		||||
				configTitle = Files
 | 
			
		||||
					.readAllLines(configFile, StandardCharsets.UTF_8)
 | 
			
		||||
					.stream()
 | 
			
		||||
					.filter(line -> line.startsWith(prefix))
 | 
			
		||||
					.map(line -> StringUtils.strip(StringUtils.removeStart(line, prefix).trim(), "\""))
 | 
			
		||||
					.findFirst()
 | 
			
		||||
					.orElse(defaultTitle);
 | 
			
		||||
			}
 | 
			
		||||
		}catch(IOException ex){
 | 
			
		||||
			throw new RuntimeException("CustomWindowTitle configuration error", ex);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		TokenData.register();
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@SubscribeEvent
 | 
			
		||||
	public void onClientSetup(FMLClientSetupEvent e){
 | 
			
		||||
		e.getMinecraftSupplier().get().execute(this::updateTitle);
 | 
			
		||||
		updateTitle();
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	private void updateTitle(){
 | 
			
		||||
		Minecraft.getInstance().getMainWindow().func_230148_b_(TitleParser.parse(configTitle.get()));
 | 
			
		||||
		Display.setTitle(TitleParser.parse(configTitle));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,8 @@
 | 
			
		||||
package chylex.customwindowtitle.forge;
 | 
			
		||||
import chylex.customwindowtitle.TokenException;
 | 
			
		||||
import net.minecraft.util.SharedConstants;
 | 
			
		||||
import net.minecraftforge.fml.ModList;
 | 
			
		||||
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
 | 
			
		||||
import net.minecraftforge.forgespi.language.IModInfo;
 | 
			
		||||
import net.minecraft.realms.RealmsSharedConstants;
 | 
			
		||||
import net.minecraftforge.fml.common.Loader;
 | 
			
		||||
import net.minecraftforge.fml.common.ModContainer;
 | 
			
		||||
import static chylex.customwindowtitle.TitleTokens.noArgs;
 | 
			
		||||
import static chylex.customwindowtitle.TitleTokens.oneArg;
 | 
			
		||||
import static chylex.customwindowtitle.TitleTokens.registerToken;
 | 
			
		||||
@@ -15,22 +14,16 @@ final class TokenData{
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	static String getMinecraftVersion(){
 | 
			
		||||
		return SharedConstants.getVersion().getName();
 | 
			
		||||
		return RealmsSharedConstants.VERSION_STRING;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	static String getModVersion(String modId){
 | 
			
		||||
		ModFileInfo file = ModList.get().getModFileById(modId);
 | 
			
		||||
		ModContainer mod = Loader.instance().getIndexedModList().get(modId);
 | 
			
		||||
		
 | 
			
		||||
		if (file == null){
 | 
			
		||||
			throw new TokenException("mod file for '" + modId + "' not found");
 | 
			
		||||
		if (mod == null){
 | 
			
		||||
			throw new TokenException("mod info for '" + modId + "' not found");
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		for(IModInfo info : file.getMods()){
 | 
			
		||||
			if (info.getModId().equals(modId)){
 | 
			
		||||
				return info.getVersion().toString();
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		throw new TokenException("mod info for '" + modId + "' not found");
 | 
			
		||||
		return mod.getMetadata().version;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "CustomWindowTitle": "coremods/main.js"
 | 
			
		||||
}
 | 
			
		||||
@@ -1,25 +0,0 @@
 | 
			
		||||
modLoader = "javafml"
 | 
			
		||||
loaderVersion = "[31,)"
 | 
			
		||||
 | 
			
		||||
authors = "chylex"
 | 
			
		||||
issueTrackerURL = "https://github.com/chylex/Minecraft-Window-Title/issues"
 | 
			
		||||
 | 
			
		||||
[[mods]]
 | 
			
		||||
modId = "customwindowtitle"
 | 
			
		||||
version = "1.0.0"
 | 
			
		||||
displayName = "Custom Window Title"
 | 
			
		||||
displayURL = "https://github.com/chylex/Minecraft-Window-Title"
 | 
			
		||||
 | 
			
		||||
[[dependencies.customwindowtitle]]
 | 
			
		||||
    modId = "minecraft"
 | 
			
		||||
    mandatory = true
 | 
			
		||||
    versionRange = "[1.15.2,)"
 | 
			
		||||
    ordering = "NONE"
 | 
			
		||||
    side = "CLIENT"
 | 
			
		||||
 | 
			
		||||
[[dependencies.customwindowtitle]]
 | 
			
		||||
    modId = "forge"
 | 
			
		||||
    mandatory = true
 | 
			
		||||
    versionRange = "[31,)"
 | 
			
		||||
    ordering = "NONE"
 | 
			
		||||
    side = "CLIENT"
 | 
			
		||||
@@ -1,19 +0,0 @@
 | 
			
		||||
function initializeCoreMod(){
 | 
			
		||||
    var opcodes = Java.type("org.objectweb.asm.Opcodes");
 | 
			
		||||
    var InsnNode = Java.type("org.objectweb.asm.tree.InsnNode");
 | 
			
		||||
 | 
			
		||||
    return {
 | 
			
		||||
        "CustomWindowTitle": {
 | 
			
		||||
            "target": {
 | 
			
		||||
                "type": "METHOD",
 | 
			
		||||
                "class": "net.minecraft.client.Minecraft",
 | 
			
		||||
                "methodName": "func_230150_b_",
 | 
			
		||||
                "methodDesc": "()V"
 | 
			
		||||
            },
 | 
			
		||||
            "transformer": function(methodNode){
 | 
			
		||||
                methodNode.instructions.insert(new InsnNode(opcodes.RETURN));
 | 
			
		||||
                return methodNode;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										10
									
								
								Forge/src/main/resources/mcmod.info
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Forge/src/main/resources/mcmod.info
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
[
 | 
			
		||||
{
 | 
			
		||||
  "modid": "customwindowtitle",
 | 
			
		||||
  "name": "Custom Window Title",
 | 
			
		||||
  "description": "",
 | 
			
		||||
  "version": "1.0.0",
 | 
			
		||||
  "url": "https://github.com/chylex/Minecraft-Window-Title",
 | 
			
		||||
  "authorList": ["chylex"]
 | 
			
		||||
}
 | 
			
		||||
]
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
    "pack": {
 | 
			
		||||
        "description": "Custom Window Title",
 | 
			
		||||
        "pack_format": 5,
 | 
			
		||||
        "pack_format": 3,
 | 
			
		||||
        "_comment": ""
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user