XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

MyDimension-Lord

【我的世界】我的维度附属模组:维度之主

公开
关注 0 Fork 0 Star 0
UTF-8
plugins {
    id 'net.minecraftforge.gradle' version '6.0.54'
}

version = mod_version
group = maven_group
base { archivesName = archives_base_name }
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
repositories { mavenCentral() }

// The parent is loaded as a separate development mod, using its mapped classes.
// Release JARs contain only this addon's classes and resources.
apply from: 'ports/parent-mod.gradle'

minecraft {
    mappings channel: 'official', version: minecraft_version
    runs {
        configureEach {
            workingDirectory project.file('run')
            property 'forge.enabledGameTestNamespaces', 'mydimension_lord'
            args '--mixin.config', 'mydimension.mixins.json'
            args '--mixin.config', 'mydimension_lord.mixins.json'
            property 'mixin.env.remapRefMap', 'true'
            property 'mixin.env.refMapRemappingFile', new File(parentProjectDir, 'build/createSrgToMcp/output.srg').absolutePath
            mods {
                mydimension { source sourceSets.parentMod }
                mydimension_lord { source sourceSets.main }
            }
        }
        client {}
        server { args '--nogui' }
        gameTestServer { workingDirectory project.file('run-gametest') }
    }
}

dependencies {
    minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
    annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
    testImplementation platform('org.junit:junit-bom:5.10.2')
    testImplementation 'org.junit.jupiter:junit-jupiter'
    testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
tasks.named('test') { useJUnitPlatform() }
tasks.named('processResources') {
    filteringCharset = 'UTF-8'
    def replacements = ['minecraft_version', 'minecraft_version_range', 'forge_version', 'forge_version_range',
                        'loader_version_range', 'mod_id', 'mod_name', 'mod_license', 'mod_version', 'mod_authors', 'mod_description']
            .collectEntries { [(it): project.property(it)] }
    inputs.properties replacements
    filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { expand replacements }
}
tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8'; options.release = 17 }
jar { finalizedBy 'reobfJar' }
tasks.named('compileJava', JavaCompile) {
    dependsOn 'createMcpToSrg'
    options.compilerArgs += ['-AmappingTypes=tsrg']
    doFirst {
        options.compilerArgs += ['-AreobfTsrgFile=' + tasks.named('createMcpToSrg').get().output.get().asFile.absolutePath,
                                '-AoutRefMapFile=' + destinationDirectory.file('mydimension_lord.refmap.json').get().asFile.absolutePath]
    }
}
tasks.withType(Jar).configureEach { manifest.attributes('MixinConfigs': 'mydimension_lord.mixins.json') }
// Base mixin mappings are needed for development runs of the parent.
tasks.matching { it.name.startsWith('prepareRun') }.configureEach {
    doFirst {
        if (!new File(parentProjectDir, 'build/createSrgToMcp/output.srg').exists())
            throw new GradleException('Build the matching parent mod with createSrgToMcp first.')
    }
}
apply from: 'ports/gametest.gradle'
apply from: 'ports/client-smoke.gradle'