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
89
build.gradle
89
build.gradle
|
|
@ -1,91 +1,4 @@
|
|||
plugins {
|
||||
// Required for NeoGradle
|
||||
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 {
|
||||
id 'idea'
|
||||
id 'java'
|
||||
id 'maven-publish'
|
||||
id 'shared'
|
||||
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
|
||||
}
|
||||
base {
|
||||
archivesName = "${mod_name}-common-${minecraft_version}"
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version(minecraft_version)
|
||||
if(file("src/main/resources/${mod_id}.accesswidener").exists()){
|
||||
accessWideners(file("src/main/resources/${mod_id}.accesswidener"))
|
||||
def aw = file("src/main/resources/${mod_id}.accesswidener")
|
||||
if(aw.exists()){
|
||||
accessWideners(aw)
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5'
|
||||
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
|
||||
compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5'
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifactId base.archivesName.get()
|
||||
from components.java
|
||||
}
|
||||
configurations {
|
||||
commonJava {
|
||||
canBeResolved = false
|
||||
canBeConsumed = true
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
url System.getenv("local_maven_url")
|
||||
}
|
||||
commonResources {
|
||||
canBeResolved = false
|
||||
canBeConsumed = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.TitleScreen;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.example.examplemod.mixin",
|
||||
"refmap": "${mod_id}.refmap.json",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"MixinMinecraft"
|
||||
],
|
||||
"server": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.example.examplemod.mixin",
|
||||
"refmap": "${mod_id}.refmap.json",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [],
|
||||
"client": [
|
||||
"MixinMinecraft"
|
||||
],
|
||||
"server": [],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,18 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'consumer'
|
||||
id 'fabric-loom' version '1.6-SNAPSHOT'
|
||||
}
|
||||
base {
|
||||
archivesName = "${mod_name}-fabric-${minecraft_version}"
|
||||
}
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:${minecraft_version}"
|
||||
mappings loom.officialMojangMappings()
|
||||
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_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 {
|
||||
if (project(":common").file("src/main/resources/${mod_id}.accesswidener").exists()) {
|
||||
accessWidenerPath.set(project(":common").file("src/main/resources/${mod_id}.accesswidener"))
|
||||
def aw = project(":common").file("src/main/resources/${mod_id}.accesswidener")
|
||||
if (aw.exists()) {
|
||||
accessWidenerPath.set(aw)
|
||||
}
|
||||
mixin {
|
||||
defaultRefmapName.set("${mod_id}.refmap.json")
|
||||
|
|
@ -28,41 +22,13 @@ loom {
|
|||
client()
|
||||
setConfigName("Fabric Client")
|
||||
ideConfigGenerated(true)
|
||||
runDir("run")
|
||||
runDir("runs/client")
|
||||
}
|
||||
server {
|
||||
server()
|
||||
setConfigName("Fabric Server")
|
||||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,16 @@
|
|||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.example.examplemod.mixin",
|
||||
"refmap": "${mod_id}.refmap.json",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"MixinTitleScreen"
|
||||
],
|
||||
"server": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.example.examplemod.mixin",
|
||||
"refmap": "${mod_id}.refmap.json",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [],
|
||||
"client": [
|
||||
"MixinTitleScreen"
|
||||
],
|
||||
"server": [],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
"fabricloader": ">=${fabric_loader_version}",
|
||||
"fabric-api": "*",
|
||||
"minecraft": "${minecraft_version}",
|
||||
"java": ">=17"
|
||||
"java": ">=${java_version}"
|
||||
},
|
||||
"suggests": {
|
||||
"another-mod": "*"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
plugins {
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'consumer'
|
||||
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
||||
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT'
|
||||
}
|
||||
|
|
@ -22,50 +21,42 @@ minecraft {
|
|||
// Automatically enable forge AccessTransformers if the file exists
|
||||
// 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
|
||||
if (file('src/main/resources/META-INF/accesstransformer.cfg').exists()) {
|
||||
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
def at = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
if (at.exists()) {
|
||||
accessTransformer = at
|
||||
}
|
||||
|
||||
runs {
|
||||
client {
|
||||
workingDirectory project.file('run')
|
||||
workingDirectory file('runs/client')
|
||||
ideaModule "${rootProject.name}.${project.name}.main"
|
||||
taskName 'Client'
|
||||
property 'mixin.env.remapRefMap', 'true'
|
||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
||||
mods {
|
||||
modClientRun {
|
||||
source sourceSets.main
|
||||
source project(":common").sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
workingDirectory project.file('run')
|
||||
workingDirectory file('runs/server')
|
||||
ideaModule "${rootProject.name}.${project.name}.main"
|
||||
taskName 'Server'
|
||||
property 'mixin.env.remapRefMap', 'true'
|
||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
||||
mods {
|
||||
modServerRun {
|
||||
source sourceSets.main
|
||||
source project(":common").sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data {
|
||||
workingDirectory project.file('run')
|
||||
workingDirectory file('runs/data')
|
||||
ideaModule "${rootProject.name}.${project.name}.main"
|
||||
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
||||
taskName 'Data'
|
||||
property 'mixin.env.remapRefMap', 'true'
|
||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
||||
mods {
|
||||
modDataRun {
|
||||
source sourceSets.main
|
||||
source project(":common").sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -76,39 +67,17 @@ sourceSets.main.resources.srcDir 'src/generated/resources'
|
|||
|
||||
dependencies {
|
||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||
compileOnly project(":common")
|
||||
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')
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifactId base.archivesName.get()
|
||||
from components.java
|
||||
fg.component(it)
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
url System.getenv("local_maven_url")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.each {
|
||||
|
|
|
|||
|
|
@ -1,17 +1,15 @@
|
|||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.example.examplemod.mixin",
|
||||
"refmap": "${mod_id}.refmap.json",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"MixinTitleScreen"
|
||||
],
|
||||
"server": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.example.examplemod.mixin",
|
||||
"refmap": "${mod_id}.refmap.json",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [],
|
||||
"client": [
|
||||
"MixinTitleScreen"
|
||||
],
|
||||
"server": [],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
# Project
|
||||
version=1.0.0
|
||||
group=com.example.examplemod
|
||||
java_version=17
|
||||
|
||||
# Common
|
||||
minecraft_version=1.20.4
|
||||
|
|
|
|||
|
|
@ -1,18 +1,14 @@
|
|||
plugins {
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'consumer'
|
||||
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
|
||||
// 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
|
||||
if (file('src/main/resources/META-INF/accesstransformer.cfg').exists()) {
|
||||
minecraft.accessTransformers.file file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
def at = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
if (at.exists()) {
|
||||
minecraft.accessTransformers.file at
|
||||
}
|
||||
runs {
|
||||
configureEach {
|
||||
|
|
@ -39,38 +35,4 @@ sourceSets.main.resources { srcDir 'src/generated/resources' }
|
|||
|
||||
dependencies {
|
||||
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +1,14 @@
|
|||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.example.examplemod.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"MixinTitleScreen"
|
||||
],
|
||||
"server": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.example.examplemod.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [],
|
||||
"client": [
|
||||
"MixinTitleScreen"
|
||||
],
|
||||
"server": [],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user