程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了build.gradle java Forge 1.16.5“无法解析符号‘日期’”大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决build.gradle java Forge 1.16.5“无法解析符号‘日期’”?

开发过程中遇到build.gradle java Forge 1.16.5“无法解析符号‘日期’”的问题如何解决?下面主要结合日常开发的经验,给出你关于build.gradle java Forge 1.16.5“无法解析符号‘日期’”的解决方法建议,希望对你解决build.gradle java Forge 1.16.5“无法解析符号‘日期’”有所启发或帮助;

我想编写我自己的 minecraft mod 并且我正在关注 youtube 教程。 我做的一切都正确,但在 build.gradle 文件中的 IntelliJ IDEA 中显示“无法解析符号‘日期’”

这里是 build.gradle 文件的完整代码:

buildscript {
    repositorIEs {
        maven { url = 'https://files.minecraftforge.net/maven' }
        jcenter()
        mavenCentral()
    }
    dependencIEs {
        classpath group: 'net.minecraftforge.gradle',name: 'ForgeGradle',version: '4.1.+',changing: true
    }
}
apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line,the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '1.0'
group = 'netjackboi03.forestportal' // http://maven.apache.org/guIDes/mini/guIDe-naming-conventions.HTML
archivesBasename = 'forestportal'

java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users,so your mod should target Java 8.

println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
minecraft {
    // The mapPings can be changed at any time,and must be in the following format.
    // ChAnnel:   Version:
    // snapshot   YYYymMDD   Snapshot are built nightly.
    // stable     #          Stables are built at the discretion of the MCP team.
    // official   MCVersion  Official fIEld/method names from Mojang mapPing files
    //
    // You must be aware of the Mojang license when using the 'official' mapPings.
    // See more information here: https://github.com/minecraftForge/MCPConfig/blob/master/Mojang.md
    //
    // Use non-default mapPings at your own risk. they may not always work.
    // Simply re-run your setup task after changing the mapPings to update your workspace.
    mapPings chAnnel: 'official',version: '1.16.5'
    // makeObfsourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
    
    // accesstransformer = file('src/main/resources/meta-inf/accesstransformer.cfg')

    // Default run configurations.
    // these can be tweaked,removed,or duplicated as needed.
    runs {
        clIEnt {
            workingDirectory project.file('run')

            // Recommended logging data for a userdev environment
            // The markers can be changed as needed. 
            // "SCAN": For mods scan.
            // "REGIStriES": For firing of registry events.
            // "REGISTRYDUMP": For getTing the contents of all regiStriEs.
            property 'forge.logging.markers','REGIStriES'

            // Recommended logging level for the console
            // You can set varIoUs levels here.
            // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
            property 'forge.logging.console.level','deBUG'

            mods {
                forestportal {
                    source sourceSets.main
                }
            }
        }

        server {
            workingDirectory project.file('run')

            // Recommended logging data for a userdev environment
            // The markers can be changed as needed. 
            // "SCAN": For mods scan.
            // "REGIStriES": For firing of registry events.
            // "REGISTRYDUMP": For getTing the contents of all regiStriEs.
            property 'forge.logging.markers','deBUG'

            mods {
                forestportal {
                    source sourceSets.main
                }
            }
        }

        data {
            workingDirectory project.file('run')

            // Recommended logging data for a userdev environment
            // The markers can be changed as needed. 
            // "SCAN": For mods scan.
            // "REGIStriES": For firing of registry events.
            // "REGISTRYDUMP": For getTing the contents of all regiStriEs.
            property 'forge.logging.markers','deBUG'

            // Specify the modID for data generation,where to output the resulTing resource,and where to look for exisTing resources.
            args '--mod','forestportal','--all','--exisTing',file('src/main/resources').toString(),file('src/generated/resources').toString(),'--output',file('src/generated/resources/')

            mods {
                forestportal {
                    source sourceSets.main
                }
            }
        }
    }
}

// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }

dependencIEs {
    // Specify the version of minecraft to use,If this is any group other then 'net.minecraft' it is assumed
    // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applIEd.
    // The userdev artifact is a special name and will get all sorts of transformations applIEd to it.
    minecraft 'net.minecraftforge:forge:1.16.5-36.0.58'

    // You may put jars on which you depend on in ./libs or you may define them like so..
    // compile "some.group:artifact:version:classifIEr"
    // compile "some.group:artifact:version"

    // Real examples
    // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env
    // compile 'com.Googlecode.efficIEnt-java-matrix-library:ejml:0.24' // adds ejml to the dev env

    // The 'provIDed' configuration is for optional dependencIEs that exist at compile-time but might not at runtime.
    // provIDed 'com.mod-buildcraft:buildcraft:6.0.8:dev'

    // these dependencIEs get remapped to your current MCP mapPings
    // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'

    // For more info...
    // http://www.gradle.org/docs/current/userguIDe/artifact_dependencIEs_tutorial.HTML
    // http://www.gradle.org/docs/current/userguIDe/dependency_management.HTML

}

// Example for how to get propertIEs into the manifest for reading by the runtime..
jar {
    manifest {
        attributes([
            "Specification-title": "forestportal","Specification-vendor": "examplemodsareus","Specification-Version": "1",// We are version 1 of ourselves
            "Implementation-title": project.name,"Implementation-Version": "${version}","Implementation-vendor" :"examplemodsareus","Implementation-timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
        ])
    }
}

// Example configuration to allow publishing using the maven-publish task
// This is the preferred method to reobfuscate your jar file
jar.finalizedBy('reobfJar') 
// However if you are in a multi-project build,dev time needs unobfed jar files,so you can delay the obfuscation until publishing by doing
//publish.dependsOn('reobfJar')

publishing {
    publications {
        mavenJava(MavenPublication) {
            artifact jar
        }
    }
    repositorIEs {
        maven {
            url "file:///${project.projectDir}/mcmodsrepo"
        }
    }
}

问题出在这行代码:

"Implementation-timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")

我不知道这对运行 mod 是否重要,但我想确保它不是。

感谢您的帮助:)

解决方法

我得说我不知道​​。在 1.16.4 上它工作得很好,但我不知道为什么这在 1.16.5 上不起作用。也许尝试删除这一行,然后看看没有这一行是否一切正常。

大佬总结

以上是大佬教程为你收集整理的build.gradle java Forge 1.16.5“无法解析符号‘日期’”全部内容,希望文章能够帮你解决build.gradle java Forge 1.16.5“无法解析符号‘日期’”所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:build.gradle