From c461fca59eab227130f87ae71da874a675f1b1a4 Mon Sep 17 00:00:00 2001 From: lothrazar Date: Sun, 2 Jul 2023 11:29:07 -0700 Subject: [PATCH] 1.20.1 forgegradle --- .github/CODE_OF_CONDUCT.md | 31 ----- .github/workflows/build.yml | 9 +- .gitignore | 7 +- build.gradle | 255 ++++++++++++++++++------------------ gradle.properties | 50 ++++--- 5 files changed, 168 insertions(+), 184 deletions(-) delete mode 100644 .github/CODE_OF_CONDUCT.md diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md deleted file mode 100644 index 210d27f763..0000000000 --- a/.github/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,31 +0,0 @@ -Code of Merit ( https://github.com/rosarior/Code-of-Merit ) - -The project creators, lead developers, core team, constitute the managing members of the project and have final say in every decision of the project, technical or otherwise, including overruling previous decisions. There are no limitations to this decisional power. - -Contributions are an expected result of your membership on the project. Don't expect others to do your work or help you with your work forever. - -All members have the same opportunities to seek any challenge they want within the project. - -Authority or position in the project will be proportional to the accrued contribution. Seniority must be earned. - -Software is evolutive: the better implementations must supersede lesser implementations. Technical advantage is the primary evaluation metric. - -This is a space for technical prowess; topics outside of the project will not be tolerated. - -Non technical conflicts will be discussed in a separate space. Disruption of the project will not be allowed. - -Individual characteristics, including but not limited to, body, sex, sexual preference, race, language, religion, nationality, or political preferences are irrelevant in the scope of the project and will not be taken into account concerning your value or that of your contribution to the project. - -Discuss or debate the idea, not the person. - -There is no room for ambiguity: Ambiguity will be met with questioning; further ambiguity will be met with silence. It is the responsibility of the originator to provide requested context. - -If something is illegal outside the scope of the project, it is illegal in the scope of the project. This Code of Merit does not take precedence over governing law. - -This Code of Merit governs the technical procedures of the project not the activities outside of it. - -Participation on the project equates to agreement of this Code of Merit. - -No objectives beyond the stated objectives of this project are relevant to the project. Any intent to deviate the project from its original purpose of existence will constitute grounds for remedial action which may include expulsion from the project. - -This document is the Code of Merit (http://code-of-merit.org), version 1.0. diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc7fee6479..2606e486ba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,14 +6,17 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: setup jdk17 - uses: actions/setup-java@v2 + - name: checkout repository + uses: actions/checkout@v3 + - name: setup jdk + uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: 17 cache: 'gradle' - name: make gradle wrapper executable run: chmod +x ./gradlew + - name: setup + run: ./gradlew eclipse - name: build run: ./gradlew build diff --git a/.gitignore b/.gitignore index 7a509c2c4d..ff73fea0e0 100644 --- a/.gitignore +++ b/.gitignore @@ -16,14 +16,11 @@ out # gradle build .gradle -mcmodsrepo/ # other -eclipse run +logs +libs # Files from Forge MDK forge*changelog.txt -logs/ -libs/ -src/generated diff --git a/build.gradle b/build.gradle index 919aba5a52..0a18f837ff 100644 --- a/build.gradle +++ b/build.gradle @@ -1,31 +1,65 @@ plugins { id 'eclipse' + id 'idea' id 'maven-publish' id 'net.minecraftforge.gradle' version '[6.0,6.2)' } -java.toolchain.languageVersion = JavaLanguageVersion.of(17) -import net.minecraftforge.gradle.common.tasks.SignJar -println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) - version = "${mc_version}-${mod_version}" -group = 'com.lothrazar.cyclic' -archivesBaseName = 'Cyclic' +group = mod_group_id base { - archivesName = 'Cyclic' + archivesName = mod_id } +// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. +java.toolchain.languageVersion = JavaLanguageVersion.of(17) +import net.minecraftforge.gradle.common.tasks.SignJar +println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { - mappings channel: 'official', version: "${mc_version}" - - accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + // The mappings can be changed at any time and must be in the following format. + // Channel: Version: + // official MCVersion Official field/method names from Mojang mapping files + // parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official + // + // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings. + // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md + // + // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge + // Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started + // + // 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: mapping_channel, version: mapping_version + + // When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game. + // In most cases, it is not necessary to enable. + // enableEclipsePrepareRuns = true + // enableIdeaPrepareRuns = true + + // This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game. + // It is REQUIRED to be set to true for this template to function. + // See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html copyIdeResources = true - enableEclipsePrepareRuns = true + + // When true, this property will add the folder name of all declared run configurations to generated IDE run configurations. + // The folder name can be set on a run configuration using the "folderName" property. + // By default, the folder name of a run configuration is the name of the Gradle project containing it. + // generateRunFolders = true + + // This property enables access transformers for use in development. + // They will be applied to the Minecraft artifact. + // The access transformer file can be anywhere in the project. + // However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge. + // This default location is a best practice to automatically put the file in the right place in the final jar. + // See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information. + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + // Default run configurations. // These can be tweaked, removed, or duplicated as needed. runs { - client { + // applies to all the run configs below + configureEach { workingDirectory project.file('run') // Recommended logging data for a userdev environment @@ -36,13 +70,10 @@ minecraft { 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' - // probably for patchouli - property 'mixin.env.disableRefMap', 'true' - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. - property 'forge.enabledGameTestNamespaces', mod_id - mods { "${mod_id}" { source sourceSets.main @@ -50,156 +81,133 @@ minecraft { } } - server { - workingDirectory project.file('run') - - // Recommended logging data for a userdev environment - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' - - // Recommended logging level for the console - property 'forge.logging.console.level', 'debug' - property 'mixin.env.disableRefMap', 'true' + client { + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. property 'forge.enabledGameTestNamespaces', mod_id + } - mods { - "${mod_id}" { - source sourceSets.main - } - } + server { + property 'forge.enabledGameTestNamespaces', mod_id + args '--nogui' } - - data { - workingDirectory project.file('run') - property 'forge.logging.markers', 'REGISTRIES' + // This run config launches GameTestServer and runs all registered gametests, then exits. + // By default, the server will crash when no gametests are provided. + // The gametest system is also enabled by default for other run configs under the /test command. + gameTestServer { + property 'forge.enabledGameTestNamespaces', mod_id + } - property 'forge.logging.console.level', 'debug' + data { + // example of overriding the workingDirectory set in configureEach above + workingDirectory project.file('run-data') // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') - - mods { - "${mod_id}" { - source sourceSets.main - } - } } } } -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:${minecraft_version}-${forge_version}" - // https://github.com/mezz/JustEnoughItems/wiki/Getting-Started-%5BJEI-10-or-higher-for-Forge-or-Fabric%5D#repositories - compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}") - compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}") - // at runtime, use the full JEI -// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-common:${jei_version}") - runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}") - - runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}") - compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}:api") - - // optional compat: guidebook - //TODO: enable after it ports - // compileOnly fg.deobf("vazkii.patchouli:Patchouli:${mc_version}-${patchouli_version}:api") - // runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${mc_version}-${patchouli_version}") - - // mods that have optional/soft integration - // runtimeOnly fg.deobf("curse.maven:liquid-blocks-301999:3873025") - // runtimeOnly fg.deobf("curse.maven:just-enough-effect-descriptions-jeed-532286:3944903") - // runtimeOnly fg.deobf("curse.maven:plain-grinder-452000:3653027") - - // runtimeOnly fg.deobf("curse.maven:farmers-delight-398521:3834150") - -} +// Include resources generated by data generators. +sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { - // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: - flatDir { - dir 'libs' - } - maven { // TOP - name 'tterrag maven' - url "https://maven.tterrag.com/" + maven { + // location of the maven that hosts JEI files + name = "Progwml6 maven" + url = 'https://dvs1.progwml6.com/files/maven/' } maven { - name = "mappings" - url 'https://dogforce-games.com/maven' + name = "curios" + url = 'https://maven.theillusivec4.top/' } - maven { url = "https://maven.theillusivec4.top/" } - maven { url 'https://dvs1.progwml6.com/files/maven/' } - maven { url 'https://maven.blamejared.com' } - maven { url = "https://modmaven.dev" } -// maven { url 'https://www.cursemaven.com' } + maven { url = 'https://maven.blamejared.com' } + maven { url = 'https://www.cursemaven.com' } } +dependencies { + implementation fg.deobf("curse.maven:flib-661261:4583429") + // Specify the version of Minecraft to use. + // Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact. + // The "userdev" classifier will be requested and setup by ForgeGradle. + // If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"], + // then special handling is done to allow a setup of a vanilla dependency without the use of an external repository. + minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" + + // Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings + // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime + // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}") + // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}") + // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}") + + // Example mod dependency using a mod jar from ./libs with a flat dir repository + // This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar + // The group id is ignored when searching -- in this case, it is "blank" + // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}") + + // For more info: + // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html + // http://www.gradle.org/docs/current/userguide/dependency_management.html +} // This block of code expands all declared replace properties in the specified resource targets. // A missing property will result in an error. Properties are expanded using ${} Groovy notation. // When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments. // See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html -def resourceTargets = ['META-INF/mods.toml', 'pack.mcmeta'] -def replaceProperties = [ - mod_id: mod_id, mod_version: mod_version - -] -processResources { +tasks.named('processResources', ProcessResources).configure { + var replaceProperties = [ + minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range, + forge_version: forge_version, forge_version_range: forge_version_range, + loader_version_range: loader_version_range, + mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, + mod_authors: mod_authors, mod_description: mod_description, + ] inputs.properties replaceProperties - replaceProperties.put 'project', project - filesMatching(resourceTargets) { - expand replaceProperties + filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { + expand replaceProperties + [project: project] } } -// Example for how to get properties into the manifest for reading by the runtime.. -jar { +// Example for how to get properties into the manifest for reading at runtime. +tasks.named('jar', Jar).configure { manifest { attributes([ - "Specification-Title": "cyclic", - "Specification-Vendor": "cyclicsareus", - "Specification-Version" : "1", // We are version 1 of ourselves - "Implementation-Title" : project.name, - "Implementation-Version" : project.jar.archiveVersion, - "Implementation-Vendor" : mod_authors, - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + 'Specification-Title' : mod_id, + 'Specification-Vendor' : mod_authors, + 'Specification-Version' : '1', // We are version 1 of ourselves + 'Implementation-Title' : project.name, + 'Implementation-Version' : project.jar.archiveVersion, + 'Implementation-Vendor' : mod_authors, + 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } + + // This is the preferred method to reobfuscate your jar file + finalizedBy 'reobfJar' } -// 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') +// 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: +// tasks.named('publish').configure { +// dependsOn 'reobfJar' +// } +// Example configuration to allow publishing using the maven-publish plugin publishing { publications { - mavenJava(MavenPublication) { + register('mavenJava', MavenPublication) { artifact jar } } repositories { maven { - url "file:///${project.projectDir}/mcmodsrepo" + url "file://${project.projectDir}/mcmodsrepo" } } } - -tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation -} - - task signJar(type: SignJar, dependsOn: jar) { - onlyIf { - project.hasProperty('keyStore') - } // findProperty allows us to reference the property without it existing. // Using project.propName would cause the script to fail validation if // the property did not exist. @@ -210,14 +218,11 @@ task signJar(type: SignJar, dependsOn: jar) { inputFile = jar.archivePath outputFile = jar.archivePath } - - -task copyJar(type: Copy) { - from jar - into "${dist_folder}" -} - task cleanJar { delete 'build/libs' } + +tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation +} diff --git a/gradle.properties b/gradle.properties index 444440de60..3e4ef0d597 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,29 +7,39 @@ org.gradle.daemon=false dist_folder=c:/temp mod_id=cyclic -mod_name=Cyclic -mod_license=All Rights Reserved -mod_authors=Lothrazar -mod_description=cyclic -mod_group_id=com.lothrazar.cyclic curse_id=239286 mod_version=1.11.1 -minecraft_version=1.20 -mc_version=1.20 - -# The Forge version must agree with the Minecraft version to get a valid artifact -forge_version=46.0.14 -# The Forge version range can use any version of Forge as bounds or match the loader version range -forge_version_range=[46,) -# The loader version range can only use the major version of Forge/FML as bounds -loader_version_range=[46,) -minecraft_version_range=[1.20,1.21) - -# optional dependencies -jei_version=14.0.0.11 -curios_version=5.2.0-beta.2+1.20 -patchouli_version=78 +mc_version=1.20.1 +forge_version=47.0.35 + + +mod_name=Cyclic +mod_group_id=com.lothrazar.cyclic + + +mod_license=SeeGithub +mod_authors=Lothrazar +mod_description=mod +minecraft_version_range=[1.20.1,) +forge_version_range=[47,) +loader_version_range=[47,) +mapping_channel=official +minecraft_version=1.20.1 +mapping_version=1.20.1 +mc_version=1.20.1 + + + + + + +flib_version=0.0.5 +#patchouli_version=78 +jei_version=15.0.0.12 +curios_version=5.2.0-beta.3+1.20 + + # for eclipse.ini if needed #-vm