2019-07-11 09:03:08 +02:00
buildscript {
repositories {
2021-06-18 07:04:21 +02:00
maven { url = 'https://maven.minecraftforge.net' }
2019-07-11 09:03:08 +02:00
mavenCentral ( )
2021-06-18 07:04:21 +02:00
jcenter ( )
2021-11-03 03:30:02 +01:00
maven { url = 'https://repo.spongepowered.org/repository/maven-public' }
2021-11-07 04:59:58 +01:00
maven { url = 'https://maven.parchmentmc.org' }
2019-07-11 09:03:08 +02:00
}
dependencies {
2021-06-18 07:04:21 +02:00
classpath group: 'net.minecraftforge.gradle' , name: 'ForgeGradle' , version: "${forgegradle_version}" , changing: true
2021-11-03 03:30:02 +01:00
classpath "org.spongepowered:mixingradle:${mixingradle_version}"
classpath "org.parchmentmc:librarian:${librarian_version}"
2019-07-11 09:03:08 +02:00
}
}
2022-07-15 00:02:24 +02:00
2020-04-13 08:58:57 +02:00
plugins {
2021-06-18 07:04:21 +02:00
id 'com.matthewprenger.cursegradle' version "${cursegradle_version}"
2020-04-13 08:58:57 +02:00
}
2019-07-11 09:03:08 +02:00
apply plugin: 'net.minecraftforge.gradle'
2021-12-25 10:01:48 +01:00
apply plugin: 'org.parchmentmc.librarian.forgegradle'
2019-07-11 09:03:08 +02:00
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
2021-06-18 07:04:21 +02:00
apply plugin: 'org.spongepowered.mixin'
2019-07-11 09:03:08 +02:00
2022-07-15 00:02:24 +02:00
jarJar . enable ( )
2020-06-08 02:18:34 +02:00
boolean dev = System . getenv ( 'RELEASE' ) = = null | | System . getenv ( 'RELEASE' ) . equals ( 'false' ) ;
2021-12-02 23:02:00 +01:00
// jozu: I use a gradle workspace with both projects.
// The project is named Flywheel-Forge, but sub-projects are named by folder.
boolean inWorkspace = findProject ( ':Flywheel' ) ! = null
2020-06-08 02:18:34 +02:00
2022-02-06 21:22:43 +01:00
ext . buildNumber = System . getenv ( 'BUILD_NUMBER' )
2020-06-08 02:18:34 +02:00
2019-08-06 19:00:51 +02:00
group = 'com.simibubi.create'
2022-07-15 00:02:24 +02:00
archivesBaseName = "create-${artifact_minecraft_version}"
version = mod_version + ( dev & & buildNumber ! = null ? "-${buildNumber}" : '' )
2019-07-11 09:03:08 +02:00
2021-12-07 18:24:57 +01:00
java . toolchain . languageVersion = JavaLanguageVersion . of ( 17 )
2019-07-11 09:03:08 +02:00
2021-12-03 04:29:12 +01:00
println ( 'Java: ' + System . getProperty ( 'java.version' ) + ' JVM: ' + System . getProperty ( 'java.vm.version' ) + '(' + System . getProperty ( 'java.vendor' ) + ') Arch: ' + System . getProperty ( 'os.arch' ) )
2019-07-11 09:03:08 +02:00
minecraft {
2021-12-24 08:09:51 +01:00
mappings channel: 'parchment' , version: "${parchment_version}-${minecraft_version}"
2021-06-18 07:04:21 +02:00
accessTransformer = file ( 'src/main/resources/META-INF/accesstransformer.cfg' )
2021-04-10 01:23:49 +02:00
runs {
2021-06-18 07:04:21 +02:00
client {
2019-07-11 09:03:08 +02:00
workingDirectory project . file ( 'run' )
2021-01-13 06:58:40 +01:00
arg '-mixin.config=create.mixins.json'
2021-11-18 04:42:34 +01:00
arg '-mixin.config=flywheel.mixins.json'
2021-04-10 01:23:49 +02:00
//jvmArgs '-XX:+UnlockCommercialFeatures' // uncomment for profiling
2019-08-06 19:00:51 +02:00
property 'forge.logging.console.level' , 'info'
2019-07-11 09:03:08 +02:00
mods {
create {
source sourceSets . main
}
2021-12-02 23:02:00 +01:00
if ( inWorkspace ) {
flywheel {
source project ( ":Flywheel" ) . sourceSets . main
}
}
2019-07-11 09:03:08 +02:00
}
}
2019-08-06 21:51:02 +02:00
server {
2019-09-18 11:16:57 +02:00
workingDirectory project . file ( 'run/server' )
2021-01-13 06:58:40 +01:00
arg '-mixin.config=create.mixins.json'
2019-08-06 19:00:51 +02:00
property 'forge.logging.console.level' , 'info'
mods {
create {
source sourceSets . main
}
}
}
2019-07-11 09:03:08 +02:00
2019-08-06 21:51:02 +02:00
data {
2019-08-06 19:00:51 +02:00
workingDirectory project . file ( 'run' )
2020-03-28 02:27:43 +01:00
property 'forge.logging.markers' , 'REGISTRIES,REGISTRYDUMP'
2019-07-11 09:03:08 +02:00
property 'forge.logging.console.level' , 'debug'
2020-05-15 01:23:27 +02:00
args '--mod' , 'create' , '--all' , '--output' , file ( 'src/generated/resources/' ) , '--existing' , file ( 'src/main/resources' )
2019-07-11 09:03:08 +02:00
mods {
create {
source sourceSets . main
}
2021-12-02 23:02:00 +01:00
if ( inWorkspace ) {
flywheel {
source project ( ":Flywheel" ) . sourceSets . main
}
}
2019-07-11 09:03:08 +02:00
}
}
}
}
2019-09-16 12:27:28 +02:00
repositories {
2020-03-22 14:41:41 +01:00
maven {
2021-06-23 21:30:10 +02:00
// Location of the maven that hosts JEI files (and TiC)
2021-11-02 06:18:30 +01:00
name 'Progwml6 maven'
url 'https://dvs1.progwml6.com/files/maven'
2020-03-22 14:41:41 +01:00
}
2021-06-23 21:30:10 +02:00
/ * maven {
// Location of a maven mirror for JEI files, as a fallback
2021-11-02 06:18:30 +01:00
name 'ModMaven'
url 'https://modmaven.k-4u.nl'
2020-10-11 15:43:04 +02:00
} * /
2020-03-22 14:41:41 +01:00
maven {
2021-06-23 21:30:10 +02:00
// Location of the maven for vazkii's mods
2021-11-02 06:18:30 +01:00
name 'blamejared'
url 'https://maven.blamejared.com'
2020-03-22 14:41:41 +01:00
}
2020-03-23 04:09:28 +01:00
maven {
2021-06-23 21:30:10 +02:00
// Location of the maven for mixed mappings, Registrate, and Flywheel
2021-11-02 06:18:30 +01:00
name 'tterrag maven'
url 'https://maven.tterrag.com'
2020-03-23 04:09:28 +01:00
}
2021-01-20 22:36:04 +01:00
maven {
2021-11-02 06:18:30 +01:00
url 'https://www.cursemaven.com'
2021-06-19 09:29:18 +02:00
content {
includeGroup "curse.maven"
}
2021-01-20 22:36:04 +01:00
}
2021-06-26 19:13:44 +02:00
maven {
//location of the maven for dynamic trees
2021-11-02 06:18:30 +01:00
url 'https://harleyoconnor.com/maven'
2021-06-26 19:13:44 +02:00
}
2022-05-10 14:51:38 +02:00
maven {
//location of the maven for curios api
url = "https://maven.theillusivec4.top/"
}
2019-09-16 12:27:28 +02:00
}
2019-07-11 09:03:08 +02:00
dependencies {
2020-06-08 02:18:34 +02:00
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
2021-04-10 01:23:49 +02:00
2022-07-16 10:58:43 +02:00
jarJar ( group: 'com.tterrag.registrate' , name: 'Registrate' , version: '[MC1.18.2-1.1.3,)' ) {
2022-07-15 00:02:24 +02:00
jarJar . pin ( it , project . registrate_version )
}
2022-07-16 10:58:43 +02:00
// Uncomment once Forge fixes mixins for included jars
//jarJar(group: 'com.jozufozu.flywheel', name: "flywheel-forge-${flywheel_minecraft_version}", version: '[0.6.4,0.6.5)') {
// jarJar.pin(it, project.flywheel_version)
//}
2022-07-15 00:02:24 +02:00
implementation fg . deobf ( "com.tterrag.registrate:Registrate:${registrate_version}" )
2020-10-11 15:43:04 +02:00
2021-12-02 23:02:00 +01:00
if ( inWorkspace ) {
implementation project ( ':Flywheel' )
2021-06-23 06:09:32 +02:00
} else {
2022-07-16 10:58:43 +02:00
implementation fg . deobf ( "com.jozufozu.flywheel:flywheel-forge-${flywheel_minecraft_version}:${flywheel_version}" )
2021-06-23 06:09:32 +02:00
}
2020-03-22 14:41:41 +01:00
2021-12-11 01:58:05 +01:00
compileOnly fg . deobf ( "mezz.jei:jei-${jei_minecraft_version}:${jei_version}:api" )
runtimeOnly fg . deobf ( "mezz.jei:jei-${jei_minecraft_version}:${jei_version}" )
2021-06-23 21:30:10 +02:00
2022-05-10 14:51:38 +02:00
compileOnly fg . deobf ( "top.theillusivec4.curios:curios-forge:${curios_minecraft_version}-${curios_version}:api" )
runtimeOnly fg . deobf ( "top.theillusivec4.curios:curios-forge:${curios_minecraft_version}-${curios_version}" )
2021-01-20 22:36:04 +01:00
// implementation fg.deobf("curse.maven:druidcraft-340991:3101903")
2021-11-02 06:18:30 +01:00
// implementation fg.deobf("com.ferreusveritas.dynamictrees:DynamicTrees-1.16.5:0.10.0-Beta25")
2021-11-02 00:08:20 +01:00
// runtimeOnly fg.deobf("vazkii.arl:AutoRegLib:1.4-35.69")
// runtimeOnly fg.deobf("vazkii.quark:Quark:r2.0-212.984")
// runtimeOnly fg.deobf("slimeknights.mantle:Mantle:1.16.5-1.6.115")
// runtimeOnly fg.deobf("slimeknights.tconstruct:TConstruct:1.16.5-3.1.1.252")
2021-01-13 09:50:00 +01:00
2021-12-02 23:02:00 +01:00
// https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497
// Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings
// This allows 'Settings > Build, Execution, and Deployment > Build Tools > Gradle > Build and run using' set to IntelliJ to work correctly
if ( System . getProperty ( 'idea.sync.active' ) ! = 'true' ) {
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
}
2019-07-11 09:03:08 +02:00
}
2022-07-15 00:02:24 +02:00
sourceSets . main . resources {
srcDir 'src/generated/resources'
exclude '.cache/'
}
mixin {
add sourceSets . main , 'create.refmap.json'
}
2022-07-16 10:58:43 +02:00
// Workaround for SpongePowered/MixinGradle#38
afterEvaluate {
tasks . configureReobfTaskForReobfJar . mustRunAfter ( tasks . compileJava )
tasks . configureReobfTaskForReobfJarJar . mustRunAfter ( tasks . compileJava )
}
2022-07-15 00:02:24 +02:00
tasks . withType ( JavaCompile ) . configureEach {
options . encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
compileJava {
options . compilerArgs = [ '-Xdiags:verbose' ]
}
2019-07-11 09:03:08 +02:00
jar {
2020-06-10 01:34:57 +02:00
classifier = 'slim'
2019-07-11 09:03:08 +02:00
manifest {
attributes ( [
2021-11-02 06:18:30 +01:00
'Specification-Title' : 'create' ,
'Specification-Vendor' : 'simibubi' ,
'Specification-Version' : '1' ,
2022-07-16 10:58:43 +02:00
'Implementation-Title' : project . jar . baseName ,
2022-07-15 00:02:24 +02:00
'Implementation-Version' : project . jar . archiveVersion ,
2021-11-02 06:18:30 +01:00
'Implementation-Vendor' : 'simibubi' ,
'Implementation-Timestamp' : new Date ( ) . format ( "yyyy-MM-dd'T'HH:mm:ssZ" ) ,
'MixinConfigs' : 'create.mixins.json'
2019-07-11 09:03:08 +02:00
] )
}
}
2022-07-15 00:02:24 +02:00
java {
withSourcesJar ( )
withJavadocJar ( )
2020-04-13 08:58:57 +02:00
}
2022-07-15 00:02:24 +02:00
void addLicense ( jarTask ) {
jarTask . from ( 'LICENSE' ) {
rename { "${it}_${project.archivesBaseName}" }
}
2021-08-05 23:57:55 +02:00
}
2022-07-15 00:02:24 +02:00
jar . finalizedBy ( 'reobfJar' )
tasks . jarJar . finalizedBy ( 'reobfJarJar' )
2021-08-05 23:57:55 +02:00
2022-07-15 00:02:24 +02:00
addLicense ( jar )
addLicense ( tasks . jarJar )
2021-08-05 23:57:55 +02:00
publishing {
publications {
mavenJava ( MavenPublication ) {
2022-07-15 00:02:24 +02:00
artifactId = archivesBaseName
from components . java
2022-07-16 10:58:43 +02:00
fg . component ( it )
2022-07-15 00:02:24 +02:00
jarJar . component ( it )
2021-08-05 23:57:55 +02:00
}
}
repositories {
if ( project . hasProperty ( 'mavendir' ) ) {
maven { url mavendir }
}
}
}
2020-06-08 02:18:34 +02:00
String getChangelogText ( ) {
def changelogFile = file ( 'changelog.txt' )
String str = ''
int lineCount = 0
boolean done = false
changelogFile . eachLine {
if ( done | | it = = null ) {
return
}
if ( it . size ( ) > 1 ) {
def temp = it
if ( lineCount = = 0 ) {
temp = "Create ${version}"
2020-06-10 01:42:57 +02:00
temp = "<span style=\"font-size: 18px; color: #333399;\">Create v${mod_version}</span> <em>for Minecraft ${minecraft_version}</em><br/>"
2020-06-08 02:18:34 +02:00
} else if ( it . startsWith ( '-' ) ) {
temp = " $temp<br/>"
temp = temp . replaceAll ( "(\\S+\\/\\S+)#([0-9]+)\\b" , "<a href=\"https://github.com/\$1/issues/\$2\">\$0</a>" ) ;
temp = temp . replaceAll ( "#([0-9]+)\\b(?!<\\/a>)" , "<a href=\"https://github.com/$github_project/issues/\$1\">\$0</a>" ) ;
} else {
temp = "<h4>$temp</h4>"
}
str + = temp
lineCount + +
} else {
2020-06-10 01:42:57 +02:00
str + = "<p>Please submit any Issues you come across on the <a href=\"https://github.com/${github_project}/issues\" rel=\"nofollow\">Issue Tracker</a>.</p>"
2020-06-08 02:18:34 +02:00
done = true
2019-07-11 09:03:08 +02:00
}
}
2020-06-08 02:18:34 +02:00
return str
}
2021-11-02 00:08:20 +01:00
// changelog debugging
// new File("changelog.html").write getChangelogText()
// tasks.curseforge.enabled = !dev && project.hasProperty('simi_curseforge_key')
// curseforge {
// if (project.hasProperty('simi_curseforge_key')) {
// apiKey = project.simi_curseforge_key
// }
2021-11-27 21:46:01 +01:00
//
2021-11-02 00:08:20 +01:00
// project {
// id = project.projectId
// changelog = System.getenv('CHANGELOG') == null || System.getenv('CHANGELOG').equals('none') ? getChangelogText() : System.getenv('CHANGELOG')
// changelogType = 'html'
// releaseType = project.curse_type
// mainArtifact(shadowJar) {
// displayName = "Create - ${version}"
// }
// relations {
// optionalDependency 'jei'
// }
// }
// }