123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- import java.util.stream.Collectors
- buildscript {
- repositories {
- maven { url = 'https://maven.minecraftforge.net' }
- mavenCentral()
- maven { url 'https://maven.parchmentmc.org' }
- maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
- }
- dependencies {
- classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
- classpath group: 'org.parchmentmc', name: 'librarian', version: '1.+'
- classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT'
- }
- }
- apply plugin: 'net.minecraftforge.gradle'
- apply plugin: 'eclipse'
- apply plugin: 'org.parchmentmc.librarian.forgegradle'
- apply plugin: 'org.spongepowered.mixin'
- apply plugin: 'ferritecore.loader-conventions'
- def fcMixinConfigs = [
- "predicates",
- "fastmap",
- "mrl",
- "dedupmultipart",
- "blockstatecache",
- "dedupbakedquad",
- "threaddetec",
- ].stream()
- .<String> map({ s -> "ferritecore." + s + ".mixin.json" })
- .collect(Collectors.toList())
- // Work around what I consider a bug in FG: Common:googleimpl source set is specified as mod source, but FG tries to
- // compile it in this project
- sourceSets {
- googleimpl
- }
- minecraft {
- mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}"
- runs {
- client {
- workingDirectory project.file('run')
- ideaModule "${rootProject.name}.${project.name}.main"
- property 'forge.logging.console.level', 'debug'
- mods {
- ferritecore {
- source sourceSets.main
- source project(":Common").sourceSets.main
- source project(":Common").sourceSets.googleimpl
- }
- }
- }
- server {
- workingDirectory project.file('run')
- ideaModule "${rootProject.name}.${project.name}.main"
- property 'forge.logging.console.level', 'debug'
- mods {
- ferritecore {
- source sourceSets.main
- source project(":Common").sourceSets.main
- source project(":Common").sourceSets.googleimpl
- }
- }
- }
- }
- }
- dependencies {
- minecraft group: 'net.minecraftforge', name: 'forge', version: "${minecraft_version}-${forge_version}"
- annotationProcessor group: 'org.spongepowered', name: 'mixin', version: '0.8.5', classifier: 'processor'
- }
- jar.finalizedBy('reobfJar')
- mixin {
- add project(":Common").sourceSets.main, "${mod_id}.refmap.json"
- configNames += fcMixinConfigs
- }
- jar {
- filesMatching("*.mixin.json") {
- expand "refmap_target": "${mod_id}."
- }
- }
- task speedUpPreRun {
- doLast {
- for (String s : new String[]{"Client", "Server"}) {
- ant.replace(
- file: project.rootDir.toString() + "/.idea/runConfigurations/Forge_run" + s + ".xml",
- // prepareRunX is prepareRuns + compile, but compiling is already handled by IntelliJ
- // Also (specific to FC), compiling doesn't properly see the googleimpl source set and breaks
- token: "prepareRun" + s,
- value: "prepareRuns"
- )
- }
- }
- }
- tasks.withType(Task) {
- if (it.name == "genIntellijRuns") {
- it.finalizedBy speedUpPreRun
- }
- }
- // For some reason this doesn't work when in the "convention" scripts...
- def customGradle = project.file('custom.gradle');
- if (customGradle.exists()) {
- apply from: customGradle;
- }
|