|
| 1 | +plugins { |
| 2 | + id 'eclipse' |
| 3 | + id 'maven-publish' |
| 4 | + id 'net.minecraftforge.gradle' version '5.1.+' |
| 5 | +} |
| 6 | + |
| 7 | +version = '1.19.3-1.0' |
| 8 | +group = 'me.jddev0.energizedpower' // http://maven.apache.org/guides/mini/guide-naming-conventions.html |
| 9 | +archivesBaseName = 'energizedpower' |
| 10 | + |
| 11 | +// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. |
| 12 | +java.toolchain.languageVersion = JavaLanguageVersion.of(17) |
| 13 | + |
| 14 | +println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" |
| 15 | +minecraft { |
| 16 | + // The mappings can be changed at any time and must be in the following format. |
| 17 | + // Channel: Version: |
| 18 | + // official MCVersion Official field/method names from Mojang mapping files |
| 19 | + // parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official |
| 20 | + // |
| 21 | + // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings. |
| 22 | + // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md |
| 23 | + // |
| 24 | + // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge |
| 25 | + // Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started |
| 26 | + // |
| 27 | + // Use non-default mappings at your own risk. They may not always work. |
| 28 | + // Simply re-run your setup task after changing the mappings to update your workspace. |
| 29 | + mappings channel: 'official', version: '1.19.3' |
| 30 | + |
| 31 | + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default. |
| 32 | + |
| 33 | + // Default run configurations. |
| 34 | + // These can be tweaked, removed, or duplicated as needed. |
| 35 | + runs { |
| 36 | + client { |
| 37 | + workingDirectory project.file('run') |
| 38 | + |
| 39 | + // Recommended logging data for a userdev environment |
| 40 | + // The markers can be added/remove as needed separated by commas. |
| 41 | + // "SCAN": For mods scan. |
| 42 | + // "REGISTRIES": For firing of registry events. |
| 43 | + // "REGISTRYDUMP": For getting the contents of all registries. |
| 44 | + property 'forge.logging.markers', 'REGISTRIES' |
| 45 | + |
| 46 | + // Recommended logging level for the console |
| 47 | + // You can set various levels here. |
| 48 | + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels |
| 49 | + property 'forge.logging.console.level', 'debug' |
| 50 | + |
| 51 | + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. |
| 52 | + property 'forge.enabledGameTestNamespaces', 'energizedpower' |
| 53 | + |
| 54 | + mods { |
| 55 | + energizedpower { |
| 56 | + source sourceSets.main |
| 57 | + } |
| 58 | + } |
| 59 | + } |
| 60 | + |
| 61 | + server { |
| 62 | + workingDirectory project.file('run') |
| 63 | + |
| 64 | + property 'forge.logging.markers', 'REGISTRIES' |
| 65 | + |
| 66 | + property 'forge.logging.console.level', 'debug' |
| 67 | + |
| 68 | + property 'forge.enabledGameTestNamespaces', 'energizedpower' |
| 69 | + |
| 70 | + mods { |
| 71 | + energizedpower { |
| 72 | + source sourceSets.main |
| 73 | + } |
| 74 | + } |
| 75 | + } |
| 76 | + |
| 77 | + // This run config launches GameTestServer and runs all registered gametests, then exits. |
| 78 | + // By default, the server will crash when no gametests are provided. |
| 79 | + // The gametest system is also enabled by default for other run configs under the /test command. |
| 80 | + gameTestServer { |
| 81 | + workingDirectory project.file('run') |
| 82 | + |
| 83 | + property 'forge.logging.markers', 'REGISTRIES' |
| 84 | + |
| 85 | + property 'forge.logging.console.level', 'debug' |
| 86 | + |
| 87 | + property 'forge.enabledGameTestNamespaces', 'energizedpower' |
| 88 | + |
| 89 | + mods { |
| 90 | + energizedpower { |
| 91 | + source sourceSets.main |
| 92 | + } |
| 93 | + } |
| 94 | + } |
| 95 | + |
| 96 | + data { |
| 97 | + workingDirectory project.file('run') |
| 98 | + |
| 99 | + property 'forge.logging.markers', 'REGISTRIES' |
| 100 | + |
| 101 | + property 'forge.logging.console.level', 'debug' |
| 102 | + |
| 103 | + // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. |
| 104 | + args '--mod', 'energizedpower', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') |
| 105 | + |
| 106 | + mods { |
| 107 | + energizedpower { |
| 108 | + source sourceSets.main |
| 109 | + } |
| 110 | + } |
| 111 | + } |
| 112 | + } |
| 113 | +} |
| 114 | + |
| 115 | +// Include resources generated by data generators. |
| 116 | +sourceSets.main.resources { srcDir 'src/generated/resources' } |
| 117 | + |
| 118 | +repositories { |
| 119 | + // Put repositories for dependencies here |
| 120 | + // ForgeGradle automatically adds the Forge maven and Maven Central for you |
| 121 | + |
| 122 | + // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: |
| 123 | + flatDir { |
| 124 | + dir 'libs' |
| 125 | + } |
| 126 | +} |
| 127 | + |
| 128 | +dependencies { |
| 129 | + // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed |
| 130 | + // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. |
| 131 | + // The userdev artifact is a special name and will get all sorts of transformations applied to it. |
| 132 | + minecraft 'net.minecraftforge:forge:1.19.3-44.0.37' |
| 133 | + |
| 134 | + // Real mod deobf dependency examples - these get remapped to your current mappings |
| 135 | + // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency |
| 136 | + |
| 137 | + // Examples using mod jars from ./libs |
| 138 | + // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}") |
| 139 | + |
| 140 | + // For more info... |
| 141 | + // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html |
| 142 | + // http://www.gradle.org/docs/current/userguide/dependency_management.html |
| 143 | +} |
| 144 | + |
| 145 | +// Example for how to get properties into the manifest for reading at runtime. |
| 146 | +jar { |
| 147 | + manifest { |
| 148 | + attributes([ |
| 149 | + "Specification-Title" : "energizedpower", |
| 150 | + "Specification-Vendor" : "JDDev0", |
| 151 | + "Specification-Version" : "1", // We are version 1 of ourselves |
| 152 | + "Implementation-Title" : project.name, |
| 153 | + "Implementation-Version" : project.jar.archiveVersion, |
| 154 | + "Implementation-Vendor" : "JDDev0", |
| 155 | + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") |
| 156 | + ]) |
| 157 | + } |
| 158 | +} |
| 159 | + |
| 160 | +// Example configuration to allow publishing using the maven-publish plugin |
| 161 | +// This is the preferred method to reobfuscate your jar file |
| 162 | +jar.finalizedBy('reobfJar') |
| 163 | +// 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 |
| 164 | +// publish.dependsOn('reobfJar') |
| 165 | + |
| 166 | +publishing { |
| 167 | + publications { |
| 168 | + mavenJava(MavenPublication) { |
| 169 | + artifact jar |
| 170 | + } |
| 171 | + } |
| 172 | + repositories { |
| 173 | + maven { |
| 174 | + url "file://${project.projectDir}/mcmodsrepo" |
| 175 | + } |
| 176 | + } |
| 177 | +} |
| 178 | + |
| 179 | +tasks.withType(JavaCompile).configureEach { |
| 180 | + options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation |
| 181 | +} |
0 commit comments