From db7fe0b8f036c5c5c5d57775f74c464c3f20815b Mon Sep 17 00:00:00 2001 From: 3944Realms Date: Tue, 12 May 2026 20:19:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=9E=84=E5=BB=BAfabric=E7=8E=AF=E5=A2=83=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/groovy/multiloader-common.gradle | 1 + common/build.gradle | 30 ++++++++--------- fabric/build.gradle | 32 +++++++++---------- neoforge/build.gradle | 30 ++++++++--------- 4 files changed, 44 insertions(+), 49 deletions(-) diff --git a/buildSrc/src/main/groovy/multiloader-common.gradle b/buildSrc/src/main/groovy/multiloader-common.gradle index 720371c..127d9c3 100644 --- a/buildSrc/src/main/groovy/multiloader-common.gradle +++ b/buildSrc/src/main/groovy/multiloader-common.gradle @@ -42,6 +42,7 @@ repositories { name = 'BlameJared' url = 'https://maven.blamejared.com' } + maven { url 'https://maven.covers1624.net/' } } // Declare capabilities on the outgoing configurations. diff --git a/common/build.gradle b/common/build.gradle index 5cc3284..c6adc99 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -39,9 +39,20 @@ clean { delete 'generated' } -afterEvaluate { - def loaderAttribute = Attribute.of('io.github.mcgradleconventions.loader', String) - ['apiElements', 'runtimeElements', 'sourcesElements', 'javadocElements'].each { variant -> +def loaderAttribute = Attribute.of('io.github.mcgradleconventions.loader', String) +['apiElements', 'runtimeElements', 'sourcesElements', 'javadocElements'].each { variant -> + try { + configurations.named(variant) { + if (!it.isLocked()) { + attributes { + attribute(loaderAttribute, 'common') + } + } + } + } catch (Exception ignored) {} +} +sourceSets.configureEach { + [it.compileClasspathConfigurationName, it.runtimeClasspathConfigurationName].each { variant -> try { configurations.named(variant) { if (!it.isLocked()) { @@ -52,17 +63,4 @@ afterEvaluate { } } catch (Exception ignored) {} } - sourceSets.configureEach { - [it.compileClasspathConfigurationName, it.runtimeClasspathConfigurationName].each { variant -> - try { - configurations.named(variant) { - if (!it.isLocked()) { - attributes { - attribute(loaderAttribute, 'common') - } - } - } - } catch (Exception ignored) {} - } - } } diff --git a/fabric/build.gradle b/fabric/build.gradle index cc9d7a4..0742ef6 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,6 +1,6 @@ plugins { id 'multiloader-loader' - id 'fabric-loom' + id 'net.fabricmc.fabric-loom' } dependencies { minecraft "com.mojang:minecraft:${minecraft_version}" @@ -134,9 +134,20 @@ loom { } } -afterEvaluate { - def loaderAttribute = Attribute.of('io.github.mcgradleconventions.loader', String) - ['apiElements', 'runtimeElements', 'sourcesElements', 'javadocElements', 'includeInternal', 'modCompileClasspath'].each { variant -> +def loaderAttribute = Attribute.of('io.github.mcgradleconventions.loader', String) +['apiElements', 'runtimeElements', 'sourcesElements', 'javadocElements', 'includeInternal', 'modCompileClasspath'].each { variant -> + try { + configurations.named(variant) { + if (!it.isLocked()) { + attributes { + attribute(loaderAttribute, 'fabric') + } + } + } + } catch (Exception ignored) {} +} +sourceSets.configureEach { + [it.compileClasspathConfigurationName, it.runtimeClasspathConfigurationName].each { variant -> try { configurations.named(variant) { if (!it.isLocked()) { @@ -147,17 +158,4 @@ afterEvaluate { } } catch (Exception ignored) {} } - sourceSets.configureEach { - [it.compileClasspathConfigurationName, it.runtimeClasspathConfigurationName].each { variant -> - try { - configurations.named(variant) { - if (!it.isLocked()) { - attributes { - attribute(loaderAttribute, 'fabric') - } - } - } - } catch (Exception ignored) {} - } - } } \ No newline at end of file diff --git a/neoforge/build.gradle b/neoforge/build.gradle index db343e9..9b92790 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -108,9 +108,20 @@ tasks.named('build') { sourceSets.main.resources.srcDir project(':common').file('src/generated/resources') -afterEvaluate { - def loaderAttribute = Attribute.of('io.github.mcgradleconventions.loader', String) - ['apiElements', 'runtimeElements', 'sourcesElements', 'javadocElements'].each { variant -> +def loaderAttribute = Attribute.of('io.github.mcgradleconventions.loader', String) +['apiElements', 'runtimeElements', 'sourcesElements', 'javadocElements'].each { variant -> + try { + configurations.named(variant) { + if (!it.isLocked()) { + attributes { + attribute(loaderAttribute, 'neoforge') + } + } + } + } catch (Exception ignored) {} +} +sourceSets.configureEach { + [it.compileClasspathConfigurationName, it.runtimeClasspathConfigurationName, it.getTaskName(null, 'jarJar')].each { variant -> try { configurations.named(variant) { if (!it.isLocked()) { @@ -121,17 +132,4 @@ afterEvaluate { } } catch (Exception ignored) {} } - sourceSets.configureEach { - [it.compileClasspathConfigurationName, it.runtimeClasspathConfigurationName, it.getTaskName(null, 'jarJar')].each { variant -> - try { - configurations.named(variant) { - if (!it.isLocked()) { - attributes { - attribute(loaderAttribute, 'neoforge') - } - } - } - } catch (Exception ignored) {} - } - } } \ No newline at end of file