Modernize the template
- Replaced `subprojects` with buildSrc plugins - Moved to Jetbrains Annotations over jsr305 - Removed timestamp related manifest attributes - Re-enabled the gradle module metadata, required for NeoForge now. - Changed the runs folder to `runs/<type>` for consistency
This commit is contained in:
parent
357c43e511
commit
985f33d90c
87
build.gradle
87
build.gradle
|
|
@ -2,90 +2,3 @@ plugins {
|
||||||
// Required for NeoGradle
|
// Required for NeoGradle
|
||||||
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7"
|
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7"
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
|
||||||
apply plugin: 'java'
|
|
||||||
|
|
||||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
|
||||||
java.withSourcesJar()
|
|
||||||
java.withJavadocJar()
|
|
||||||
|
|
||||||
jar {
|
|
||||||
from(rootProject.file("LICENSE")) {
|
|
||||||
rename { "${it}_${mod_name}" }
|
|
||||||
}
|
|
||||||
manifest {
|
|
||||||
attributes([
|
|
||||||
'Specification-Title' : mod_name,
|
|
||||||
'Specification-Vendor' : mod_author,
|
|
||||||
'Specification-Version' : project.jar.archiveVersion,
|
|
||||||
'Implementation-Title' : project.name,
|
|
||||||
'Implementation-Version' : project.jar.archiveVersion,
|
|
||||||
'Implementation-Vendor' : mod_author,
|
|
||||||
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
|
||||||
'Timestamp' : System.currentTimeMillis(),
|
|
||||||
'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
|
|
||||||
'Built-On-Minecraft' : minecraft_version
|
|
||||||
])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourcesJar {
|
|
||||||
from(rootProject.file("LICENSE")) {
|
|
||||||
rename { "${it}_${mod_name}" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
maven {
|
|
||||||
name = 'Sponge / Mixin'
|
|
||||||
url = 'https://repo.spongepowered.org/repository/maven-public/'
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name = 'BlameJared Maven (JEI / CraftTweaker / Bookshelf)'
|
|
||||||
url = 'https://maven.blamejared.com'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
|
||||||
|
|
||||||
it.options.encoding = 'UTF-8'
|
|
||||||
it.options.getRelease().set(17)
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
def expandProps = [
|
|
||||||
"version": version,
|
|
||||||
"group": project.group, //Else we target the task's group.
|
|
||||||
"minecraft_version": minecraft_version,
|
|
||||||
"forge_version": forge_version,
|
|
||||||
"forge_loader_version_range": forge_loader_version_range,
|
|
||||||
"forge_version_range": forge_version_range,
|
|
||||||
"minecraft_version_range": minecraft_version_range,
|
|
||||||
"fabric_version": fabric_version,
|
|
||||||
"fabric_loader_version": fabric_loader_version,
|
|
||||||
"mod_name": mod_name,
|
|
||||||
"mod_author": mod_author,
|
|
||||||
"mod_id": mod_id,
|
|
||||||
"license": license,
|
|
||||||
"description": project.description,
|
|
||||||
"neoforge_version": neoforge_version,
|
|
||||||
"neoforge_loader_version_range": neoforge_loader_version_range,
|
|
||||||
"credits": credits
|
|
||||||
]
|
|
||||||
|
|
||||||
filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml', '*.mixins.json']) {
|
|
||||||
expand expandProps
|
|
||||||
}
|
|
||||||
inputs.properties(expandProps)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disables Gradle's custom module metadata from being published to maven. The
|
|
||||||
// metadata includes mapped dependencies which are not reasonably consumable by
|
|
||||||
// other mod developers.
|
|
||||||
tasks.withType(GenerateModuleMetadata).configureEach {
|
|
||||||
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
3
buildSrc/build.gradle
Normal file
3
buildSrc/build.gradle
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
plugins {
|
||||||
|
id 'groovy-gradle-plugin'
|
||||||
|
}
|
||||||
44
buildSrc/src/main/groovy/consumer.gradle
Normal file
44
buildSrc/src/main/groovy/consumer.gradle
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
plugins {
|
||||||
|
id 'shared'
|
||||||
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
commonJava{
|
||||||
|
canBeResolved = true
|
||||||
|
}
|
||||||
|
commonResources{
|
||||||
|
canBeResolved = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly(project(':common')) {
|
||||||
|
capabilities {
|
||||||
|
requireCapability "$group:$mod_id"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
commonJava project(path: ':common', configuration: 'commonJava')
|
||||||
|
commonResources project(path: ':common', configuration: 'commonResources')
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('compileJava', JavaCompile) {
|
||||||
|
dependsOn(configurations.commonJava)
|
||||||
|
source(configurations.commonJava)
|
||||||
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
dependsOn(configurations.commonResources)
|
||||||
|
from(configurations.commonResources)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('javadoc', Javadoc).configure {
|
||||||
|
dependsOn(configurations.commonJava)
|
||||||
|
source(configurations.commonJava)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("sourcesJar", Jar) {
|
||||||
|
dependsOn(configurations.commonJava)
|
||||||
|
from(configurations.commonJava)
|
||||||
|
dependsOn(configurations.commonResources)
|
||||||
|
from(configurations.commonResources)
|
||||||
|
}
|
||||||
114
buildSrc/src/main/groovy/shared.gradle
Normal file
114
buildSrc/src/main/groovy/shared.gradle
Normal file
|
|
@ -0,0 +1,114 @@
|
||||||
|
plugins {
|
||||||
|
id 'java-library'
|
||||||
|
id 'maven-publish'
|
||||||
|
}
|
||||||
|
|
||||||
|
base {
|
||||||
|
archivesName = "${mod_id}-${project.name}-${minecraft_version}"
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain.languageVersion = JavaLanguageVersion.of(java_version)
|
||||||
|
withSourcesJar()
|
||||||
|
withJavadocJar()
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
// https://docs.gradle.org/current/userguide/declaring_repositories.html#declaring_content_exclusively_found_in_one_repository
|
||||||
|
exclusiveContent {
|
||||||
|
forRepository {
|
||||||
|
maven {
|
||||||
|
name = 'Sponge'
|
||||||
|
url = 'https://repo.spongepowered.org/repository/maven-public'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filter { includeGroupAndSubgroups("org.spongepowered") }
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = 'BlameJared'
|
||||||
|
url = 'https://maven.blamejared.com'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'org.jetbrains:annotations:24.1.0'
|
||||||
|
}
|
||||||
|
|
||||||
|
// Declare capabilities on the outgoing configurations.
|
||||||
|
// Read more about capabilities here: https://docs.gradle.org/current/userguide/component_capabilities.html#sec:declaring-additional-capabilities-for-a-local-component
|
||||||
|
['apiElements', 'runtimeElements', 'sourcesElements', 'javadocElements'].each { variant ->
|
||||||
|
configurations."$variant".outgoing {
|
||||||
|
capability("$group:$mod_id-${project.name}-${minecraft_version}:$version")
|
||||||
|
capability("$group:$mod_id:$version")
|
||||||
|
}
|
||||||
|
publishing.publications.configureEach {
|
||||||
|
suppressPomMetadataWarningsFor(variant)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourcesJar {
|
||||||
|
from(rootProject.file("LICENSE")) {
|
||||||
|
rename { "${it}_${mod_name}" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
from(rootProject.file("LICENSE")) {
|
||||||
|
rename { "${it}_${mod_name}" }
|
||||||
|
}
|
||||||
|
|
||||||
|
manifest {
|
||||||
|
attributes([
|
||||||
|
'Specification-Title' : mod_name,
|
||||||
|
'Specification-Vendor' : mod_author,
|
||||||
|
'Specification-Version' : project.jar.archiveVersion,
|
||||||
|
'Implementation-Title' : project.name,
|
||||||
|
'Implementation-Version': project.jar.archiveVersion,
|
||||||
|
'Implementation-Vendor' : mod_author,
|
||||||
|
'Built-On-Minecraft' : minecraft_version
|
||||||
|
])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
def expandProps = [
|
||||||
|
"version": version,
|
||||||
|
"group": project.group, //Else we target the task's group.
|
||||||
|
"minecraft_version": minecraft_version,
|
||||||
|
"forge_version": forge_version,
|
||||||
|
"forge_loader_version_range": forge_loader_version_range,
|
||||||
|
"forge_version_range": forge_version_range,
|
||||||
|
"minecraft_version_range": minecraft_version_range,
|
||||||
|
"fabric_version": fabric_version,
|
||||||
|
"fabric_loader_version": fabric_loader_version,
|
||||||
|
"mod_name": mod_name,
|
||||||
|
"mod_author": mod_author,
|
||||||
|
"mod_id": mod_id,
|
||||||
|
"license": license,
|
||||||
|
"description": project.description,
|
||||||
|
"neoforge_version": neoforge_version,
|
||||||
|
"neoforge_loader_version_range": neoforge_loader_version_range,
|
||||||
|
"credits": credits,
|
||||||
|
"java_version": java_version
|
||||||
|
]
|
||||||
|
|
||||||
|
filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml', '*.mixins.json']) {
|
||||||
|
expand expandProps
|
||||||
|
}
|
||||||
|
inputs.properties(expandProps)
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
register('mavenJava', MavenPublication) {
|
||||||
|
artifactId base.archivesName.get()
|
||||||
|
from components.java
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
url System.getenv("local_maven_url")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,34 +1,33 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'idea'
|
id 'shared'
|
||||||
id 'java'
|
|
||||||
id 'maven-publish'
|
|
||||||
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
|
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
|
||||||
}
|
}
|
||||||
base {
|
|
||||||
archivesName = "${mod_name}-common-${minecraft_version}"
|
|
||||||
}
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version(minecraft_version)
|
version(minecraft_version)
|
||||||
if(file("src/main/resources/${mod_id}.accesswidener").exists()){
|
def aw = file("src/main/resources/${mod_id}.accesswidener")
|
||||||
accessWideners(file("src/main/resources/${mod_id}.accesswidener"))
|
if(aw.exists()){
|
||||||
|
accessWideners(aw)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5'
|
compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5'
|
||||||
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
configurations {
|
||||||
publications {
|
commonJava {
|
||||||
mavenJava(MavenPublication) {
|
canBeResolved = false
|
||||||
artifactId base.archivesName.get()
|
canBeConsumed = true
|
||||||
from components.java
|
}
|
||||||
}
|
commonResources {
|
||||||
}
|
canBeResolved = false
|
||||||
repositories {
|
canBeConsumed = true
|
||||||
maven {
|
|
||||||
url System.getenv("local_maven_url")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
commonJava sourceSets.main.java.sourceDirectories.singleFile
|
||||||
|
commonResources sourceSets.main.resources.sourceDirectories.singleFile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package com.example.examplemod.mixin;
|
||||||
|
|
||||||
import com.example.examplemod.Constants;
|
import com.example.examplemod.Constants;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.screens.TitleScreen;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,11 @@
|
||||||
"package": "com.example.examplemod.mixin",
|
"package": "com.example.examplemod.mixin",
|
||||||
"refmap": "${mod_id}.refmap.json",
|
"refmap": "${mod_id}.refmap.json",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"mixins": [
|
"mixins": [],
|
||||||
],
|
|
||||||
"client": [
|
"client": [
|
||||||
"MixinMinecraft"
|
"MixinMinecraft"
|
||||||
],
|
],
|
||||||
"server": [
|
"server": [],
|
||||||
],
|
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,18 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'consumer'
|
||||||
id 'idea'
|
|
||||||
id 'maven-publish'
|
|
||||||
id 'fabric-loom' version '1.6-SNAPSHOT'
|
id 'fabric-loom' version '1.6-SNAPSHOT'
|
||||||
}
|
}
|
||||||
base {
|
|
||||||
archivesName = "${mod_name}-fabric-${minecraft_version}"
|
|
||||||
}
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "com.mojang:minecraft:${minecraft_version}"
|
minecraft "com.mojang:minecraft:${minecraft_version}"
|
||||||
mappings loom.officialMojangMappings()
|
mappings loom.officialMojangMappings()
|
||||||
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_version}"
|
||||||
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
|
|
||||||
compileOnly project(":common")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loom {
|
loom {
|
||||||
if (project(":common").file("src/main/resources/${mod_id}.accesswidener").exists()) {
|
def aw = project(":common").file("src/main/resources/${mod_id}.accesswidener")
|
||||||
accessWidenerPath.set(project(":common").file("src/main/resources/${mod_id}.accesswidener"))
|
if (aw.exists()) {
|
||||||
|
accessWidenerPath.set(aw)
|
||||||
}
|
}
|
||||||
mixin {
|
mixin {
|
||||||
defaultRefmapName.set("${mod_id}.refmap.json")
|
defaultRefmapName.set("${mod_id}.refmap.json")
|
||||||
|
|
@ -28,41 +22,13 @@ loom {
|
||||||
client()
|
client()
|
||||||
setConfigName("Fabric Client")
|
setConfigName("Fabric Client")
|
||||||
ideConfigGenerated(true)
|
ideConfigGenerated(true)
|
||||||
runDir("run")
|
runDir("runs/client")
|
||||||
}
|
}
|
||||||
server {
|
server {
|
||||||
server()
|
server()
|
||||||
setConfigName("Fabric Server")
|
setConfigName("Fabric Server")
|
||||||
ideConfigGenerated(true)
|
ideConfigGenerated(true)
|
||||||
runDir("run")
|
runDir("runs/server")
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
|
||||||
source(project(":common").sourceSets.main.allSource)
|
|
||||||
}
|
|
||||||
tasks.withType(Javadoc).configureEach {
|
|
||||||
source(project(":common").sourceSets.main.allJava)
|
|
||||||
}
|
|
||||||
tasks.named("sourcesJar", Jar) {
|
|
||||||
from(project(":common").sourceSets.main.allSource)
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
from project(":common").sourceSets.main.resources
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
mavenJava(MavenPublication) {
|
|
||||||
artifactId base.archivesName.get()
|
|
||||||
from components.java
|
|
||||||
}
|
|
||||||
}
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
url System.getenv("local_maven_url")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,13 +4,11 @@
|
||||||
"package": "com.example.examplemod.mixin",
|
"package": "com.example.examplemod.mixin",
|
||||||
"refmap": "${mod_id}.refmap.json",
|
"refmap": "${mod_id}.refmap.json",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"mixins": [
|
"mixins": [],
|
||||||
],
|
|
||||||
"client": [
|
"client": [
|
||||||
"MixinTitleScreen"
|
"MixinTitleScreen"
|
||||||
],
|
],
|
||||||
"server": [
|
"server": [],
|
||||||
],
|
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
"fabricloader": ">=${fabric_loader_version}",
|
"fabricloader": ">=${fabric_loader_version}",
|
||||||
"fabric-api": "*",
|
"fabric-api": "*",
|
||||||
"minecraft": "${minecraft_version}",
|
"minecraft": "${minecraft_version}",
|
||||||
"java": ">=17"
|
"java": ">=${java_version}"
|
||||||
},
|
},
|
||||||
"suggests": {
|
"suggests": {
|
||||||
"another-mod": "*"
|
"another-mod": "*"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'idea'
|
id 'consumer'
|
||||||
id 'maven-publish'
|
|
||||||
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
||||||
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT'
|
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT'
|
||||||
}
|
}
|
||||||
|
|
@ -22,50 +21,42 @@ minecraft {
|
||||||
// Automatically enable forge AccessTransformers if the file exists
|
// Automatically enable forge AccessTransformers if the file exists
|
||||||
// This location is hardcoded in Forge and can not be changed.
|
// This location is hardcoded in Forge and can not be changed.
|
||||||
// https://github.com/MinecraftForge/MinecraftForge/blob/be1698bb1554f9c8fa2f58e32b9ab70bc4385e60/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java#L123
|
// https://github.com/MinecraftForge/MinecraftForge/blob/be1698bb1554f9c8fa2f58e32b9ab70bc4385e60/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java#L123
|
||||||
if (file('src/main/resources/META-INF/accesstransformer.cfg').exists()) {
|
def at = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||||
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
if (at.exists()) {
|
||||||
|
accessTransformer = at
|
||||||
}
|
}
|
||||||
|
|
||||||
runs {
|
runs {
|
||||||
client {
|
client {
|
||||||
workingDirectory project.file('run')
|
workingDirectory file('runs/client')
|
||||||
ideaModule "${rootProject.name}.${project.name}.main"
|
ideaModule "${rootProject.name}.${project.name}.main"
|
||||||
taskName 'Client'
|
taskName 'Client'
|
||||||
property 'mixin.env.remapRefMap', 'true'
|
|
||||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
|
||||||
mods {
|
mods {
|
||||||
modClientRun {
|
modClientRun {
|
||||||
source sourceSets.main
|
source sourceSets.main
|
||||||
source project(":common").sourceSets.main
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
workingDirectory project.file('run')
|
workingDirectory file('runs/server')
|
||||||
ideaModule "${rootProject.name}.${project.name}.main"
|
ideaModule "${rootProject.name}.${project.name}.main"
|
||||||
taskName 'Server'
|
taskName 'Server'
|
||||||
property 'mixin.env.remapRefMap', 'true'
|
|
||||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
|
||||||
mods {
|
mods {
|
||||||
modServerRun {
|
modServerRun {
|
||||||
source sourceSets.main
|
source sourceSets.main
|
||||||
source project(":common").sourceSets.main
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data {
|
data {
|
||||||
workingDirectory project.file('run')
|
workingDirectory file('runs/data')
|
||||||
ideaModule "${rootProject.name}.${project.name}.main"
|
ideaModule "${rootProject.name}.${project.name}.main"
|
||||||
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
||||||
taskName 'Data'
|
taskName 'Data'
|
||||||
property 'mixin.env.remapRefMap', 'true'
|
|
||||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
|
||||||
mods {
|
mods {
|
||||||
modDataRun {
|
modDataRun {
|
||||||
source sourceSets.main
|
source sourceSets.main
|
||||||
source project(":common").sourceSets.main
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -76,39 +67,17 @@ sourceSets.main.resources.srcDir 'src/generated/resources'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||||
compileOnly project(":common")
|
|
||||||
annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT:processor")
|
annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT:processor")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
|
||||||
source(project(":common").sourceSets.main.allSource)
|
|
||||||
}
|
|
||||||
tasks.withType(Javadoc).configureEach {
|
|
||||||
source(project(":common").sourceSets.main.allJava)
|
|
||||||
}
|
|
||||||
tasks.named("sourcesJar", Jar) {
|
|
||||||
from(project(":common").sourceSets.main.allSource)
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
from project(":common").sourceSets.main.resources
|
|
||||||
}
|
|
||||||
|
|
||||||
jar.finalizedBy('reobfJar')
|
jar.finalizedBy('reobfJar')
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
artifactId base.archivesName.get()
|
|
||||||
from components.java
|
|
||||||
fg.component(it)
|
fg.component(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
url System.getenv("local_maven_url")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets.each {
|
sourceSets.each {
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,11 @@
|
||||||
"package": "com.example.examplemod.mixin",
|
"package": "com.example.examplemod.mixin",
|
||||||
"refmap": "${mod_id}.refmap.json",
|
"refmap": "${mod_id}.refmap.json",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"mixins": [
|
"mixins": [],
|
||||||
],
|
|
||||||
"client": [
|
"client": [
|
||||||
"MixinTitleScreen"
|
"MixinTitleScreen"
|
||||||
],
|
],
|
||||||
"server": [
|
"server": [],
|
||||||
],
|
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
# Project
|
# Project
|
||||||
version=1.0.0
|
version=1.0.0
|
||||||
group=com.example.examplemod
|
group=com.example.examplemod
|
||||||
|
java_version=17
|
||||||
|
|
||||||
# Common
|
# Common
|
||||||
minecraft_version=1.20.4
|
minecraft_version=1.20.4
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,14 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'idea'
|
id 'consumer'
|
||||||
id 'maven-publish'
|
|
||||||
id 'net.neoforged.gradle.userdev' version '7.0.107'
|
id 'net.neoforged.gradle.userdev' version '7.0.107'
|
||||||
id 'java-library'
|
|
||||||
}
|
|
||||||
base {
|
|
||||||
archivesName = "${mod_name}-neoforge-${minecraft_version}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Automatically enable neoforge AccessTransformers if the file exists
|
// Automatically enable neoforge AccessTransformers if the file exists
|
||||||
// This location is hardcoded in FML and can not be changed.
|
// This location is hardcoded in FML and can not be changed.
|
||||||
// https://github.com/neoforged/FancyModLoader/blob/a952595eaaddd571fbc53f43847680b00894e0c1/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModFile.java#L118
|
// https://github.com/neoforged/FancyModLoader/blob/a952595eaaddd571fbc53f43847680b00894e0c1/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModFile.java#L118
|
||||||
if (file('src/main/resources/META-INF/accesstransformer.cfg').exists()) {
|
def at = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||||
minecraft.accessTransformers.file file('src/main/resources/META-INF/accesstransformer.cfg')
|
if (at.exists()) {
|
||||||
|
minecraft.accessTransformers.file at
|
||||||
}
|
}
|
||||||
runs {
|
runs {
|
||||||
configureEach {
|
configureEach {
|
||||||
|
|
@ -39,38 +35,4 @@ sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "net.neoforged:neoforge:${neoforge_version}"
|
implementation "net.neoforged:neoforge:${neoforge_version}"
|
||||||
compileOnly project(":common")
|
|
||||||
}
|
|
||||||
|
|
||||||
// NeoGradle compiles the game, but we don't want to add our common code to the game's code
|
|
||||||
Spec<Task> notNeoTask = { Task it -> !it.name.startsWith("neo") } as Spec<Task>
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile).matching(notNeoTask).configureEach {
|
|
||||||
source(project(":common").sourceSets.main.allSource)
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(Javadoc).matching(notNeoTask).configureEach {
|
|
||||||
source(project(":common").sourceSets.main.allJava)
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named("sourcesJar", Jar) {
|
|
||||||
from(project(":common").sourceSets.main.allSource)
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(ProcessResources).matching(notNeoTask).configureEach {
|
|
||||||
from project(":common").sourceSets.main.resources
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
mavenJava(MavenPublication) {
|
|
||||||
artifactId base.archivesName.get()
|
|
||||||
from components.java
|
|
||||||
}
|
|
||||||
}
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
url System.getenv("local_maven_url")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -3,13 +3,11 @@
|
||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "com.example.examplemod.mixin",
|
"package": "com.example.examplemod.mixin",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"mixins": [
|
"mixins": [],
|
||||||
],
|
|
||||||
"client": [
|
"client": [
|
||||||
"MixinTitleScreen"
|
"MixinTitleScreen"
|
||||||
],
|
],
|
||||||
"server": [
|
"server": [],
|
||||||
],
|
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user