-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to Forge 48.1.0 & Neoforge 20.2.86
- Move to Multiloader mod template to support Forge and Neoforge
- Loading branch information
Showing
68 changed files
with
991 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ build | |
# other | ||
eclipse | ||
run | ||
runs | ||
run-data | ||
|
||
# Files from Forge MDK | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,169 +1,91 @@ | ||
plugins { | ||
id 'eclipse' | ||
id 'idea' | ||
id 'maven-publish' | ||
id 'net.minecraftforge.gradle' version '[6.0,6.2)' | ||
// Required for NeoGradle | ||
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7" | ||
} | ||
|
||
version = "${minecraft_version}-${mod_version}" | ||
group = mod_group_id | ||
base { | ||
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) | ||
|
||
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: minecraft_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 | ||
|
||
// 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 | ||
|
||
// See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information. | ||
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') | ||
|
||
// Default run configurations. | ||
runs { | ||
// applies to all the run configs below | ||
configureEach { | ||
workingDirectory project.file('run') | ||
|
||
// Recommended logging data for a userdev environment | ||
// The markers can be added/remove as needed separated by commas. | ||
// "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' | ||
|
||
//for bucketlib | ||
property 'mixin.env.remapRefMap', 'true' | ||
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg" | ||
|
||
mods { | ||
"${mod_id}" { | ||
source sourceSets.main | ||
} | ||
} | ||
} | ||
|
||
client { | ||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces. | ||
property 'forge.enabledGameTestNamespaces', mod_id | ||
subprojects { | ||
apply plugin: 'java' | ||
|
||
version "$project.minecraft_version-$project.mod_version" | ||
|
||
java.toolchain.languageVersion = JavaLanguageVersion.of(17) | ||
//java.withSourcesJar() | ||
//java.withJavadocJar() | ||
|
||
jar { | ||
from(rootProject.file("LICENSE")) | ||
manifest { | ||
attributes([ | ||
'Specification-Title' : mod_id, | ||
'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 | ||
]) | ||
} | ||
} | ||
|
||
server { | ||
property 'forge.enabledGameTestNamespaces', mod_id | ||
args '--nogui' | ||
} | ||
//sourcesJar { | ||
// from(rootProject.file("LICENSE")) | ||
//} | ||
|
||
gameTestServer { | ||
property 'forge.enabledGameTestNamespaces', mod_id | ||
repositories { | ||
mavenCentral() | ||
maven { | ||
name = 'Sponge / Mixin' | ||
url = 'https://repo.spongepowered.org/repository/maven-public/' | ||
} | ||
|
||
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/') | ||
maven { | ||
name = 'BlameJared Maven (JEI / CraftTweaker / Bookshelf)' | ||
url = 'https://maven.blamejared.com' | ||
} | ||
} | ||
} | ||
|
||
// Include resources generated by data generators. | ||
sourceSets.main.resources { srcDir 'src/generated/resources' } | ||
|
||
repositories { | ||
maven { | ||
name 'Jitpack' | ||
url 'https://jitpack.io' | ||
} | ||
maven { | ||
url 'https://repo.maven.apache.org/maven2' | ||
name 'Maven Central' | ||
} | ||
} | ||
|
||
dependencies { | ||
minecraft "net.minecraftforge:forge:${project.minecraft_version}-${project.forge_version}" | ||
|
||
// compile against the BucketLib API but do not include it at runtime | ||
compileOnly fg.deobf("com.github.cech12:BucketLib:${project.bucketlib_version}:api") | ||
// at runtime, use the full BucketLib jar | ||
runtimeOnly fg.deobf("com.github.cech12:BucketLib:${project.bucketlib_version}") | ||
} | ||
|
||
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, mod_issue_tracker: mod_issue_tracker, | ||
mod_url: mod_url, | ||
bucketlib_version_range: bucketlib_version_range | ||
] | ||
inputs.properties replaceProperties | ||
|
||
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { | ||
expand replaceProperties + [project: project] | ||
} | ||
} | ||
|
||
tasks.named('jar', Jar).configure { | ||
manifest { | ||
attributes([ | ||
'Specification-Title' : mod_id, | ||
'Specification-Vendor' : mod_authors, | ||
'Specification-Version' : project.jar.archiveVersion, | ||
'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") | ||
]) | ||
tasks.withType(JavaCompile).configureEach { | ||
it.options.encoding = 'UTF-8' | ||
it.options.getRelease().set(17) | ||
} | ||
|
||
// This is the preferred method to reobfuscate your jar file | ||
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: | ||
// tasks.named('publish').configure { | ||
// dependsOn 'reobfJar' | ||
// } | ||
|
||
publishing { | ||
publications { | ||
register('mavenJava', MavenPublication) { | ||
artifact jar | ||
processResources { | ||
def expandProps = [ | ||
"version": version, | ||
"group": project.group, //Else we target the task's group. | ||
"minecraft_version": minecraft_version, | ||
"minecraft_version_range": minecraft_version_range, | ||
"forge_version": forge_version, | ||
"forge_version_range": forge_version_range, | ||
"forge_loader_version_range": forge_loader_version_range, | ||
//"fabric_version": fabric_version, | ||
//"fabric_loader_version": fabric_loader_version, | ||
"neoforge_version": neoforge_version, | ||
"neoforge_version_range": neoforge_version_range, | ||
"neoforge_loader_version_range": neoforge_loader_version_range, | ||
"mod_id": mod_id, | ||
"mod_name": mod_name, | ||
"mod_author": mod_author, | ||
"mod_license": mod_license, | ||
"mod_url": mod_url, | ||
"mod_issue_tracker": mod_issue_tracker, | ||
"mod_description": project.description, | ||
"bucketlib_version": bucketlib_version, | ||
"bucketlib_version_range": bucketlib_version_range | ||
] | ||
|
||
filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml', '*.mixins.json']) { | ||
expand expandProps | ||
} | ||
inputs.properties(expandProps) | ||
} | ||
repositories { | ||
maven { | ||
url "file://${project.projectDir}/mcmodsrepo" | ||
} | ||
} | ||
} | ||
|
||
tasks.withType(JavaCompile).configureEach { | ||
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation | ||
} | ||
// 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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
plugins { | ||
id 'idea' | ||
id 'java' | ||
id 'maven-publish' | ||
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT' | ||
} | ||
base { | ||
archivesName = "${mod_id}-common" | ||
} | ||
minecraft { | ||
version(minecraft_version) | ||
if(file("src/main/resources/${mod_id}.accesswidener").exists()){ | ||
accessWideners(file("src/main/resources/${mod_id}.accesswidener")) | ||
} | ||
} | ||
|
||
dependencies { | ||
compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5' | ||
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1' | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
artifactId base.archivesName.get() | ||
from components.java | ||
} | ||
} | ||
repositories { | ||
maven { | ||
url "file://" + System.getenv("local_maven") | ||
} | ||
} | ||
} |
Oops, something went wrong.