generated from Anvil-Dev/ArchitecturyExampleMod
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
127 changed files
with
308 additions
and
1,514 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 was deleted.
Oops, something went wrong.
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,121 +1,165 @@ | ||
import net.fabricmc.loom.task.RemapJarTask | ||
|
||
plugins { | ||
id "architectury-plugin" version "3.4-SNAPSHOT" | ||
id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false | ||
id 'java-library' | ||
id 'eclipse' | ||
id 'idea' | ||
id 'maven-publish' | ||
id 'net.neoforged.moddev' version '2.0.27-beta' | ||
} | ||
|
||
def is_root_project = project == rootProject | ||
version = mod_version | ||
group = mod_group_id | ||
|
||
repositories { | ||
mavenLocal() | ||
} | ||
|
||
architectury { | ||
minecraft = libs.versions.minecraft | ||
base { | ||
archivesName = mod_id | ||
} | ||
|
||
subprojects { | ||
apply plugin: "dev.architectury.loom" | ||
java.toolchain.languageVersion = JavaLanguageVersion.of(21) | ||
|
||
neoForge { | ||
// Specify the version of NeoForge to use. | ||
version = project.neo_version | ||
|
||
loom { | ||
silentMojangMappingsLicense() | ||
parchment { | ||
mappingsVersion = project.parchment_mappings_version | ||
minecraftVersion = project.parchment_minecraft_version | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
maven { url = "https://api.modrinth.com/maven" } // LazyDFU, Jade | ||
maven { url = "https://maven.terraformersmc.com/releases/" } // Mod Menu, EMI | ||
maven { url = "https://maven.shedaniel.me/" } // Cloth Config, REI | ||
maven { | ||
url "https://cursemaven.com" | ||
content { | ||
includeGroup "curse.maven" | ||
} | ||
} // Curse Forge File | ||
maven { | ||
name = "Jared's maven" | ||
url = "https://maven.blamejared.com/" | ||
} // JEI | ||
maven { | ||
// location of a maven mirror for JEI files, as a fallback | ||
name = "ModMaven" | ||
url = "https://modmaven.dev" | ||
} // JEI mirror, AE2 | ||
maven { url = "https://maven.parchmentmc.org" } // Parchment mappings | ||
maven { url = "https://maven.quiltmc.org/repository/release" } // Quilt Mappings | ||
maven { url = "https://maven.firstdarkdev.xyz/snapshots" } // LDLib | ||
maven { // Flywheel | ||
url = "https://maven.tterrag.com/" | ||
content { | ||
// need to be specific here due to version overlaps | ||
includeGroup("com.jozufozu.flywheel") | ||
includeGroup("com.simibubi.create") | ||
} | ||
// This line is optional. Access Transformers are automatically detected | ||
// accessTransformers.add('src/main/resources/META-INF/accesstransformer.cfg') | ||
|
||
// Default run configurations. | ||
// These can be tweaked, removed, or duplicated as needed. | ||
runs { | ||
client { | ||
client() | ||
|
||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces. | ||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id | ||
} | ||
maven { // TOP-Fabric | ||
url "https://maven.wispforest.io" | ||
|
||
server { | ||
server() | ||
programArgument '--nogui' | ||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id | ||
} | ||
} | ||
|
||
dependencies { | ||
minecraft "com.mojang:minecraft:${libs.versions.minecraft.get()}" | ||
// The following line declares the mojmap mappings, you may use other mappings as well | ||
if (is_root_project) { | ||
// layered mappings - Mojmap names, parchment and QM docs and parameters | ||
mappings loom.layered { | ||
it.mappings("org.quiltmc:quilt-mappings:${libs.versions.minecraft.get()}+build.${libs.versions.quiltMappings.get()}:intermediary-v2") | ||
it.parchment("org.parchmentmc.data:parchment-1.21:${libs.versions.parchment.get()}@zip") | ||
it.officialMojangMappings { nameSyntheticMembers = false } | ||
} | ||
// 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 { | ||
type = "gameTestServer" | ||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id | ||
} | ||
|
||
// lombok | ||
compileOnly 'org.projectlombok:lombok:1.18.24' | ||
annotationProcessor 'org.projectlombok:lombok:1.18.24' | ||
data { | ||
data() | ||
|
||
implementation 'com.google.code.findbugs:jsr305:3.0.2' | ||
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it | ||
// gameDirectory = project.file('run-data') | ||
|
||
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. | ||
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath() | ||
} | ||
|
||
// applies to all the run configs above | ||
configureEach { | ||
// 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. | ||
systemProperty '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 | ||
logLevel = org.slf4j.event.Level.DEBUG | ||
} | ||
} | ||
|
||
tasks.register('remapSlimJar', RemapJarTask) { | ||
dependsOn(jar) | ||
inputFile.set(jar.archiveFile) | ||
addNestedDependencies = false | ||
archiveClassifier.set("slim") | ||
mods { | ||
// define mod <-> source bindings | ||
// these are used to tell the game which sources are for which mod | ||
// mostly optional in a single mod project | ||
// but multi mod projects should define one per mod | ||
"${mod_id}" { | ||
sourceSet(sourceSets.main) | ||
} | ||
} | ||
} | ||
|
||
// Include resources generated by data generators. | ||
sourceSets.main.resources { srcDir 'src/generated/resources' } | ||
|
||
|
||
dependencies { | ||
// Example mod dependency with JEI | ||
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime | ||
// compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}" | ||
// compileOnly "mezz.jei:jei-${mc_version}-forge-api:${jei_version}" | ||
// runtimeOnly "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 "blank:coolmod-${mc_version}:${coolmod_version}" | ||
|
||
// Example mod dependency using a file as dependency | ||
// implementation files("libs/coolmod-${mc_version}-${coolmod_version}.jar") | ||
|
||
// Example project dependency using a sister or child project: | ||
// implementation project(":myproject") | ||
|
||
tasks.remapJar.dependsOn('remapSlimJar') | ||
// For more info: | ||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html | ||
// http://www.gradle.org/docs/current/userguide/dependency_management.html | ||
} | ||
|
||
allprojects { | ||
apply plugin: "java" | ||
apply plugin: "architectury-plugin" | ||
apply plugin: "maven-publish" | ||
|
||
archivesBaseName = "${project.name}-${libs.versions.minecraft.get()}" | ||
group = rootProject.maven_group | ||
|
||
// Formats the mod version to include the loader, Minecraft version, and build number (if present) | ||
String buildType = 'build' | ||
String buildNumber | ||
if (System.getenv("CI_BUILD") == 'false') buildNumber = null | ||
else { | ||
if (System.getenv("PR_BUILD") != 'false') buildType = 'pr' | ||
buildNumber = System.getenv("GITHUB_RUN_NUMBER") | ||
// 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 | ||
tasks.withType(ProcessResources).configureEach { | ||
var replaceProperties = [minecraft_version : minecraft_version, | ||
minecraft_version_range: minecraft_version_range, | ||
neo_version : neo_version, | ||
neo_version_range : neo_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 | ||
|
||
filesMatching(['META-INF/neoforge.mods.toml']) { | ||
expand replaceProperties | ||
} | ||
version = "${mod_version}" + (buildNumber != null ? "+${buildType}.${buildNumber}" : "") | ||
} | ||
|
||
repositories { | ||
// Add repositories to retrieve artifacts from in here. | ||
// You should only use this when depending on other mods because | ||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically. | ||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html | ||
// for more information about repositories. | ||
// Example configuration to allow publishing using the maven-publish plugin | ||
publishing { | ||
publications { | ||
register('mavenJava', MavenPublication) { | ||
from components.java | ||
} | ||
} | ||
|
||
tasks.withType(JavaCompile) { | ||
options.encoding = "UTF-8" | ||
options.release.set(Integer.valueOf(java_version)) | ||
repositories { | ||
maven { | ||
url "file://${project.projectDir}/repo" | ||
} | ||
} | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior. | ||
idea { | ||
module { | ||
downloadSources = true | ||
downloadJavadoc = true | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.