From fe3d3478a94cc4ae0eba96a82e877ef1eaab1bd6 Mon Sep 17 00:00:00 2001 From: 3944Realms Date: Sun, 17 May 2026 12:05:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=8E=AF=E5=A2=83=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E5=88=B026.1.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- .../src/main/groovy/multiloader-common.gradle | 46 ++++-------- .../src/main/groovy/multiloader-loader.gradle | 7 +- common/build.gradle | 31 ++++++-- common/src/main/resources/lib39.accesswidener | 3 +- fabric/build.gradle | 70 +++++-------------- gradle.properties | 19 +++-- gradlew | 35 +++++----- neoforge/build.gradle | 12 +--- settings.gradle | 29 +------- 10 files changed, 94 insertions(+), 160 deletions(-) diff --git a/build.gradle b/build.gradle index 429753e..069b4e7 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ plugins { - id 'fabric-loom' version '1.9-SNAPSHOT' apply false + id 'net.fabricmc.fabric-loom' version '1.15.5' apply false id 'net.neoforged.moddev' version '2.0.141' apply false } \ No newline at end of file diff --git a/buildSrc/src/main/groovy/multiloader-common.gradle b/buildSrc/src/main/groovy/multiloader-common.gradle index 83584cf..0dcb3ab 100644 --- a/buildSrc/src/main/groovy/multiloader-common.gradle +++ b/buildSrc/src/main/groovy/multiloader-common.gradle @@ -26,19 +26,6 @@ repositories { } filter { includeGroupAndSubgroups('org.spongepowered') } } - exclusiveContent { - forRepositories( - maven { - name = 'ParchmentMC' - url = 'https://maven.parchmentmc.org/' - }, - maven { url = "https://neoforged.forgecdn.net/releases" }, - maven { url = "https://neoforged.forgecdn.net/mojang-meta" } - ) - filter { includeGroup('org.parchmentmc.data') } - } - maven { url = "https://libraries.minecraft.net/" } - maven { url "https://cursemaven.com" @@ -48,25 +35,13 @@ repositories { name = 'BlameJared' url = 'https://maven.blamejared.com' } - repositories { - maven { url 'https://maven.covers1624.net/' } + maven { + name = 'LTDNexus' + url = 'https://nexus.bot.leisuretimedock.top/repository/maven-releases/' } -} + maven { url 'https://maven.covers1624.net/' } -// Declare capabilities on the outgoing configurations. -// Read more about capabilities here: https://docs.gradle.org/current/userguide/component_capabilities.html#sec:declaring-additional-capabilities-for-a-local-component -['apiElements', 'runtimeElements', 'sourcesElements', 'javadocElements'].each { variant -> - configurations."$variant".outgoing { - capability("$group:${project.name}:$version") - capability("$group:${base.archivesName.get()}:$version") - capability("$group:$mod_id-${project.name}-${minecraft_version}:$version") - capability("$group:$mod_id:$version") - } - publishing.publications.configureEach { - suppressPomMetadataWarningsFor(variant) - } } - sourcesJar { from(rootProject.file('LICENSE')) { rename { "${it}_${mod_name}" } @@ -112,9 +87,18 @@ processResources { 'java_version' : java_version ] - filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml', 'META-INF/neoforge.mods.toml', '*.mixins.json']) { + var jsonExpandProps = expandProps.collectEntries { + key, value -> [(key): value instanceof String ? value.replace("\n", "\\\\n") : value] + } + + filesMatching(['META-INF/mods.toml', 'META-INF/neoforge.mods.toml']) { expand expandProps } + + filesMatching(['pack.mcmeta', 'fabric.mod.json', '*.mixins.json']) { + expand jsonExpandProps + } + inputs.properties(expandProps) } @@ -137,7 +121,7 @@ publishing { licenses { license { name = 'MIT' - url = 'https://gitea.bot.leisuretimedock.top/R3944Realms/Lib39/raw/branch/MultiLoader_1_21_1/LICENSE' + url = 'https://gitea.bot.leisuretimedock.top/R3944Realms/Lib39/raw/branch/MultiLoader_26_1_2/LICENSE' distribution = 'repo' } } diff --git a/buildSrc/src/main/groovy/multiloader-loader.gradle b/buildSrc/src/main/groovy/multiloader-loader.gradle index c9fea6d..69ca3ed 100644 --- a/buildSrc/src/main/groovy/multiloader-loader.gradle +++ b/buildSrc/src/main/groovy/multiloader-loader.gradle @@ -13,8 +13,9 @@ configurations { dependencies { compileOnly(project(':common')) { - capabilities { - requireCapability "$group:$mod_id" + def loaderAttribute = Attribute.of('io.github.mcgradleconventions.loader', String) + attributes { + attribute(loaderAttribute, 'common') } } commonJava project(path: ':common', configuration: 'commonJava') @@ -36,7 +37,7 @@ tasks.named('javadoc', Javadoc).configure { source(configurations.commonJava) options.encoding = 'UTF-8' options.charSet = 'UTF-8' - options.links("https://docs.oracle.com/en/java/javase/21/docs/api/") + options.links("https://docs.oracle.com/en/java/javase/25/docs/api/") options.memberLevel = JavadocMemberLevel.PUBLIC options.addBooleanOption('Xdoclint:none', true) options.addStringOption('doctitle', "${mod_id} ${minecraft_version} ${version} Javadoc") diff --git a/common/build.gradle b/common/build.gradle index ea5de00..e72b9eb 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -10,22 +10,21 @@ neoForge { if (at.exists()) { accessTransformers.from(at.absolutePath) } - parchment { - minecraftVersion = parchment_minecraft - mappingsVersion = parchment_version - } } dependencies { compileOnly group: 'org.spongepowered', name: 'mixin', version: '0.8.5' + // fabric and neoforge both bundle mixinextras, so it is safe to use it in common + compileOnly group: 'io.github.llamalad7', name: 'mixinextras-common', version: '0.5.3' + annotationProcessor group: 'io.github.llamalad7', name: 'mixinextras-common', version: '0.5.3' - implementation(group: 'tschipp.carryon', name: 'carryon-common-1.21.1', version: '2.2.4') { + implementation(group: 'tschipp.carryon', name: 'carryon-common-26.1.2', version: '3.0.1') { transitive = false } // fabric and neoforge both bundle mixinextras, so it is safe to use it in common - implementation group: 'io.github.llamalad7', name: 'mixinextras-common', version: '0.4.1' - annotationProcessor group: 'io.github.llamalad7', name: 'mixinextras-common', version: '0.4.1' + compileOnly group: 'io.github.llamalad7', name: 'mixinextras-common', version: '0.5.3' + annotationProcessor group: 'io.github.llamalad7', name: 'mixinextras-common', version: '0.5.3' } configurations { commonJava { @@ -46,3 +45,21 @@ artifacts { clean { delete 'generated' } + +def loaderAttribute = Attribute.of('io.github.mcgradleconventions.loader', String) +['apiElements', 'runtimeElements', 'sourcesElements', 'javadocElements'].each { variant -> + configurations.named("$variant") { + attributes { + attribute(loaderAttribute, 'common') + } + } +} +sourceSets.configureEach { + [it.compileClasspathConfigurationName, it.runtimeClasspathConfigurationName].each { variant-> + configurations.named("$variant") { + attributes { + attribute(loaderAttribute, 'common') + } + } + } +} diff --git a/common/src/main/resources/lib39.accesswidener b/common/src/main/resources/lib39.accesswidener index f4cac66..6c36b0a 100644 --- a/common/src/main/resources/lib39.accesswidener +++ b/common/src/main/resources/lib39.accesswidener @@ -1,2 +1 @@ -accessWidener v2 named -# 不要用这个,太垃圾了,不支持parchment名 \ No newline at end of file +classTweaker v1 official \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle index d71b09c..4873214 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,20 +1,13 @@ plugins { id 'multiloader-loader' - id 'fabric-loom' + id 'net.fabricmc.fabric-loom' } dependencies { minecraft "com.mojang:minecraft:${minecraft_version}" - mappings loom.layered { - officialMojangMappings() - parchment("org.parchmentmc.data:parchment-${parchment_minecraft}:${parchment_version}@zip") - } - modImplementation(group: 'tschipp.carryon', name: 'carryon-fabric-1.21.1', version: '2.2.4.4') { - transitive = false - } - modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}" - modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}" - modImplementation "curse.maven:jade-324717:7545228" + implementation "net.fabricmc:fabric-loader:${fabric_loader_version}" + implementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}" + implementation "curse.maven:jade-324717:8048381" testImplementation "net.fabricmc:fabric-loader-junit:${fabric_loader_version}" localRuntime 'net.covers1624:DevLogin:0.1.0.5' } @@ -96,7 +89,7 @@ tasks.named('javadoc', Javadoc) { classpath += project(':common').sourceSets.main.compileClasspath options.encoding = 'UTF-8' options.charSet = 'UTF-8' - options.links("https://docs.oracle.com/en/java/javase/21/docs/api/") + options.links("https://docs.oracle.com/en/java/javase/25/docs/api/") options.memberLevel = JavadocMemberLevel.PUBLIC options.addBooleanOption('Xdoclint:none', true) options.addStringOption('doctitle', "${mod_id} ${minecraft_version} ${version} Javadoc") @@ -117,49 +110,20 @@ tasks.named('build') { dependsOn tasks.named('javadocJar') } -// 配置remap任务以包含sources和javadoc -remapJar { - dependsOn tasks.named('sourcesJar') - dependsOn tasks.named('javadocJar') - inputFile.set(tasks.named('jar').get().archiveFile) - addNestedDependencies = false +def loaderAttribute = Attribute.of('io.github.mcgradleconventions.loader', String) +['apiElements', 'runtimeElements', 'sourcesElements', 'javadocElements', 'includeInternal', 'modCompileClasspath'].each { variant -> + configurations.named("$variant") { + attributes { + attribute(loaderAttribute, 'fabric') + } + } } - -remapSourcesJar { - dependsOn tasks.named('sourcesJar') - inputFile.set(tasks.named('sourcesJar').get().archiveFile) -} - - -// 将remapped artifacts添加到发布配置 -publishing { - publications { - mavenJava(MavenPublication) { - // 重置artifactsId - artifactId = "${mod_id}-fabric-${minecraft_version}" - artifacts.clear() - // 手动添加需要的artifacts - artifact(remapJar) { - builtBy remapJar - } - artifact(remapSourcesJar) { - builtBy remapSourcesJar - classifier = 'sources' - } - artifact(javadocJar) { - builtBy javadocJar - classifier = 'javadoc' +sourceSets.configureEach { + [it.compileClasspathConfigurationName, it.runtimeClasspathConfigurationName].each { variant-> + configurations.named("$variant") { + attributes { + attribute(loaderAttribute, 'fabric') } } } - test { - useJUnitPlatform() - } - - tasks.named('generateMetadataFileForMavenJavaPublication') { - dependsOn tasks.named('remapJar') - dependsOn tasks.named('remapSourcesJar') - dependsOn tasks.named('javadocJar') - } - } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index ccad3d6..684e0ff 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,29 +5,26 @@ # Project version=0.5.6 group=top.r3944realms.lib39 -java_version=21 +java_version=25 # Common -minecraft_version=1.21.1 +minecraft_version=26.1.2 mod_name=3944Realms 's Lib Mod mod_author=R3944Realms mod_id=lib39 license=MIT credits=Logo created by Shanyi43, edited by R3944Realms description=Lib39 is a general-purpose dependency library that provides utility methods and core functionality for other mods. -minecraft_version_range=[1.20.1, 1.22) -# The version of ParchmentMC that is used, see https://parchmentmc.org/docs/getting-started#choose-a-version for new versions -parchment_minecraft=1.21.1 -parchment_version=2024.11.17 -neo_form_version=1.21.1-20240808.144430 +minecraft_version_range=[26.1.2, 26.2) +neo_form_version=26.1.2-1 # NeoForge -neoforge_version=21.1.80 +neoforge_version=26.1.2.7-beta neoforge_loader_version_range=[4,) # Fabric -fabric_version=0.109.0+1.21.1 -fabric_loader_version=0.16.9 +fabric_version=0.145.4+26.1.2 +fabric_loader_version=0.18.6 # Gradle org.gradle.jvmargs=-Xmx3G @@ -41,7 +38,7 @@ publish_curseforge=true modrinth_id=n65Vs1Vk curseforge_id=1445917 -java_versions=21 +java_versions=25 fabric_modrinth_dependencies= neoforge_modrinth_dependencies= diff --git a/gradlew b/gradlew index aeb74cb..1b05573 100644 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# 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. @@ -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/HEAD/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/. @@ -83,7 +85,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# 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 @@ -111,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -130,10 +132,13 @@ 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. @@ -141,7 +146,7 @@ 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=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -149,7 +154,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -166,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -198,16 +202,15 @@ 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 $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. +# 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" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. @@ -242,4 +245,4 @@ eval "set -- $( tr '\n' ' ' )" '"$@"' -exec "$JAVACMD" "$@" +exec "$JAVACMD" "$@" \ No newline at end of file diff --git a/neoforge/build.gradle b/neoforge/build.gradle index a09104c..bd7bd17 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -18,10 +18,6 @@ neoForge { if (at.exists()) { accessTransformers = ["src/main/resources/META-INF/accesstransformer.cfg"] } - parchment { - minecraftVersion = parchment_minecraft - mappingsVersion = parchment_version - } runs { client { client() @@ -36,7 +32,7 @@ neoForge { ) } data { - data() + clientData() // 使用之前定义的变量 programArguments.addAll( @@ -64,12 +60,10 @@ neoForge { sourceSets.main.resources.srcDir project(':common').file('src/generated/resources') dependencies { - compileOnly project(":common") - implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:0.2.0")) - implementation(group: 'tschipp.carryon', name: 'carryon-neoforge-1.21.1', version: '2.2.4.4') { + implementation(group: 'tschipp.carryon', name: 'carryon-neoforge-26.1.2', version: '3.0.1') { transitive = false } - implementation "curse.maven:jade-324717:7545219" + implementation "curse.maven:jade-324717:8068368" } diff --git a/settings.gradle b/settings.gradle index 537e208..7ac1310 100644 --- a/settings.gradle +++ b/settings.gradle @@ -10,39 +10,14 @@ pluginManagement { } } filter { - includeGroup('net.fabricmc') - includeGroup('fabric-loom') + includeGroupAndSubgroups('net.fabricmc') } } - exclusiveContent { - forRepository { - maven { - name = 'Sponge' - url = uri('https://repo.spongepowered.org/repository/maven-public') - } - } - filter { - includeGroupAndSubgroups("org.spongepowered") - } - } - exclusiveContent { - forRepository { - maven { - name = 'Forge' - url = uri('https://maven.minecraftforge.net') - } - } - filter { - includeGroupAndSubgroups('net.minecraftforge') - } - } - maven { url = 'https://maven.neoforged.net/releases' } - maven { url = 'https://maven.parchmentmc.org' } // Add this line } } plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' + id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0' } // This should match the folder name of the project, or else IDEA may complain (see https://youtrack.jetbrains.com/issue/IDEA-317606)