diff --git a/.gitignore b/.gitignore index 0ed4653..3e6f67f 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,9 @@ build # other eclipse run +runs /**/mcmodsrepo/ /obfuscation/fg7/repo/ -/_internal/fg7/test-repo/ +/obfuscation/fg7-kotlin/repo/ +/_internal/test-repo/ diff --git a/_internal/fg7/build.gradle b/_internal/fg7/build.gradle index 87fa52d..56dd601 100644 --- a/_internal/fg7/build.gradle +++ b/_internal/fg7/build.gradle @@ -11,16 +11,20 @@ tasks.named('buildEnvironment') { tasks.register('updateBuilds') { subprojects.each { sub -> - def lines = sub.file('build.gradle').readLines() + def file = sub.file('build.gradle') + if (!file.exists()) file = sub.file('build.gradle.kts') + def lines = file.readLines() lines = lines.collect { line -> for (def plugin : gradle.ext.pluginVersions) { // Yes this is hacky string match, but we just need to keep the structure sane if (line.contains(" id '${plugin.id}' version '")) return " id '${plugin.id}' version '${plugin.version}'" + if (line.contains(" id(\"${plugin.id}\") version \"")) + return " id(\"${plugin.id}\") version \"${plugin.version}\"" return line } } - sub.file('build.gradle').text = lines.join('\n') + '\n' // New line at the end + file.text = lines.join('\n') + '\n' // New line at the end } } diff --git a/_internal/fg7/gradle/wrapper/gradle-wrapper.properties b/_internal/fg7/gradle/wrapper/gradle-wrapper.properties index 19a6bde..37f78a6 100644 --- a/_internal/fg7/gradle/wrapper/gradle-wrapper.properties +++ b/_internal/fg7/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/_internal/readme.md b/_internal/fg7/readme.md similarity index 100% rename from _internal/readme.md rename to _internal/fg7/readme.md diff --git a/_internal/fg7/settings.gradle b/_internal/fg7/settings.gradle index e75940f..73f7543 100644 --- a/_internal/fg7/settings.gradle +++ b/_internal/fg7/settings.gradle @@ -3,9 +3,10 @@ pluginManagement { // This is done to make debugging those projects easier. def root = new File("${settingsDir}/../../../").canonicalFile gradle.ext.pluginVersions = [ - [version: '7.0.0-rc.5', id: 'net.minecraftforge.gradle', paths: ['ForgeGradle', 'ForgeGradle7']], + [version: '[7.0.11,8.0)', id: 'net.minecraftforge.gradle', paths: ['ForgeGradle', 'ForgeGradle7']], [version: '5.0.3', id: 'net.minecraftforge.accesstransformers', paths: ['AccessTransformers/at-gradle']], [version: '0.2.3', id: 'net.minecraftforge.jarjar', paths: ['JarJar/jarjar-gradle']], + [version: '1.0.2', id: 'net.minecraftforge.renamer', paths: ['renamer/renamer-gradle']], ] gradle.ext.pluginVersions.each { candidate -> @@ -38,11 +39,15 @@ rootProject.name = 'mdkexamples' def children = [ [name: 'accesstransformers-only', path: 'accesstransformers-only/fg7'], + [name: 'accesstransformers-only-kotlin', path: 'accesstransformers-only/fg7-kotlin'], [name: 'jarjar-only', path: 'jarjar-only/fg7'], + [name: 'jarjar-only-kotlin', path: 'jarjar-only/fg7-kotlin'], [name: 'traditional-mdk', path: 'traditional-mdk/fg7'], - // TODO [MDKExamples] Add tests for Kotlin examples - //[name: 'traditional-mdk', path: 'traditional-mdk/fg7-kotlin'], + [name: 'traditional-mdk-kotlin', path: 'traditional-mdk/fg7-kotlin'], [name: 'mixins-only', path: 'mixins-only/fg7'], + [name: 'mixins-only-kotlin', path: 'mixins-only/fg7-kotlin'], + [name: 'obfuscation', path: 'obfuscation/fg7'], + [name: 'obfuscation-kotlin', path: 'obfuscation/fg7-kotlin'] ] for (def child : children) { diff --git a/accesstransformers-only/fg7-kotlin/build.gradle.kts b/accesstransformers-only/fg7-kotlin/build.gradle.kts new file mode 100644 index 0000000..937e54f --- /dev/null +++ b/accesstransformers-only/fg7-kotlin/build.gradle.kts @@ -0,0 +1,62 @@ +// TODO [MDKExamples] This Kotlin buildscript is still very experimental. I am very new to Kotlin +// I welcome suggestions with open arms. + +plugins { + id("java") + id("idea") + id("eclipse") + id("maven-publish") + id("net.minecraftforge.gradle") version "[7.0.11,8.0)" +} + +val minecraft_version: String by project +val forge_version: String by project +val mod_id: String by project + +version = "1.0" +group = "net.minecraftforge" +base.archivesName = mod_id + +java.toolchain.languageVersion = JavaLanguageVersion.of(21) + +minecraft { + /* + * This is a magic helper flag, it will enable access transformers on any + * minecraft dependencies and look in all sourcesets for a file with + * the path: META-INF/accesstransformer.cfg + * It also enables some error messages when the file can not be found, to help users + * who are using the most default case. + */ + useDefaultAccessTransformer() + /* If you wish to support multiple access transformer files, + * or use the non-standard path, you can specify them directly like this. + * Note: Forge 1.20.11-61.0.10+ required for multiple/configurable files. + */ + //accessTransformers = files("src/main/resources/META-INF/accesstransformer.cfg") + + mappings("official", "1.21.11") + runs { + configureEach { + workingDir.convention(layout.projectDirectory.dir("run")) + } + register("client") + } +} + +repositories { + minecraft.mavenizer(this) + maven (fg.forgeMaven) + maven (fg.minecraftLibsMaven) + mavenCentral() +} + +dependencies { + // This will automatically have the transformer applied because we used minecraft.accessTransformers + implementation (minecraft.dependency("net.minecraftforge:forge:$minecraft_version-$forge_version")) + + annotationProcessor ("net.minecraftforge:eventbus-validator:7.0.1") +} + +tasks.withType().configureEach { + options.encoding = "UTF-8" // Use the UTF-8 charset for Java compilation +} diff --git a/accesstransformers-only/fg7-kotlin/gradle.properties b/accesstransformers-only/fg7-kotlin/gradle.properties new file mode 100644 index 0000000..be8ea39 --- /dev/null +++ b/accesstransformers-only/fg7-kotlin/gradle.properties @@ -0,0 +1,15 @@ +org.gradle.caching=true +org.gradle.parallel=true +org.gradle.configureondemand=true + +org.gradle.configuration-cache=true +org.gradle.configuration-cache.parallel=true +org.gradle.configuration-cache.problems=warn + +net.minecraftforge.gradle.merge-source-sets=true + +## Environment Properties + +minecraft_version=1.21.11 +forge_version=61.1.1 +mod_id=examplemod diff --git a/accesstransformers-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.jar b/accesstransformers-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..61285a6 Binary files /dev/null and b/accesstransformers-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.jar differ diff --git a/accesstransformers-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.properties b/accesstransformers-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..37f78a6 --- /dev/null +++ b/accesstransformers-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/accesstransformers-only/fg7-kotlin/gradlew b/accesstransformers-only/fg7-kotlin/gradlew new file mode 100644 index 0000000..adff685 --- /dev/null +++ b/accesstransformers-only/fg7-kotlin/gradlew @@ -0,0 +1,248 @@ +#!/bin/sh + +# +# Copyright © 2015 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. +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# 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 + +# Resolve links: $0 may be a link +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 + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +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 ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + + + +# 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 + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# 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. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + + 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 + + +# 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, 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" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# 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" "$@" diff --git a/accesstransformers-only/fg7-kotlin/gradlew.bat b/accesstransformers-only/fg7-kotlin/gradlew.bat new file mode 100644 index 0000000..c4bdd3a --- /dev/null +++ b/accesstransformers-only/fg7-kotlin/gradlew.bat @@ -0,0 +1,93 @@ +@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 +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/accesstransformers-only/fg7-kotlin/settings.gradle.kts b/accesstransformers-only/fg7-kotlin/settings.gradle.kts new file mode 100644 index 0000000..71a8a65 --- /dev/null +++ b/accesstransformers-only/fg7-kotlin/settings.gradle.kts @@ -0,0 +1,5 @@ +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" +} + +rootProject.name = "mdkexamples-accesstransformers-fg7-kotlin" diff --git a/accesstransformers-only/fg7-kotlin/src/main/java/net/minecraftforge/example/ExampleMod.java b/accesstransformers-only/fg7-kotlin/src/main/java/net/minecraftforge/example/ExampleMod.java new file mode 100644 index 0000000..f456b32 --- /dev/null +++ b/accesstransformers-only/fg7-kotlin/src/main/java/net/minecraftforge/example/ExampleMod.java @@ -0,0 +1,12 @@ +package net.minecraftforge.example; + +import net.minecraft.client.Minecraft; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; + +@Mod("examplemod") +public final class ExampleMod { + public ExampleMod(FMLJavaModLoadingContext context) { + Minecraft.LOGGER.info("Able to access a private field"); + } +} diff --git a/accesstransformers-only/fg7-kotlin/src/main/resources/META-INF/accesstransformer.cfg b/accesstransformers-only/fg7-kotlin/src/main/resources/META-INF/accesstransformer.cfg new file mode 100644 index 0000000..a022afa --- /dev/null +++ b/accesstransformers-only/fg7-kotlin/src/main/resources/META-INF/accesstransformer.cfg @@ -0,0 +1 @@ +public net.minecraft.client.Minecraft LOGGER \ No newline at end of file diff --git a/accesstransformers-only/fg7-kotlin/src/main/resources/META-INF/mods.toml b/accesstransformers-only/fg7-kotlin/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..0850604 --- /dev/null +++ b/accesstransformers-only/fg7-kotlin/src/main/resources/META-INF/mods.toml @@ -0,0 +1,18 @@ +modLoader="javafml" +loaderVersion="[0,)" +license="license" + +[[mods]] +modId="examplemod" +version="0" +displayName="example" + +# Access Transformers +# Optional, if not specified Forge will attempt to find the default META-INF/accesstransformer.cfg and silently continue if not found. May default to an empty list in a future MC. +# If you specify AT path strings in this list, Forge will attempt to load each of them and throw errors for any that aren't found. +# Specifying an empty list when your mod has no ATs is recommended to opt-out of the default for slightly better loading performance. +# This config option is only supported on Forge 1.21.11-61.0.10. So if you use it, you should also add a dependency constraint on that Forge version. +#accessTransformers = [ +# "META-INF/accesstransformer.cfg" +#] + diff --git a/accesstransformers-only/fg7/build.gradle b/accesstransformers-only/fg7/build.gradle index 6f29cd3..bbb75b5 100644 --- a/accesstransformers-only/fg7/build.gradle +++ b/accesstransformers-only/fg7/build.gradle @@ -3,7 +3,7 @@ plugins { id 'idea' id 'eclipse' id 'maven-publish' - id 'net.minecraftforge.gradle' version '[7.0.2,8.0)' + id 'net.minecraftforge.gradle' version '[7.0.11,8.0)' } version = '1.0' @@ -47,7 +47,7 @@ dependencies { // This will automatically have the transformer applied because we used minecraft.accessTransformers implementation minecraft.dependency("net.minecraftforge:forge:$minecraft_version-$forge_version") - annotationProcessor 'net.minecraftforge:eventbus-validator:7.0-beta.10' + annotationProcessor 'net.minecraftforge:eventbus-validator:7.0.1' } tasks.withType(JavaCompile).configureEach { diff --git a/accesstransformers-only/fg7/gradle.properties b/accesstransformers-only/fg7/gradle.properties index 92e1b0e..be8ea39 100644 --- a/accesstransformers-only/fg7/gradle.properties +++ b/accesstransformers-only/fg7/gradle.properties @@ -11,5 +11,5 @@ net.minecraftforge.gradle.merge-source-sets=true ## Environment Properties minecraft_version=1.21.11 -forge_version=61.0.2 +forge_version=61.1.1 mod_id=examplemod diff --git a/accesstransformers-only/fg7/gradle/wrapper/gradle-wrapper.properties b/accesstransformers-only/fg7/gradle/wrapper/gradle-wrapper.properties index 19a6bde..37f78a6 100644 --- a/accesstransformers-only/fg7/gradle/wrapper/gradle-wrapper.properties +++ b/accesstransformers-only/fg7/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/jarjar-only/fg7-kotlin/build.gradle.kts b/jarjar-only/fg7-kotlin/build.gradle.kts new file mode 100644 index 0000000..e35499e --- /dev/null +++ b/jarjar-only/fg7-kotlin/build.gradle.kts @@ -0,0 +1,63 @@ +// TODO [MDKExamples] This Kotlin buildscript is still very experimental. I am very new to Kotlin +// I welcome suggestions with open arms. + +import net.minecraftforge.jarjar.gradle.JarJarDependencyMethods + +plugins { + id("java") + id("idea") + id("eclipse") + id("maven-publish") + id("net.minecraftforge.gradle") version "[7.0.11,8.0)" + id("net.minecraftforge.jarjar") version "0.2.3" +} + +val minecraft_version: String by project +val forge_version: String by project +val mod_id: String by project + +version = "1.0" +group = "net.minecraftforge" +base.archivesName = mod_id + +java.toolchain.languageVersion = JavaLanguageVersion.of(21) + +minecraft { + mappings("official", "1.21.11") + runs.register("client") +} + +repositories { + minecraft.mavenizer(this) + maven(fg.forgeMaven) + maven(fg.minecraftLibsMaven) + mavenCentral() +} + +// Creates the jarJar configuration. +// This creates the 'jarJar' task, which by default has a classifier of 'all', with a base of the 'jar' task +// For more info see https://github.com/MinecraftForge/JarJar/blob/main/jarjar-gradle/src/main/java/net/minecraftforge/jarjar/gradle/JarJarExtension.java +jarJar.register() { + archiveClassifier = null +} + +// If you want to have your "normal" jar the 'all' jar, you can change the classifer using normal gradle configuration +tasks.named("jar") { + archiveClassifier = "slim" +} + +dependencies { + implementation(minecraft.dependency("net.minecraftforge:forge:$minecraft_version-$forge_version")) + + "jarJar"("org.apache.maven:maven-artifact:3.9.11") { + jarJar.configure(this) { + // This tells that we do NOT ship this library, but we depend on a specific version + // For more info see https://github.com/MinecraftForge/JarJar/blob/main/jarjar-gradle/src/main/java/net/minecraftforge/jarjar/gradle/JarJarMetadataInfo.java + setConstraint(true) + setVersion("3.9.11") + } + } + + // This will bundle the jar and set the constraints to [0.5.0,) + "jarJar"("io.github.llamalad7:mixinextras-forge:0.5.0") +} diff --git a/jarjar-only/fg7-kotlin/gradle.properties b/jarjar-only/fg7-kotlin/gradle.properties new file mode 100644 index 0000000..be8ea39 --- /dev/null +++ b/jarjar-only/fg7-kotlin/gradle.properties @@ -0,0 +1,15 @@ +org.gradle.caching=true +org.gradle.parallel=true +org.gradle.configureondemand=true + +org.gradle.configuration-cache=true +org.gradle.configuration-cache.parallel=true +org.gradle.configuration-cache.problems=warn + +net.minecraftforge.gradle.merge-source-sets=true + +## Environment Properties + +minecraft_version=1.21.11 +forge_version=61.1.1 +mod_id=examplemod diff --git a/jarjar-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.jar b/jarjar-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..61285a6 Binary files /dev/null and b/jarjar-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.jar differ diff --git a/jarjar-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.properties b/jarjar-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..37f78a6 --- /dev/null +++ b/jarjar-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/jarjar-only/fg7-kotlin/gradlew b/jarjar-only/fg7-kotlin/gradlew new file mode 100644 index 0000000..adff685 --- /dev/null +++ b/jarjar-only/fg7-kotlin/gradlew @@ -0,0 +1,248 @@ +#!/bin/sh + +# +# Copyright © 2015 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. +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# 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 + +# Resolve links: $0 may be a link +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 + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +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 ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + + + +# 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 + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# 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. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + + 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 + + +# 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, 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" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# 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" "$@" diff --git a/jarjar-only/fg7-kotlin/gradlew.bat b/jarjar-only/fg7-kotlin/gradlew.bat new file mode 100644 index 0000000..c4bdd3a --- /dev/null +++ b/jarjar-only/fg7-kotlin/gradlew.bat @@ -0,0 +1,93 @@ +@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 +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/jarjar-only/fg7-kotlin/settings.gradle.kts b/jarjar-only/fg7-kotlin/settings.gradle.kts new file mode 100644 index 0000000..e7a82ff --- /dev/null +++ b/jarjar-only/fg7-kotlin/settings.gradle.kts @@ -0,0 +1,5 @@ +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" +} + +rootProject.name = "mdkexamples-jarjar-fg7-kotlin" diff --git a/jarjar-only/fg7-kotlin/src/main/java/net/minecraftforge/example/ExampleMod.java b/jarjar-only/fg7-kotlin/src/main/java/net/minecraftforge/example/ExampleMod.java new file mode 100644 index 0000000..957da0d --- /dev/null +++ b/jarjar-only/fg7-kotlin/src/main/java/net/minecraftforge/example/ExampleMod.java @@ -0,0 +1,10 @@ +package net.minecraftforge.example; + +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; + +@Mod("examplemod") +public final class ExampleMod { + public ExampleMod(FMLJavaModLoadingContext context) { + } +} diff --git a/jarjar-only/fg7-kotlin/src/main/resources/META-INF/mods.toml b/jarjar-only/fg7-kotlin/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..92cfe73 --- /dev/null +++ b/jarjar-only/fg7-kotlin/src/main/resources/META-INF/mods.toml @@ -0,0 +1,8 @@ +modLoader="javafml" +loaderVersion="[0,)" +license="license" + +[[mods]] +modId="examplemod" +version="0" +displayName="example" diff --git a/jarjar-only/fg7/build.gradle b/jarjar-only/fg7/build.gradle index b54de7e..5510860 100644 --- a/jarjar-only/fg7/build.gradle +++ b/jarjar-only/fg7/build.gradle @@ -3,7 +3,7 @@ plugins { id 'idea' id 'eclipse' id 'maven-publish' - id 'net.minecraftforge.gradle' version '[7.0.2,8.0)' + id 'net.minecraftforge.gradle' version '[7.0.11,8.0)' id 'net.minecraftforge.jarjar' version '0.2.3' } diff --git a/jarjar-only/fg7/gradle.properties b/jarjar-only/fg7/gradle.properties index 92e1b0e..be8ea39 100644 --- a/jarjar-only/fg7/gradle.properties +++ b/jarjar-only/fg7/gradle.properties @@ -11,5 +11,5 @@ net.minecraftforge.gradle.merge-source-sets=true ## Environment Properties minecraft_version=1.21.11 -forge_version=61.0.2 +forge_version=61.1.1 mod_id=examplemod diff --git a/jarjar-only/fg7/gradle/wrapper/gradle-wrapper.properties b/jarjar-only/fg7/gradle/wrapper/gradle-wrapper.properties index 19a6bde..37f78a6 100644 --- a/jarjar-only/fg7/gradle/wrapper/gradle-wrapper.properties +++ b/jarjar-only/fg7/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/mixins-only/fg7-kotlin/build.gradle.kts b/mixins-only/fg7-kotlin/build.gradle.kts new file mode 100644 index 0000000..2fcb2b2 --- /dev/null +++ b/mixins-only/fg7-kotlin/build.gradle.kts @@ -0,0 +1,57 @@ +// TODO [MDKExamples] This Kotlin buildscript is still very experimental. I am very new to Kotlin +// I welcome suggestions with open arms. + +plugins { + id("java") + id("idea") + id("eclipse") + id("maven-publish") + id("net.minecraftforge.gradle") version "[7.0.11,8.0)" +} + +val minecraft_version: String by project +val forge_version: String by project +val mod_id: String by project + +version = "1.0" +group = "net.minecraftforge" +base.archivesName = mod_id + +java.toolchain.languageVersion = JavaLanguageVersion.of(21) + +minecraft { + mappings("official", "1.21.11") + runs { + configureEach { + workingDir.convention(layout.projectDirectory.dir("run")) + // Mixin requires either specifying the config via command line, or in the Manifest + args("--mixin.config=${mod_id}.mixins.json") + } + register("client") { + systemProperty("forge.enabledGameTestNamespaces", mod_id) + } + } +} + +repositories { + minecraft.mavenizer(this) + maven(fg.forgeMaven) + maven(fg.minecraftLibsMaven) + mavenCentral() +} + +dependencies { + implementation(minecraft.dependency("net.minecraftforge:forge:$minecraft_version-$forge_version")) + annotationProcessor("net.minecraftforge:eventbus-validator:7.0.1") +} + +tasks.withType().configureEach { + options.encoding = "UTF-8" // Use the UTF-8 charset for Java compilation +} + +tasks.named("jar") { + manifest { + // Add our config to the manifest of our jar to have Mixin detect us at runtime. + attributes["MixinConfigs"] = "${mod_id}.mixins.json" + } +} diff --git a/mixins-only/fg7-kotlin/gradle.properties b/mixins-only/fg7-kotlin/gradle.properties new file mode 100644 index 0000000..be8ea39 --- /dev/null +++ b/mixins-only/fg7-kotlin/gradle.properties @@ -0,0 +1,15 @@ +org.gradle.caching=true +org.gradle.parallel=true +org.gradle.configureondemand=true + +org.gradle.configuration-cache=true +org.gradle.configuration-cache.parallel=true +org.gradle.configuration-cache.problems=warn + +net.minecraftforge.gradle.merge-source-sets=true + +## Environment Properties + +minecraft_version=1.21.11 +forge_version=61.1.1 +mod_id=examplemod diff --git a/mixins-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.jar b/mixins-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..61285a6 Binary files /dev/null and b/mixins-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.jar differ diff --git a/mixins-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.properties b/mixins-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..37f78a6 --- /dev/null +++ b/mixins-only/fg7-kotlin/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/mixins-only/fg7-kotlin/gradlew b/mixins-only/fg7-kotlin/gradlew new file mode 100644 index 0000000..adff685 --- /dev/null +++ b/mixins-only/fg7-kotlin/gradlew @@ -0,0 +1,248 @@ +#!/bin/sh + +# +# Copyright © 2015 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. +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# 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 + +# Resolve links: $0 may be a link +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 + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +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 ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + + + +# 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 + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# 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. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + + 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 + + +# 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, 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" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# 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" "$@" diff --git a/mixins-only/fg7-kotlin/gradlew.bat b/mixins-only/fg7-kotlin/gradlew.bat new file mode 100644 index 0000000..c4bdd3a --- /dev/null +++ b/mixins-only/fg7-kotlin/gradlew.bat @@ -0,0 +1,93 @@ +@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 +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/mixins-only/fg7-kotlin/settings.gradle.kts b/mixins-only/fg7-kotlin/settings.gradle.kts new file mode 100644 index 0000000..3c26dba --- /dev/null +++ b/mixins-only/fg7-kotlin/settings.gradle.kts @@ -0,0 +1,5 @@ +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" +} + +rootProject.name = "mdkexamples-mixins-fg7-kotlin" diff --git a/mixins-only/fg7-kotlin/src/main/java/net/minecraftforge/example/ExampleMod.java b/mixins-only/fg7-kotlin/src/main/java/net/minecraftforge/example/ExampleMod.java new file mode 100644 index 0000000..08526f8 --- /dev/null +++ b/mixins-only/fg7-kotlin/src/main/java/net/minecraftforge/example/ExampleMod.java @@ -0,0 +1,11 @@ +package net.minecraftforge.example; + +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; + +@Mod("examplemod") +public final class ExampleMod { + public ExampleMod(FMLJavaModLoadingContext context) { + System.exit(0); + } +} diff --git a/mixins-only/fg7-kotlin/src/main/java/net/minecraftforge/example/mixins/ExampleMixin.java b/mixins-only/fg7-kotlin/src/main/java/net/minecraftforge/example/mixins/ExampleMixin.java new file mode 100644 index 0000000..8857b34 --- /dev/null +++ b/mixins-only/fg7-kotlin/src/main/java/net/minecraftforge/example/mixins/ExampleMixin.java @@ -0,0 +1,14 @@ +package net.minecraftforge.example.mixins; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; + +import net.minecraft.client.main.Main; + +@Mixin(Main.class) +public class ExampleMixin { + @Overwrite + public static void main(String[] args) { + System.out.println("Overwrote main!"); + } +} diff --git a/mixins-only/fg7-kotlin/src/main/resources/META-INF/mods.toml b/mixins-only/fg7-kotlin/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..3b50f26 --- /dev/null +++ b/mixins-only/fg7-kotlin/src/main/resources/META-INF/mods.toml @@ -0,0 +1,8 @@ +modLoader="javafml" +loaderVersion="[0,)" +license="license" + +[[mods]] #mandatory +modId="examplemod" +version="0" +displayName="example" diff --git a/mixins-only/fg7-kotlin/src/main/resources/examplemod.mixins.json b/mixins-only/fg7-kotlin/src/main/resources/examplemod.mixins.json new file mode 100644 index 0000000..202284d --- /dev/null +++ b/mixins-only/fg7-kotlin/src/main/resources/examplemod.mixins.json @@ -0,0 +1,6 @@ +{ + "package": "net.minecraftforge.example.mixins", + "mixins": [ + "ExampleMixin" + ] +} \ No newline at end of file diff --git a/mixins-only/fg7-kotlin/src/main/resources/pack.mcmeta b/mixins-only/fg7-kotlin/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..b9ba5c2 --- /dev/null +++ b/mixins-only/fg7-kotlin/src/main/resources/pack.mcmeta @@ -0,0 +1,10 @@ +{ + "pack": { + "description": "resources", + "max_format": 94, + "min_format": [ + 94, + 1 + ] + } +} \ No newline at end of file diff --git a/mixins-only/fg7/build.gradle b/mixins-only/fg7/build.gradle index 23a58d5..2bd4c5b 100644 --- a/mixins-only/fg7/build.gradle +++ b/mixins-only/fg7/build.gradle @@ -3,7 +3,7 @@ plugins { id 'idea' id 'eclipse' id 'maven-publish' - id 'net.minecraftforge.gradle' version '[7.0.2,8.0)' + id 'net.minecraftforge.gradle' version '[7.0.11,8.0)' } version = '1.0' @@ -35,7 +35,7 @@ repositories { dependencies { implementation minecraft.dependency("net.minecraftforge:forge:$minecraft_version-$forge_version") - annotationProcessor 'net.minecraftforge:eventbus-validator:7.0-beta.10' + annotationProcessor 'net.minecraftforge:eventbus-validator:7.0.1' } tasks.withType(JavaCompile).configureEach { diff --git a/mixins-only/fg7/gradle.properties b/mixins-only/fg7/gradle.properties index 92e1b0e..be8ea39 100644 --- a/mixins-only/fg7/gradle.properties +++ b/mixins-only/fg7/gradle.properties @@ -11,5 +11,5 @@ net.minecraftforge.gradle.merge-source-sets=true ## Environment Properties minecraft_version=1.21.11 -forge_version=61.0.2 +forge_version=61.1.1 mod_id=examplemod diff --git a/mixins-only/fg7/gradle/wrapper/gradle-wrapper.properties b/mixins-only/fg7/gradle/wrapper/gradle-wrapper.properties index 19a6bde..37f78a6 100644 --- a/mixins-only/fg7/gradle/wrapper/gradle-wrapper.properties +++ b/mixins-only/fg7/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/obfuscation/fg7-kotlin/build.gradle.kts b/obfuscation/fg7-kotlin/build.gradle.kts new file mode 100644 index 0000000..b4488fb --- /dev/null +++ b/obfuscation/fg7-kotlin/build.gradle.kts @@ -0,0 +1,61 @@ +// TODO [MDKExamples] This Kotlin buildscript is still very experimental. I am very new to Kotlin +// I welcome suggestions with open arms. + +plugins { + id("java") + id("idea") + id("eclipse") + id("maven-publish") + id("net.minecraftforge.gradle") version "[7.0.11,8.0)" + id("net.minecraftforge.renamer") version "1.0.2" +} + +val minecraft_version: String by project +val forge_version: String by project + +version = "1.0" +group = "net.minecraftforge" +base.archivesName = "obfuscation" + +java.toolchain.languageVersion = JavaLanguageVersion.of(17) + +minecraft { + mappings("official", "1.20.1") +} + +repositories { + minecraft.mavenizer(this) + maven(fg.forgeMaven) + maven(fg.minecraftLibsMaven) +} + +dependencies { + implementation(minecraft.dependency("net.minecraftforge:forge:1.20.1-47.4.0")) +} + +// Creates a task named 'renameJar' +renamer.classes(tasks.named("jar")) { + // You need to point to the mappings you wish to apply, typically this is the Mapped names to SRG for older versions. + // ForgeGradle/Mavenizer generate these files for the dependencies you declare. So you can use the helper. + // Or you can specify the file or dependency if you host them yourself. + map.from(minecraft.dependency.toSrgFile) + // This is publishable task so you can specify things such as the classifier + archiveClassifier = "srg" +} + +// If you want to create another task, or customize the name you can specify it as the first argument +renamer.classes("renameJarToSrg", tasks.named("jar")) { + // This specifies the map via a dependency coordinate, such as 'net.minecraft:mappings_official:1.20.1-20230612.114412:map2srg@tsrg.gz' + mappings(minecraft.dependency.toSrg.get()) +} + +publishing { + repositories { + maven { url = layout.projectDirectory.dir("repo").asFile.toURI() } + } + + publications.register("mavenJava") { + from(components.named("java").get()) // Publish the normal jar + artifact(tasks.named("renameJar").get()) // Publish the renamed jar in addition + } +} diff --git a/obfuscation/fg7-kotlin/gradle.properties b/obfuscation/fg7-kotlin/gradle.properties new file mode 100644 index 0000000..3feceb6 --- /dev/null +++ b/obfuscation/fg7-kotlin/gradle.properties @@ -0,0 +1,9 @@ +org.gradle.caching=true +org.gradle.parallel=true +org.gradle.configureondemand=true + +org.gradle.configuration-cache=true +org.gradle.configuration-cache.parallel=true +org.gradle.configuration-cache.problems=warn + +net.minecraftforge.gradle.merge-source-sets=true diff --git a/obfuscation/fg7-kotlin/gradle/wrapper/gradle-wrapper.jar b/obfuscation/fg7-kotlin/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..61285a6 Binary files /dev/null and b/obfuscation/fg7-kotlin/gradle/wrapper/gradle-wrapper.jar differ diff --git a/obfuscation/fg7-kotlin/gradle/wrapper/gradle-wrapper.properties b/obfuscation/fg7-kotlin/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..37f78a6 --- /dev/null +++ b/obfuscation/fg7-kotlin/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/obfuscation/fg7-kotlin/gradlew b/obfuscation/fg7-kotlin/gradlew new file mode 100644 index 0000000..adff685 --- /dev/null +++ b/obfuscation/fg7-kotlin/gradlew @@ -0,0 +1,248 @@ +#!/bin/sh + +# +# Copyright © 2015 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. +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# 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 + +# Resolve links: $0 may be a link +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 + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +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 ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + + + +# 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 + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# 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. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + + 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 + + +# 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, 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" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# 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" "$@" diff --git a/obfuscation/fg7-kotlin/gradlew.bat b/obfuscation/fg7-kotlin/gradlew.bat new file mode 100644 index 0000000..c4bdd3a --- /dev/null +++ b/obfuscation/fg7-kotlin/gradlew.bat @@ -0,0 +1,93 @@ +@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 +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/obfuscation/fg7-kotlin/settings.gradle.kts b/obfuscation/fg7-kotlin/settings.gradle.kts new file mode 100644 index 0000000..8977ad9 --- /dev/null +++ b/obfuscation/fg7-kotlin/settings.gradle.kts @@ -0,0 +1,5 @@ +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" +} + +rootProject.name = "obfuscation-kotlin" diff --git a/obfuscation/fg7-kotlin/src/main/java/com/example/examplemod/ExampleMod.java b/obfuscation/fg7-kotlin/src/main/java/com/example/examplemod/ExampleMod.java new file mode 100644 index 0000000..6cc0cb3 --- /dev/null +++ b/obfuscation/fg7-kotlin/src/main/java/com/example/examplemod/ExampleMod.java @@ -0,0 +1,16 @@ +package com.example.examplemod; + +import com.mojang.logging.LogUtils; +import net.minecraft.world.level.block.Blocks; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import org.slf4j.Logger; + +@Mod("test") +public final class ExampleMod { + private static final Logger LOGGER = LogUtils.getLogger(); + + public ExampleMod(FMLJavaModLoadingContext context) { + LOGGER.info("If this shows up we can reference obfuscated code: " + Blocks.DIRT.getDescriptionId()); + } +} diff --git a/obfuscation/fg7-kotlin/src/main/resources/META-INF/mods.toml b/obfuscation/fg7-kotlin/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..3f53f4f --- /dev/null +++ b/obfuscation/fg7-kotlin/src/main/resources/META-INF/mods.toml @@ -0,0 +1,9 @@ +modLoader="javafml" +loaderVersion="*" +license="Example" + +[[mods]] +modId="test" +version="0.0" +displayName="FG7 Obfuscation Example" +description="Demonstrates how to build an obfuscated Forge mod jar for versions that don't have runtime MojMap (1.20.4 and older)" diff --git a/obfuscation/fg7-kotlin/src/main/resources/pack.mcmeta b/obfuscation/fg7-kotlin/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..8ed93a9 --- /dev/null +++ b/obfuscation/fg7-kotlin/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "description": "resources", + "pack_format": 12 + } +} \ No newline at end of file diff --git a/obfuscation/fg7/build.gradle b/obfuscation/fg7/build.gradle index 19e95c9..94f45a6 100644 --- a/obfuscation/fg7/build.gradle +++ b/obfuscation/fg7/build.gradle @@ -3,7 +3,7 @@ plugins { id 'idea' id 'eclipse' id 'maven-publish' - id 'net.minecraftforge.gradle' version '[7.0.4,8.0)' + id 'net.minecraftforge.gradle' version '[7.0.11,8.0)' id 'net.minecraftforge.renamer' version '1.0.2' } @@ -18,7 +18,7 @@ minecraft { } repositories { - maven minecraft.mavenizer + minecraft.mavenizer(it) maven fg.forgeMaven maven fg.minecraftLibsMaven } diff --git a/obfuscation/fg7/gradle/wrapper/gradle-wrapper.properties b/obfuscation/fg7/gradle/wrapper/gradle-wrapper.properties index 19a6bde..37f78a6 100644 --- a/obfuscation/fg7/gradle/wrapper/gradle-wrapper.properties +++ b/obfuscation/fg7/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/traditional-mdk/fg6/build.gradle b/traditional-mdk/fg6/build.gradle index ee22b46..6c96072 100644 --- a/traditional-mdk/fg6/build.gradle +++ b/traditional-mdk/fg6/build.gradle @@ -145,7 +145,7 @@ dependencies { // Forge 1.21.6+ uses EventBus 7, which shifts most of its runtime validation to compile-time via an annotation processor // to improve performance in production environments. This line is required to enable said compile-time validation // in your development environment, helping you catch issues early. - annotationProcessor 'net.minecraftforge:eventbus-validator:7.0-beta.12' + annotationProcessor 'net.minecraftforge:eventbus-validator:7.0.1' // Example mod dependency with JEI // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime diff --git a/traditional-mdk/fg6/gradle.properties b/traditional-mdk/fg6/gradle.properties index db5fc25..e624adc 100644 --- a/traditional-mdk/fg6/gradle.properties +++ b/traditional-mdk/fg6/gradle.properties @@ -14,17 +14,17 @@ systemProp.net.minecraftforge.gradle.repo.attach=false ## Environment Properties # The Minecraft version must agree with the Forge version to get a valid artifact -minecraft_version=1.21.10 +minecraft_version=1.21.11 # The Minecraft version range can use any release version of Minecraft as bounds. # Snapshots, pre-releases, and release candidates are not guaranteed to sort properly # as they do not follow standard versioning conventions. -minecraft_version_range=[1.21.10,1.22) +minecraft_version_range=[1.21.11,1.22) # The Forge version must agree with the Minecraft version to get a valid artifact -forge_version=60.0.17 +forge_version=61.1.1 # The Forge version range can use any version of Forge as bounds or match the loader version range -forge_version_range=[60,) +forge_version_range=[61,) # The loader version range can only use the major version of Forge/FML as bounds -loader_version_range=[60,) +loader_version_range=[61,) # The mapping channel to use for mappings. # The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"]. # Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin. @@ -42,7 +42,7 @@ loader_version_range=[60,) mapping_channel=official # The mapping version to query from the mapping channel. # This must match the format required by the mapping channel. -mapping_version=1.21.10 +mapping_version=1.21.11 ## Mod Properties diff --git a/traditional-mdk/fg7-kotlin/build.gradle.kts b/traditional-mdk/fg7-kotlin/build.gradle.kts index 90a66ae..c653941 100644 --- a/traditional-mdk/fg7-kotlin/build.gradle.kts +++ b/traditional-mdk/fg7-kotlin/build.gradle.kts @@ -6,7 +6,7 @@ plugins { id("idea") id("eclipse") id("maven-publish") - id("net.minecraftforge.gradle") version "[7.0.2,8.0)" + id("net.minecraftforge.gradle") version "[7.0.11,8.0)" id("net.minecraftforge.jarjar") version "0.2.3" } @@ -125,7 +125,7 @@ dependencies { // Forge 1.21.6+ uses EventBus 7, which shifts most of its runtime validation to compile-time via an annotation processor // to improve performance in production environments. This line is required to enable said compile-time validation // in your development environment, helping you catch issues early. - annotationProcessor("net.minecraftforge:eventbus-validator:7.0-beta.10") + annotationProcessor("net.minecraftforge:eventbus-validator:7.0.1") // Example mod dependency with JEI // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime diff --git a/traditional-mdk/fg7-kotlin/gradle.properties b/traditional-mdk/fg7-kotlin/gradle.properties index 85ff056..2b12176 100644 --- a/traditional-mdk/fg7-kotlin/gradle.properties +++ b/traditional-mdk/fg7-kotlin/gradle.properties @@ -11,17 +11,17 @@ net.minecraftforge.gradle.merge-source-sets=true ## Environment Properties # The Minecraft version must agree with the Forge version to get a valid artifact -minecraft_version=1.21.10 +minecraft_version=1.21.11 # The Minecraft version range can use any release version of Minecraft as bounds. # Snapshots, pre-releases, and release candidates are not guaranteed to sort properly # as they do not follow standard versioning conventions. -minecraft_version_range=[1.21.10,1.22) +minecraft_version_range=[1.21.11,1.22) # The Forge version must agree with the Minecraft version to get a valid artifact -forge_version=60.0.17 +forge_version=61.1.1 # The Forge version range can use any version of Forge as bounds or match the loader version range -forge_version_range=[59,) +forge_version_range=[61,) # The loader version range can only use the major version of Forge/FML as bounds -loader_version_range=[59,) +loader_version_range=[61,) # The mapping channel to use for mappings. # The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"]. # Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin. @@ -39,7 +39,7 @@ loader_version_range=[59,) mapping_channel=official # The mapping version to query from the mapping channel. # This must match the format required by the mapping channel. -mapping_version=1.21.10 +mapping_version=1.21.11 ## Mod Properties diff --git a/traditional-mdk/fg7-kotlin/gradle/wrapper/gradle-wrapper.properties b/traditional-mdk/fg7-kotlin/gradle/wrapper/gradle-wrapper.properties index 19a6bde..37f78a6 100644 --- a/traditional-mdk/fg7-kotlin/gradle/wrapper/gradle-wrapper.properties +++ b/traditional-mdk/fg7-kotlin/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/traditional-mdk/fg7-kotlin/settings.gradle.kts b/traditional-mdk/fg7-kotlin/settings.gradle.kts index 11b1724..d0d9bdb 100644 --- a/traditional-mdk/fg7-kotlin/settings.gradle.kts +++ b/traditional-mdk/fg7-kotlin/settings.gradle.kts @@ -2,4 +2,4 @@ plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" } -rootProject.name = "examplemod" +rootProject.name = "examplemod-kotlin" diff --git a/traditional-mdk/fg7-kotlin/src/main/java/com/example/examplemod/Config.java b/traditional-mdk/fg7-kotlin/src/main/java/com/example/examplemod/Config.java index a117d0a..a5f8804 100644 --- a/traditional-mdk/fg7-kotlin/src/main/java/com/example/examplemod/Config.java +++ b/traditional-mdk/fg7-kotlin/src/main/java/com/example/examplemod/Config.java @@ -1,6 +1,6 @@ package com.example.examplemod; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.world.item.Item; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.eventbus.api.listener.SubscribeEvent; @@ -43,7 +43,7 @@ public class Config { public static Set items; private static boolean validateItemName(final Object obj) { - return obj instanceof final String itemName && ForgeRegistries.ITEMS.containsKey(ResourceLocation.tryParse(itemName)); + return obj instanceof final String itemName && ForgeRegistries.ITEMS.containsKey(Identifier.tryParse(itemName)); } @SubscribeEvent @@ -54,7 +54,7 @@ static void onLoad(final ModConfigEvent event) { // convert the list of strings into a set of items items = ITEM_STRINGS.get().stream() - .map(itemName -> ForgeRegistries.ITEMS.getValue(ResourceLocation.tryParse(itemName))) + .map(itemName -> ForgeRegistries.ITEMS.getValue(Identifier.tryParse(itemName))) .collect(Collectors.toSet()); } } diff --git a/traditional-mdk/fg7-kotlin/src/main/java/com/example/examplemod/ExampleMod.java b/traditional-mdk/fg7-kotlin/src/main/java/com/example/examplemod/ExampleMod.java index 25a2b06..2749b76 100644 --- a/traditional-mdk/fg7-kotlin/src/main/java/com/example/examplemod/ExampleMod.java +++ b/traditional-mdk/fg7-kotlin/src/main/java/com/example/examplemod/ExampleMod.java @@ -87,7 +87,7 @@ public ExampleMod(FMLJavaModLoadingContext context) { CREATIVE_MODE_TABS.register(modBusGroup); // Register the item to a creative tab - BuildCreativeModeTabContentsEvent.getBus(modBusGroup).addListener(ExampleMod::addCreative); + BuildCreativeModeTabContentsEvent.BUS.addListener(ExampleMod::addCreative); // Register our mod's ForgeConfigSpec so that Forge can create and load the config file for us context.registerConfig(ModConfig.Type.COMMON, Config.SPEC); diff --git a/traditional-mdk/fg7/build.gradle b/traditional-mdk/fg7/build.gradle index 0786a00..24bed94 100644 --- a/traditional-mdk/fg7/build.gradle +++ b/traditional-mdk/fg7/build.gradle @@ -3,7 +3,7 @@ plugins { id 'idea' id 'eclipse' id 'maven-publish' - id 'net.minecraftforge.gradle' version '[7.0.2,8.0)' + id 'net.minecraftforge.gradle' version '[7.0.11,8.0)' id 'net.minecraftforge.jarjar' version '0.2.3' } @@ -104,7 +104,7 @@ dependencies { // Forge 1.21.6+ uses EventBus 7, which shifts most of its runtime validation to compile-time via an annotation processor // to improve performance in production environments. This line is required to enable said compile-time validation // in your development environment, helping you catch issues early. - annotationProcessor 'net.minecraftforge:eventbus-validator:7.0-beta.10' + annotationProcessor 'net.minecraftforge:eventbus-validator:7.0.1' // Example mod dependency with JEI // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime diff --git a/traditional-mdk/fg7/gradle.properties b/traditional-mdk/fg7/gradle.properties index 85ff056..2b12176 100644 --- a/traditional-mdk/fg7/gradle.properties +++ b/traditional-mdk/fg7/gradle.properties @@ -11,17 +11,17 @@ net.minecraftforge.gradle.merge-source-sets=true ## Environment Properties # The Minecraft version must agree with the Forge version to get a valid artifact -minecraft_version=1.21.10 +minecraft_version=1.21.11 # The Minecraft version range can use any release version of Minecraft as bounds. # Snapshots, pre-releases, and release candidates are not guaranteed to sort properly # as they do not follow standard versioning conventions. -minecraft_version_range=[1.21.10,1.22) +minecraft_version_range=[1.21.11,1.22) # The Forge version must agree with the Minecraft version to get a valid artifact -forge_version=60.0.17 +forge_version=61.1.1 # The Forge version range can use any version of Forge as bounds or match the loader version range -forge_version_range=[59,) +forge_version_range=[61,) # The loader version range can only use the major version of Forge/FML as bounds -loader_version_range=[59,) +loader_version_range=[61,) # The mapping channel to use for mappings. # The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"]. # Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin. @@ -39,7 +39,7 @@ loader_version_range=[59,) mapping_channel=official # The mapping version to query from the mapping channel. # This must match the format required by the mapping channel. -mapping_version=1.21.10 +mapping_version=1.21.11 ## Mod Properties diff --git a/traditional-mdk/fg7/gradle/wrapper/gradle-wrapper.properties b/traditional-mdk/fg7/gradle/wrapper/gradle-wrapper.properties index 19a6bde..37f78a6 100644 --- a/traditional-mdk/fg7/gradle/wrapper/gradle-wrapper.properties +++ b/traditional-mdk/fg7/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/traditional-mdk/fg7/src/main/java/com/example/examplemod/Config.java b/traditional-mdk/fg7/src/main/java/com/example/examplemod/Config.java index a117d0a..a5f8804 100644 --- a/traditional-mdk/fg7/src/main/java/com/example/examplemod/Config.java +++ b/traditional-mdk/fg7/src/main/java/com/example/examplemod/Config.java @@ -1,6 +1,6 @@ package com.example.examplemod; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.world.item.Item; import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.eventbus.api.listener.SubscribeEvent; @@ -43,7 +43,7 @@ public class Config { public static Set items; private static boolean validateItemName(final Object obj) { - return obj instanceof final String itemName && ForgeRegistries.ITEMS.containsKey(ResourceLocation.tryParse(itemName)); + return obj instanceof final String itemName && ForgeRegistries.ITEMS.containsKey(Identifier.tryParse(itemName)); } @SubscribeEvent @@ -54,7 +54,7 @@ static void onLoad(final ModConfigEvent event) { // convert the list of strings into a set of items items = ITEM_STRINGS.get().stream() - .map(itemName -> ForgeRegistries.ITEMS.getValue(ResourceLocation.tryParse(itemName))) + .map(itemName -> ForgeRegistries.ITEMS.getValue(Identifier.tryParse(itemName))) .collect(Collectors.toSet()); } } diff --git a/traditional-mdk/fg7/src/main/java/com/example/examplemod/ExampleMod.java b/traditional-mdk/fg7/src/main/java/com/example/examplemod/ExampleMod.java index 25a2b06..2749b76 100644 --- a/traditional-mdk/fg7/src/main/java/com/example/examplemod/ExampleMod.java +++ b/traditional-mdk/fg7/src/main/java/com/example/examplemod/ExampleMod.java @@ -87,7 +87,7 @@ public ExampleMod(FMLJavaModLoadingContext context) { CREATIVE_MODE_TABS.register(modBusGroup); // Register the item to a creative tab - BuildCreativeModeTabContentsEvent.getBus(modBusGroup).addListener(ExampleMod::addCreative); + BuildCreativeModeTabContentsEvent.BUS.addListener(ExampleMod::addCreative); // Register our mod's ForgeConfigSpec so that Forge can create and load the config file for us context.registerConfig(ModConfig.Type.COMMON, Config.SPEC);