diff --git a/build.gradle b/build.gradle index 9178a3a..f5cd6b5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,8 @@ plugins { - id 'fabric-loom' version '0.11-SNAPSHOT' + id 'fabric-loom' version '1.10-SNAPSHOT' id 'maven-publish' } -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 - archivesBaseName = project.archives_base_name version = project.mod_version group = project.maven_group @@ -32,14 +29,6 @@ dependencies { modApi("me.shedaniel.cloth:cloth-config-fabric:${project.version_cloth_api}") { exclude(group: "net.fabricmc.fabric-api") } - - // Performance mods - modRuntimeOnly "maven.modrinth:lithium:${project.version_lithium}" - modRuntimeOnly "maven.modrinth:phosphor:${project.version_phosphor}" - modRuntimeOnly "maven.modrinth:ferrite-core:${project.version_ferrite_core}" - modRuntimeOnly "maven.modrinth:lazydfu:${project.version_lazydfu}" - modRuntimeOnly "maven.modrinth:ksyxis:${project.version_ksyxis}" - modRuntimeOnly "maven.modrinth:c2me-fabric:${project.version_c2me}" } @@ -56,6 +45,17 @@ tasks.withType(JavaCompile).configureEach { it.options.release = 17 } +loom { + splitEnvironmentSourceSets() + + mods { + "modid" { + sourceSet sourceSets.main + sourceSet sourceSets.client + } + } + +} java { // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task // if it is present. diff --git a/gradle.properties b/gradle.properties index be64cb3..d818bfa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,28 +3,18 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.18.1 -yarn_mappings=1.18.1+build.22 -loader_version=0.13.1 +minecraft_version=1.21.5 +yarn_mappings=1.21.5+build.1 +loader_version=0.16.10 # Mod Properties -mod_version = 0.0.1-beta.2+1.18.1-fabric +mod_version = 0.0.1-beta.1+1.21.5-fabric maven_group = com.github.einjerjar.mc archives_base_name = mc-alias # Dependencies -fabric_version=0.46.4+1.18 +fabric_version=0.119.5+1.21.5 # Config -version_cloth_api=6.1.48 -version_mod_menu=3.0.1 - - -# Performance -version_lithium=mc1.18.1-0.7.7 -version_phosphor=mc1.18.x-0.8.1 -version_ferrite_core=4.1.1 -version_lazydfu=0.1.2 -version_ksyxis=1.1 -version_c2me=0.2.0+alpha.6.53+1.18.1 -version_servercore=1.2.7-1.18.1 \ No newline at end of file +version_cloth_api=18.0.145 +version_mod_menu=14.0.0 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e6e589..c1048ec 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists +zipStorePath=wrapper/dists \ No newline at end of file diff --git a/gradlew b/gradlew index c53aefa..e373764 100644 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# 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/. @@ -80,13 +82,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# 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 @@ -133,22 +133,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + 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 @@ -193,11 +200,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ @@ -205,6 +216,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. @@ -231,4 +248,4 @@ eval "set -- $( tr '\n' ' ' )" '"$@"' -exec "$JAVACMD" "$@" +exec "$JAVACMD" "$@" \ No newline at end of file diff --git a/src/main/java/com/einjerjar/mc/mcalias/Main.java b/src/main/java/com/einjerjar/mc/mcalias/Main.java index 3c3bdcd..331c320 100644 --- a/src/main/java/com/einjerjar/mc/mcalias/Main.java +++ b/src/main/java/com/einjerjar/mc/mcalias/Main.java @@ -41,7 +41,11 @@ public void onInitialize() { .executes(context -> { try { String args = MessageArgumentType.getMessage(context, "args").getString(); - return server.getCommandManager().execute(context.getSource(), s2 + " " + args); + return context.getSource() + .getServer() + .getCommandManager() + .getDispatcher() // get the Brigadier dispatcher :contentReference[oaicite:6]{index=6} + .execute(s2 + " " + args, context.getSource()); // matches execute(String,S) :contentReference[oaicite:7]{index=7} } catch (Exception ex) { ex.printStackTrace(); } @@ -49,7 +53,11 @@ public void onInitialize() { })) .executes(context -> { try { - return server.getCommandManager().execute(context.getSource(), s2); + return context.getSource() + .getServer() + .getCommandManager() + .getDispatcher() + .execute(s2, context.getSource()); // omit trailing space when args is empty :contentReference[oaicite:8]{index=8} } catch (Exception ex) { ex.printStackTrace(); } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 0e46314..c70c3f3 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -23,9 +23,9 @@ }, "depends": { - "fabricloader": ">=0.12.12", + "fabricloader": ">=0.16.10", "fabric": "*", - "minecraft": "1.18.x", + "minecraft": "1.21.5", "java": ">=17" } }