Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement TwitchSpawn with Architectury API #69

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,4 @@ gradle-app.setting
**/build/

# End of https://www.gitignore.io/api/java,gradle,intellij
/common/src/main/corrected/
231 changes: 41 additions & 190 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,208 +1,59 @@
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net' }
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath 'gradle.plugin.com.github.johnrengelman:shadow:7.1.2'
}
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'maven-publish'

version = mod_version
group = "igoodie.twitchspawn"
archivesBaseName = "twitchspawn_" + minecraft_version

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 {
// The mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD Snapshot are built nightly.
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: mcpMappings_channel, version: mcpMappings_version
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.

// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
workingDirectory project.file('run')

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

mods {
examplemod {
source sourceSets.main
}
}
}

server {
workingDirectory project.file('run')

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

mods {
examplemod {
source sourceSets.main
}
}
}

data {
workingDirectory project.file('run')

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/')

mods {
examplemod {
source sourceSets.main
}
}
}
}
}

repositories {
jcenter()
mavenCentral()
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false
}

configurations {
shade
implementation.extendsFrom shade
}

dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"

// Nightly Config by Electronwill
// shadow group: 'com.electronwill.night-config', name: 'core', version: '3.6.0'
// shadow group: 'com.electronwill.night-config', name: 'toml', version: '3.6.0'

// SocketIO Client
shade "io.socket:socket.io-client:1.0.0"
minecraftLibrary "io.socket:socket.io-client:1.0.0"

// JUnit 5 for testings
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.0'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.5.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.0'

// For more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html

architectury {
minecraft = rootProject.minecraft_version
}

//// Fix the classpath the right way and once and for all
//afterEvaluate {
// // Collect deps in runtimeClasspath but NOT in minecraft
// def deps = (configurations.runtimeClasspath - configurations.minecraft).join(';')
// // Add deps to classpath
// minecraft.runs.each { run ->
// run.token 'minecraft_classpath', deps
// }
//}

//jar {
// configurations.shade.each { dep ->
// from(project.zipTree(dep)) {
// exclude 'META-INF', 'META-INF/**'
// }
// }
//}

//shadowJar {
// configurations = [project.configurations.shadow]
// classifier ""
//// relocate 'com.electronwill.nightconfig.core', "com.electronwill.nightconfig.${mod_id}.core"
//// relocate 'com.electronwill.nightconfig.toml', "com.electronwill.nightconfig.${mod_id}.toml"
//// relocate "io.socket.client", "io.socket.${mod_id}.client"
//}
subprojects {
apply plugin: "dev.architectury.loom"

// ====================================
loom {
silentMojangMappingsLicense()
}

// Example for how to get properties into the manifest for reading by the runtime..
jar {
archiveClassifier = 'slim'
//noinspection GroovyAssignabilityCheck
manifest {
attributes([
"Specification-Title" : mod_id,
"Specification-Vendor" : mod_group,
"Specification-Version" : "1.0",
"Implementation-Title" : project.name,
"Implementation-Version" : "${mod_version}",
"Implementation-Vendor" : mod_group,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the mojmap mappings, you may use other mappings as well
mappings loom.officialMojangMappings()
// The following line declares the yarn mappings you may select this one as well.
// mappings "net.fabricmc:yarn:@YARN_MAPPINGS@:v2"
}
}

shadowJar {
archiveClassifier = ''
configurations = [project.configurations.shade]
finalizedBy 'reobfShadowJar'
}
allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"

assemble.dependsOn shadowJar
base {
archivesName = rootProject.archives_base_name
}

reobf {
shadowJar {}
}
version = rootProject.mod_version
group = rootProject.maven_group

// ====================================
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 task
// This is the preferred method to reobfuscate your jar file
jar.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
//publish.dependsOn('reobfJar')

publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
}
dependencies {
implementation 'org.json:json:20231013'
}
repositories {
maven {
url "file:///${project.projectDir}/mcmodsrepo"
}

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release.set(17)
}
}

test {
useJUnitPlatform()
java {
withSourcesJar()
}
}
37 changes: 37 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
}


dependencies {
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
// Do NOT use other classes from fabric loader
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
// Remove the next line if you don't want to depend on the API
modApi "dev.architectury:architectury:${rootProject.architectury_version}"

// Add JSON dependency
compileOnly "com.electronwill.night-config:core:3.6.4"
compileOnly "com.electronwill.night-config:toml:3.6.4"

implementation 'com.squareup.okhttp3:okhttp:3.8.1'
implementation 'io.socket:socket.io-client:1.0.2'
}

architectury {
common("fabric", "forge")
}

publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archives_base_name
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}
Loading