diff --git a/Common/build.gradle b/Common/build.gradle deleted file mode 100644 index a76e3bd..0000000 --- a/Common/build.gradle +++ /dev/null @@ -1,30 +0,0 @@ -apply plugin: 'org.spongepowered.gradle.vanilla' - -println "Using Minecraft: $minecraft_version" - -minecraft { - version minecraft_version - if(file("src/main/resources/${mod_id}.accesswidener").exists()) { - accessWideners file("src/main/resources/${mod_id}.accesswidener") - } -} - -repositories { - mavenCentral() { - content { - includeGroup 'org.projectlombok' - } - } - maven { url 'https://maven.nova-committee.cn/releases' } -} - -dependencies { - implementation ("org.spongepowered:mixin:0.8.5") - compileOnly ("org.projectlombok:lombok:$lombok_version") - annotationProcessor ("org.projectlombok:lombok:$lombok_version") - implementation ("cn.evole.onebot:OneBot-Client:$onebot_client_version"){transitive = false} - implementation ("org.spongepowered:configurate-yaml:$yaml_version") - implementation ("org.yaml:snakeyaml:1.28") - implementation("com.github.houbb:csv:0.2.0") - implementation ("com.google.code.findbugs:jsr305:3.0.1") -} \ No newline at end of file diff --git a/Common/src/main/resources/mcbot.mixins.json b/Common/src/main/resources/mcbot.mixins.json deleted file mode 100644 index 145e564..0000000 --- a/Common/src/main/resources/mcbot.mixins.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "required": true, - "minVersion": "0.8", - "package": "cn.evole.mods.mcbot.mixin", - "refmap": "${mod_id}.refmap.json", - "compatibilityLevel": "JAVA_17", - "mixins": [ - ], - "client": [ - ], - "server": [ - ], - "injectors": { - "defaultRequire": 1 - } -} - diff --git a/Fabric/build.gradle b/Fabric/build.gradle deleted file mode 100644 index e4f7d09..0000000 --- a/Fabric/build.gradle +++ /dev/null @@ -1,156 +0,0 @@ -import net.darkhax.curseforgegradle.Constants as CFConstants -import net.darkhax.curseforgegradle.TaskPublishCurseForge - -plugins { - id 'fabric-loom' version '1.7.+' - id 'com.github.johnrengelman.shadow' -} - -base { - archivesName = "$mod_name-fabric-$minecraft_version" -} - -println "Fabric API: $fabric_version, Loader: $fabric_loader_version" - -configurations { - shadowBundle { - canBeResolved = true - canBeConsumed = false - } -} - -loom { - runs { - configureEach { - ideConfigGenerated(true) - runDir("../Common/run") - } - - client { - client() - - setConfigName('Fabric: Client') - } - } - - mixin { - useLegacyMixinAp = false - } - - if (project(":Common").file("src/main/resources/${mod_id}.accesswidener").exists()) { - accessWidenerPath.set(project(":Common").file("src/main/resources/${mod_id}.accesswidener")) - } -} - -repositories { - maven { url 'https://maven.nova-committee.cn/releases' } - maven { url 'https://maven.minecraftforge.net/' } - maven { url 'https://maven.parchmentmc.org' } -} - -dependencies { - minecraft "com.mojang:minecraft:$minecraft_version" - - mappings loom.layered() { - officialMojangMappings() - parchment("org.parchmentmc.data:parchment-$minecraft_version:$mappings_version@zip") - } - - compileOnly project(':Common') - - modImplementation "net.fabricmc:fabric-loader:$fabric_loader_version" - modImplementation "net.fabricmc.fabric-api:fabric-api:$fabric_version" - - implementation shadowBundle("cn.evole.onebot:OneBot-Client:$onebot_client_version"){transitive = false} - implementation shadowBundle("org.spongepowered:configurate-yaml:$yaml_version"){transitive = true} - implementation shadowBundle("com.github.houbb:csv:0.2.0") - implementation ("org.yaml:snakeyaml:1.28") - - compileOnly "org.projectlombok:lombok:$lombok_version" - annotationProcessor "org.projectlombok:lombok:$lombok_version" -} - -shadowJar { - configurations = [project.configurations.shadowBundle] - archiveClassifier.set("") - - relocate 'org.yaml', 'cn.evole.dependencies.yaml' - relocate 'org.spongepowered', 'cn.evole.dependencies.spongepowered' - relocate 'io.leangen', 'cn.evole.dependencies.leagen' - relocate 'org.checkerframework', 'cn.evole.dependencies.checkerframework' - relocate 'com.google.errorprone', 'cn.evole.dependencies.errorprone' - relocate 'org.apiguardian', 'cn.evole.dependencies.apiguardian' - relocate 'com.github.houbb', 'cn.evole.dependencies.houbb' -} - -remapJar { - input.set shadowJar.archiveFile - dependsOn shadowJar -} - -sourcesJar { - def commonSources = project(":Common").sourcesJar - dependsOn commonSources - from commonSources.archiveFile.map { zipTree(it) } -} - -artifacts { - archives remapJar - archives sourcesJar -} - -tasks.register('publishCurseForge', TaskPublishCurseForge) { - dependsOn(tasks.remapJar) - - apiToken = System.getenv('CURSEFORGE_TOKEN') - - var modFile = upload('534155', tasks.remapJar.archiveFile) - modFile.displayName = "${base.archivesName.get()}-$version" - modFile.releaseType = CFConstants.RELEASE_TYPE_BETA - modFile.addGameVersion(minecraft_version, 'client') - modFile.addModLoader 'Fabric' - modFile.addJavaVersion "Java $java_version" - modFile.addRequirement 'fabric-api' - - modFile.changelogType = CFConstants.CHANGELOG_HTML - modFile.changelog = provider { file("${rootDir}/CHANGELOG.md") } - -} - -modrinth { - token = System.getenv('MODRINTH_TOKEN') - - projectId = 'mcbot' - - versionName = "${base.archivesName.get()}-$version" - versionNumber = version - versionType = 'beta' - - gameVersions = [ minecraft_version ] - loaders = [ 'fabric' ] - - changelog = provider { file("${rootDir}/CHANGELOG.md") } - - uploadFile = tasks.remapJar - additionalFiles = [ tasks.sourcesJar ] -} - -tasks.modrinth.dependsOn(tasks.remapJar) -tasks.modrinth.dependsOn(tasks.sourcesJar) - -tasks.modrinth.dependsOn(':Changelog:makeMarkdownChangelog') - -publishing { - publications { - register('mavenJava', MavenPublication) { - artifact remapJar - artifact sourcesJar - - artifactId archivesBaseName - } - } - - repositories { - mavenLocal() - } -} \ No newline at end of file diff --git a/Forge/build.gradle b/Forge/build.gradle deleted file mode 100644 index ec1cf84..0000000 --- a/Forge/build.gradle +++ /dev/null @@ -1,188 +0,0 @@ -import net.darkhax.curseforgegradle.Constants as CFConstants -import net.darkhax.curseforgegradle.TaskPublishCurseForge - -plugins { - id 'net.minecraftforge.gradle' version '6.+' - id 'org.parchmentmc.librarian.forgegradle' version '1.+' - id 'org.spongepowered.mixin' version '0.7-SNAPSHOT' - id 'com.github.johnrengelman.shadow' -} - -base { - archivesName = "$mod_name-forge-$minecraft_version" -} - -mixin { - add sourceSets.main, "${mod_id}.refmap.json" - - config "${mod_id}.mixins.json" - config "${mod_id}.forge.mixins.json" -} - -configurations { - library - implementation.extendsFrom library -} - -minecraft.runs.all { - lazyToken('minecraft_classpath') { - configurations.library.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator) - } -} - -println "Forge: $forge_version" - -minecraft { - mappings channel: mappings_channel, version: "$mappings_version-$minecraft_version" - - copyIdeResources = true - - if (file('src/main/resources/META-INF/accesstransformer.cfg').exists()) { - accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') - } - - runs { - configureEach { - workingDirectory project(':Common').file('run') - - property 'forge.logging.markers', 'REGISTRIES' - property 'forge.logging.console.level', 'debug' - - property 'forge.enabledGameTestNamespaces', mod_id - - property 'mixin.env.remapRefMap', 'true' - property 'mixin.env.refMapRemappingFile', "$buildDir/createSrgToMcp/output.srg" - - ideaModule "${rootProject.name}.${project.name}.main" - - mods { - "${mod_id}" { - source sourceSets.main - source project(':Common').sourceSets.main - } - } - } - - client - } -} - -sourceSets.each { - var dir = layout.buildDirectory.dir("sourcesSets/$it.name") - - it.output.resourcesDir = dir - it.java.destinationDirectory = dir -} - -repositories { - mavenCentral() { - content { - includeGroup 'org.projectlombok' - } - } - maven { url 'https://maven.nova-committee.cn/releases' } -} - -dependencies { - minecraft "net.minecraftforge:forge:$minecraft_version-$forge_version" - - compileOnly project(':Common') - - library ("cn.evole.onebot:OneBot-Client:$onebot_client_version"){transitive = false} - library ("org.spongepowered:configurate-yaml:$yaml_version") - library ("com.github.houbb:csv:0.2.0") - jarJar("cn.evole.onebot:OneBot-Client:[$onebot_client_version,)"){transitive = false} - jarJar("org.spongepowered:configurate-yaml:[$yaml_version,)") - jarJar("com.github.houbb:csv:[0.2.0,)") - - implementation ("org.yaml:snakeyaml:1.28") - - compileOnly "org.projectlombok:lombok:$lombok_version" - annotationProcessor "org.projectlombok:lombok:$lombok_version" -} - -afterEvaluate { - tasks.configureReobfTaskForReobfJar.mustRunAfter(tasks.compileJava) - tasks.configureReobfTaskForReobfJarJar.mustRunAfter(tasks.compileJava) -} - -jar { - archiveClassifier = 'slim' - - manifest { - attributes([ - 'MixinConfigs': "${mod_id}.mixins.json,${mod_id}.forge.mixins.json" - ]) - } - - finalizedBy('reobfJar') -} - -tasks.jarJar { - archiveClassifier = '' - - finalizedBy('reobfJarJar') -} - -sourcesJar { - from project(':Common').sourceSets.main.allSource -} - -artifacts { - archives jar - archives sourcesJar -} - -tasks.register('publishCurseForge', TaskPublishCurseForge) { - dependsOn(tasks.jarJar) - apiToken = System.getenv('CURSEFORGE_TOKEN') - - var modFile = upload('534155', tasks.jarJar.archiveFile) - modFile.displayName = "${base.archivesName.get()}-$version" - modFile.releaseType = CFConstants.RELEASE_TYPE_BETA - modFile.addGameVersion(minecraft_version, 'client') - modFile.addModLoader('Forge') - modFile.addJavaVersion "Java $java_version" - - modFile.changelogType = CFConstants.CHANGELOG_HTML - modFile. changelog = provider { file("${rootDir}/CHANGELOG.md") } -} - -modrinth { - token = System.getenv('MODRINTH_TOKEN') - - projectId = 'McBot' - - versionName = "${base.archivesName.get()}-$version" - versionNumber = version - versionType = 'beta' - - gameVersions = [ minecraft_version ] - loaders = [ 'forge' ] - - changelog = provider { file("${rootDir}/CHANGELOG.md") } - - uploadFile = tasks.jarJar - additionalFiles = [ tasks.sourcesJar ] -} - -tasks.modrinth.dependsOn(tasks.jarJar) -tasks.modrinth.dependsOn(tasks.sourcesJar) - -tasks.modrinth.dependsOn(':Changelog:makeMarkdownChangelog') - -publishing { - publications { - register('mavenJava', MavenPublication) { - artifact sourcesJar - - jarJar.component(it) - - artifactId archivesBaseName - } - } - - repositories { - mavenLocal() - } -} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 39d3bb8..57ce7dd 100644 --- a/build.gradle +++ b/build.gradle @@ -1,67 +1,65 @@ plugins { - id 'org.spongepowered.gradle.vanilla' version '0.2.+' apply false - id 'net.darkhax.curseforgegradle' version '1.+' apply false - id 'com.modrinth.minotaur' version '2.+' apply false - id 'io.freefair.lombok' version '8.+' apply false - id 'net.neoforged.gradleutils' version '3.+' + id 'dev.architectury.loom' version '1.7-SNAPSHOT' apply false + id 'architectury-plugin' version '3.4-SNAPSHOT' id 'com.github.johnrengelman.shadow' version '8.1.1' apply false + id 'io.freefair.lombok' version '8.+' apply false } -gradleutils.version { - tags { - if (mod_version_label != 'release') - label = mod_version_label - - appendCommitOffset = false - } +architectury { + minecraft = project.minecraft_version } -println "$mod_name, Version: ${gradleutils.version.toString()}" -println "Minecraft: $minecraft_version, Mappings: $mappings_channel-$mappings_version" +allprojects { + group = rootProject.maven_group + version = "${rootProject.mod_version}+${rootProject.minecraft_version}" +} subprojects { - apply plugin: 'java' - - if (name != 'Common') { - apply plugin: 'net.darkhax.curseforgegradle' - apply plugin: 'com.modrinth.minotaur' - - evaluationDependsOn(':Common') - } - - apply plugin: 'io.freefair.lombok' - - apply plugin: 'idea' + apply plugin: 'dev.architectury.loom' + apply plugin: 'architectury-plugin' apply plugin: 'maven-publish' - java { - toolchain.languageVersion = JavaLanguageVersion.of(java_version) - - withSourcesJar() + base { + archivesName = "$rootProject.mod_name" + } - sourceCompatibility = JavaVersion."VERSION_$java_version" - targetCompatibility = JavaVersion."VERSION_$java_version" + repositories { + mavenCentral() { + content { + includeGroup 'org.projectlombok' + } + } + maven { url 'https://maven.nova-committee.cn/releases' } + maven { url 'https://maven.minecraftforge.net/' } + maven { url 'https://maven.parchmentmc.org' } } - idea { - module { - downloadSources = true - downloadJavadoc = true + dependencies { + minecraft "net.minecraft:minecraft:$rootProject.minecraft_version" + mappings loom.layered() { + officialMojangMappings() + parchment("org.parchmentmc.data:parchment-$minecraft_version:$mappings_version@zip") } + compileOnly ("org.projectlombok:lombok:$lombok_version") + annotationProcessor ("org.projectlombok:lombok:$lombok_version") + implementation ("org.yaml:snakeyaml:1.28") } + java { + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task + // if it is present. + // If you remove this line, sources will not be generated. + withSourcesJar() - version = gradleutils.version.toString() - group = project.group + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } tasks.withType(JavaCompile).configureEach { - source project(':Common').sourceSets.main.allSource - - options.encoding = 'UTF-8' + it.options.release = 17 } tasks.withType(ProcessResources).configureEach { - from project(':Common').sourceSets.main.resources var replaceProperties = [ 'mod_version' : mod_version, @@ -70,7 +68,7 @@ subprojects { "forge_loader_version_range" : forge_loader_version_range, "forge_version_range" : forge_version_range, "minecraft_version_range" : minecraft_version_range, - "fabric_version" : fabric_version, + "fabric_api_version" : fabric_api_version, "fabric_loader_version" : fabric_loader_version, "mod_name" : mod_name, "mod_author" : mod_author, @@ -101,9 +99,4 @@ subprojects { ]) } } -} - -tasks.register('publishMod') { - dependsOn(':Forge:publishCurseForge').finalizedBy(':Fabric:publishCurseForge') - dependsOn(':Forge:modrinth').finalizedBy(':Fabric:modrinth') } \ No newline at end of file diff --git a/common/build.gradle b/common/build.gradle new file mode 100644 index 0000000..b6193d8 --- /dev/null +++ b/common/build.gradle @@ -0,0 +1,17 @@ +println "Using Minecraft: $minecraft_version" + +architectury { + common rootProject.enabled_platforms.split(',') +} + +dependencies { + modImplementation ("net.fabricmc:fabric-loader:$rootProject.fabric_loader_version") + + implementation ("cn.evole.onebot:OneBot-Client:$onebot_client_version"){transitive = false} + implementation ("org.spongepowered:configurate-yaml:$yaml_version") + implementation ("org.yaml:snakeyaml:1.28") + implementation("com.github.houbb:csv:0.2.0") + + compileOnly ("org.projectlombok:lombok:$lombok_version") + annotationProcessor ("org.projectlombok:lombok:$lombok_version") +} \ No newline at end of file diff --git a/Common/src/main/java/cn/evole/mods/mcbot/Constants.java b/common/src/main/java/cn/evole/mods/mcbot/Constants.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/Constants.java rename to common/src/main/java/cn/evole/mods/mcbot/Constants.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/McBot.java b/common/src/main/java/cn/evole/mods/mcbot/McBot.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/McBot.java rename to common/src/main/java/cn/evole/mods/mcbot/McBot.java index eccf834..c28b204 100644 --- a/Common/src/main/java/cn/evole/mods/mcbot/McBot.java +++ b/common/src/main/java/cn/evole/mods/mcbot/McBot.java @@ -58,9 +58,9 @@ public static void onServerStopping(MinecraftServer server) { } public static void onServerStopped(MinecraftServer server) { + ConfigManager.getInstance().saveAllConfig(); CQUtils.shutdown(); MsgThreadUtils.shutdown(); - ConfigManager.getInstance().saveAllConfig(); if (onebot != null) onebot.close(); } } \ No newline at end of file diff --git a/Common/src/main/java/cn/evole/mods/mcbot/api/bot/BotApi.java b/common/src/main/java/cn/evole/mods/mcbot/api/bot/BotApi.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/api/bot/BotApi.java rename to common/src/main/java/cn/evole/mods/mcbot/api/bot/BotApi.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/api/cmd/Cmd.java b/common/src/main/java/cn/evole/mods/mcbot/api/cmd/Cmd.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/api/cmd/Cmd.java rename to common/src/main/java/cn/evole/mods/mcbot/api/cmd/Cmd.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/api/cmd/CmdApi.java b/common/src/main/java/cn/evole/mods/mcbot/api/cmd/CmdApi.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/api/cmd/CmdApi.java rename to common/src/main/java/cn/evole/mods/mcbot/api/cmd/CmdApi.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/api/cmd/McBotCommandSource.java b/common/src/main/java/cn/evole/mods/mcbot/api/cmd/McBotCommandSource.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/api/cmd/McBotCommandSource.java rename to common/src/main/java/cn/evole/mods/mcbot/api/cmd/McBotCommandSource.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/api/config/AutoConfig.java b/common/src/main/java/cn/evole/mods/mcbot/api/config/AutoConfig.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/api/config/AutoConfig.java rename to common/src/main/java/cn/evole/mods/mcbot/api/config/AutoConfig.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/api/config/ConfigHandler.java b/common/src/main/java/cn/evole/mods/mcbot/api/config/ConfigHandler.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/api/config/ConfigHandler.java rename to common/src/main/java/cn/evole/mods/mcbot/api/config/ConfigHandler.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/api/config/ConfigManager.java b/common/src/main/java/cn/evole/mods/mcbot/api/config/ConfigManager.java similarity index 98% rename from Common/src/main/java/cn/evole/mods/mcbot/api/config/ConfigManager.java rename to common/src/main/java/cn/evole/mods/mcbot/api/config/ConfigManager.java index 34afe3b..dc88e6e 100644 --- a/Common/src/main/java/cn/evole/mods/mcbot/api/config/ConfigManager.java +++ b/common/src/main/java/cn/evole/mods/mcbot/api/config/ConfigManager.java @@ -4,6 +4,7 @@ import cn.evole.mods.mcbot.platform.Services; import cn.evole.mods.mcbot.util.FileUtils; import lombok.Getter; +import net.fabricmc.loader.api.FabricLoader; import org.spongepowered.configurate.ConfigurateException; import java.nio.file.Path; diff --git a/Common/src/main/java/cn/evole/mods/mcbot/api/connect/ConnectApi.java b/common/src/main/java/cn/evole/mods/mcbot/api/connect/ConnectApi.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/api/connect/ConnectApi.java rename to common/src/main/java/cn/evole/mods/mcbot/api/connect/ConnectApi.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/api/event/Event.java b/common/src/main/java/cn/evole/mods/mcbot/api/event/Event.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/api/event/Event.java rename to common/src/main/java/cn/evole/mods/mcbot/api/event/Event.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/api/event/EventFactory.java b/common/src/main/java/cn/evole/mods/mcbot/api/event/EventFactory.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/api/event/EventFactory.java rename to common/src/main/java/cn/evole/mods/mcbot/api/event/EventFactory.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/api/event/ToggleableEvent.java b/common/src/main/java/cn/evole/mods/mcbot/api/event/ToggleableEvent.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/api/event/ToggleableEvent.java rename to common/src/main/java/cn/evole/mods/mcbot/api/event/ToggleableEvent.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/api/event/TypeTrackedEvent.java b/common/src/main/java/cn/evole/mods/mcbot/api/event/TypeTrackedEvent.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/api/event/TypeTrackedEvent.java rename to common/src/main/java/cn/evole/mods/mcbot/api/event/TypeTrackedEvent.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/api/event/mod/McBotEvents.java b/common/src/main/java/cn/evole/mods/mcbot/api/event/mod/McBotEvents.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/api/event/mod/McBotEvents.java rename to common/src/main/java/cn/evole/mods/mcbot/api/event/mod/McBotEvents.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/api/event/server/ServerGameEvents.java b/common/src/main/java/cn/evole/mods/mcbot/api/event/server/ServerGameEvents.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/api/event/server/ServerGameEvents.java rename to common/src/main/java/cn/evole/mods/mcbot/api/event/server/ServerGameEvents.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/command/AddBindCommand.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/AddBindCommand.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/command/AddBindCommand.java rename to common/src/main/java/cn/evole/mods/mcbot/common/command/AddBindCommand.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/command/AddGroupIDCommand.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/AddGroupIDCommand.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/command/AddGroupIDCommand.java rename to common/src/main/java/cn/evole/mods/mcbot/common/command/AddGroupIDCommand.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/command/AuthKeyCommand.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/AuthKeyCommand.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/command/AuthKeyCommand.java rename to common/src/main/java/cn/evole/mods/mcbot/common/command/AuthKeyCommand.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/command/BotIDCommand.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/BotIDCommand.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/command/BotIDCommand.java rename to common/src/main/java/cn/evole/mods/mcbot/common/command/BotIDCommand.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/command/ConnectCommand.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/ConnectCommand.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/command/ConnectCommand.java rename to common/src/main/java/cn/evole/mods/mcbot/common/command/ConnectCommand.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/command/DebugCommand.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/DebugCommand.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/command/DebugCommand.java rename to common/src/main/java/cn/evole/mods/mcbot/common/command/DebugCommand.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/command/DelBindCommand.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/DelBindCommand.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/command/DelBindCommand.java rename to common/src/main/java/cn/evole/mods/mcbot/common/command/DelBindCommand.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/command/DelGroupIDCommand.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/DelGroupIDCommand.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/command/DelGroupIDCommand.java rename to common/src/main/java/cn/evole/mods/mcbot/common/command/DelGroupIDCommand.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/command/DisconnectCommand.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/DisconnectCommand.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/command/DisconnectCommand.java rename to common/src/main/java/cn/evole/mods/mcbot/common/command/DisconnectCommand.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/command/HelpCommand.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/HelpCommand.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/command/HelpCommand.java rename to common/src/main/java/cn/evole/mods/mcbot/common/command/HelpCommand.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/command/ListCustomCommand.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/ListCustomCommand.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/command/ListCustomCommand.java rename to common/src/main/java/cn/evole/mods/mcbot/common/command/ListCustomCommand.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/command/ReConnectCommand.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/ReConnectCommand.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/command/ReConnectCommand.java rename to common/src/main/java/cn/evole/mods/mcbot/common/command/ReConnectCommand.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/command/RecallCommand.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/RecallCommand.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/command/RecallCommand.java rename to common/src/main/java/cn/evole/mods/mcbot/common/command/RecallCommand.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/command/ReceiveCommand.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/ReceiveCommand.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/command/ReceiveCommand.java rename to common/src/main/java/cn/evole/mods/mcbot/common/command/ReceiveCommand.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/command/ReloadConfigCmd.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/ReloadConfigCmd.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/command/ReloadConfigCmd.java rename to common/src/main/java/cn/evole/mods/mcbot/common/command/ReloadConfigCmd.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/command/SendCommand.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/SendCommand.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/command/SendCommand.java rename to common/src/main/java/cn/evole/mods/mcbot/common/command/SendCommand.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/command/StatusCommand.java b/common/src/main/java/cn/evole/mods/mcbot/common/command/StatusCommand.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/command/StatusCommand.java rename to common/src/main/java/cn/evole/mods/mcbot/common/command/StatusCommand.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/config/BotConfig.java b/common/src/main/java/cn/evole/mods/mcbot/common/config/BotConfig.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/config/BotConfig.java rename to common/src/main/java/cn/evole/mods/mcbot/common/config/BotConfig.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/config/CmdConfig.java b/common/src/main/java/cn/evole/mods/mcbot/common/config/CmdConfig.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/config/CmdConfig.java rename to common/src/main/java/cn/evole/mods/mcbot/common/config/CmdConfig.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/config/CommonConfig.java b/common/src/main/java/cn/evole/mods/mcbot/common/config/CommonConfig.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/config/CommonConfig.java rename to common/src/main/java/cn/evole/mods/mcbot/common/config/CommonConfig.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/config/ModConfig.java b/common/src/main/java/cn/evole/mods/mcbot/common/config/ModConfig.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/config/ModConfig.java rename to common/src/main/java/cn/evole/mods/mcbot/common/config/ModConfig.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/common/config/StatusConfig.java b/common/src/main/java/cn/evole/mods/mcbot/common/config/StatusConfig.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/common/config/StatusConfig.java rename to common/src/main/java/cn/evole/mods/mcbot/common/config/StatusConfig.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/core/cmd/CmdHandler.java b/common/src/main/java/cn/evole/mods/mcbot/core/cmd/CmdHandler.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/core/cmd/CmdHandler.java rename to common/src/main/java/cn/evole/mods/mcbot/core/cmd/CmdHandler.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/core/data/ChatRecord.java b/common/src/main/java/cn/evole/mods/mcbot/core/data/ChatRecord.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/core/data/ChatRecord.java rename to common/src/main/java/cn/evole/mods/mcbot/core/data/ChatRecord.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/core/data/UserBind.java b/common/src/main/java/cn/evole/mods/mcbot/core/data/UserBind.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/core/data/UserBind.java rename to common/src/main/java/cn/evole/mods/mcbot/core/data/UserBind.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/core/event/IBotEvent.java b/common/src/main/java/cn/evole/mods/mcbot/core/event/IBotEvent.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/core/event/IBotEvent.java rename to common/src/main/java/cn/evole/mods/mcbot/core/event/IBotEvent.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/core/event/IChatEvent.java b/common/src/main/java/cn/evole/mods/mcbot/core/event/IChatEvent.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/core/event/IChatEvent.java rename to common/src/main/java/cn/evole/mods/mcbot/core/event/IChatEvent.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/core/event/ICmdEvent.java b/common/src/main/java/cn/evole/mods/mcbot/core/event/ICmdEvent.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/core/event/ICmdEvent.java rename to common/src/main/java/cn/evole/mods/mcbot/core/event/ICmdEvent.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/core/event/IPlayerEvent.java b/common/src/main/java/cn/evole/mods/mcbot/core/event/IPlayerEvent.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/core/event/IPlayerEvent.java rename to common/src/main/java/cn/evole/mods/mcbot/core/event/IPlayerEvent.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/core/event/ITickEvent.java b/common/src/main/java/cn/evole/mods/mcbot/core/event/ITickEvent.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/core/event/ITickEvent.java rename to common/src/main/java/cn/evole/mods/mcbot/core/event/ITickEvent.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/platform/Services.java b/common/src/main/java/cn/evole/mods/mcbot/platform/Services.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/platform/Services.java rename to common/src/main/java/cn/evole/mods/mcbot/platform/Services.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/platform/services/IPlatformHelper.java b/common/src/main/java/cn/evole/mods/mcbot/platform/services/IPlatformHelper.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/platform/services/IPlatformHelper.java rename to common/src/main/java/cn/evole/mods/mcbot/platform/services/IPlatformHelper.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/util/FileUtils.java b/common/src/main/java/cn/evole/mods/mcbot/util/FileUtils.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/util/FileUtils.java rename to common/src/main/java/cn/evole/mods/mcbot/util/FileUtils.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/util/MsgThreadUtils.java b/common/src/main/java/cn/evole/mods/mcbot/util/MsgThreadUtils.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/util/MsgThreadUtils.java rename to common/src/main/java/cn/evole/mods/mcbot/util/MsgThreadUtils.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/util/onebot/BotUtils.java b/common/src/main/java/cn/evole/mods/mcbot/util/onebot/BotUtils.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/util/onebot/BotUtils.java rename to common/src/main/java/cn/evole/mods/mcbot/util/onebot/BotUtils.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/util/onebot/CQUtils.java b/common/src/main/java/cn/evole/mods/mcbot/util/onebot/CQUtils.java similarity index 99% rename from Common/src/main/java/cn/evole/mods/mcbot/util/onebot/CQUtils.java rename to common/src/main/java/cn/evole/mods/mcbot/util/onebot/CQUtils.java index 2421389..9ededd5 100644 --- a/Common/src/main/java/cn/evole/mods/mcbot/util/onebot/CQUtils.java +++ b/common/src/main/java/cn/evole/mods/mcbot/util/onebot/CQUtils.java @@ -4,6 +4,7 @@ import cn.evole.mods.mcbot.platform.Services; import cn.evole.onebot.sdk.event.message.MessageEvent; import lombok.val; +import net.fabricmc.loader.api.FabricLoader; import org.jetbrains.annotations.NotNull; import java.util.Arrays; diff --git a/Common/src/main/java/cn/evole/mods/mcbot/util/onebot/GuildRole.java b/common/src/main/java/cn/evole/mods/mcbot/util/onebot/GuildRole.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/util/onebot/GuildRole.java rename to common/src/main/java/cn/evole/mods/mcbot/util/onebot/GuildRole.java diff --git a/Common/src/main/java/cn/evole/mods/mcbot/util/onebot/ImgUtil.java b/common/src/main/java/cn/evole/mods/mcbot/util/onebot/ImgUtil.java similarity index 100% rename from Common/src/main/java/cn/evole/mods/mcbot/util/onebot/ImgUtil.java rename to common/src/main/java/cn/evole/mods/mcbot/util/onebot/ImgUtil.java diff --git a/Common/src/main/resources/lang/en_us.json b/common/src/main/resources/lang/en_us.json similarity index 100% rename from Common/src/main/resources/lang/en_us.json rename to common/src/main/resources/lang/en_us.json diff --git a/Common/src/main/resources/lang/zh_cn.json b/common/src/main/resources/lang/zh_cn.json similarity index 100% rename from Common/src/main/resources/lang/zh_cn.json rename to common/src/main/resources/lang/zh_cn.json diff --git a/Common/src/main/resources/lang/zh_hk.json b/common/src/main/resources/lang/zh_hk.json similarity index 100% rename from Common/src/main/resources/lang/zh_hk.json rename to common/src/main/resources/lang/zh_hk.json diff --git a/Common/src/main/resources/lang/zh_tw.json b/common/src/main/resources/lang/zh_tw.json similarity index 100% rename from Common/src/main/resources/lang/zh_tw.json rename to common/src/main/resources/lang/zh_tw.json diff --git a/Common/src/main/resources/pack.mcmeta b/common/src/main/resources/pack.mcmeta similarity index 100% rename from Common/src/main/resources/pack.mcmeta rename to common/src/main/resources/pack.mcmeta diff --git a/fabric/build.gradle b/fabric/build.gradle new file mode 100644 index 0000000..ba010cc --- /dev/null +++ b/fabric/build.gradle @@ -0,0 +1,78 @@ +plugins { + id 'com.github.johnrengelman.shadow' +} + +architectury { + platformSetupLoomIde() + fabric() +} + +println "Fabric API: $fabric_api_version, Loader: $fabric_loader_version" + +configurations { + common { + canBeResolved = true + canBeConsumed = false + } + compileClasspath.extendsFrom common + runtimeClasspath.extendsFrom common + developmentFabric.extendsFrom common + + shadowBundle { + canBeResolved = true + canBeConsumed = false + } +} + +dependencies { + modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version" + modApi "net.fabricmc.fabric-api:fabric-api:$rootProject.fabric_api_version+$rootProject.minecraft_version" + + common(project(path: ':common', configuration: 'namedElements')) { transitive false } + shadowBundle(project(path: ':common', configuration: 'transformProductionFabric')) { transitive false } + + implementation shadowBundle("cn.evole.onebot:OneBot-Client:$onebot_client_version"){transitive = false} + implementation shadowBundle("org.spongepowered:configurate-yaml:$yaml_version") + implementation shadowBundle("com.github.houbb:csv:0.2.0") + + annotationProcessor ("net.fabricmc:sponge-mixin:0.13.3+mixin.0.8.5") + + compileOnly ("org.projectlombok:lombok:$lombok_version") + annotationProcessor ("org.projectlombok:lombok:$lombok_version") +} + + +shadowJar { + configurations = [project.configurations.shadowBundle] + archiveClassifier.set("dev-shadow") + + relocate 'org.yaml', 'cn.evole.dependencies.yaml' + relocate 'org.spongepowered', 'cn.evole.dependencies.spongepowered' + relocate 'io.leangen', 'cn.evole.dependencies.leagen' + relocate 'org.checkerframework', 'cn.evole.dependencies.checkerframework' + relocate 'com.google.errorprone', 'cn.evole.dependencies.errorprone' + relocate 'org.apiguardian', 'cn.evole.dependencies.apiguardian' + relocate 'com.github.houbb', 'cn.evole.dependencies.houbb' +} + +remapJar { + input.set shadowJar.archiveFile + dependsOn shadowJar + archiveClassifier.set("fabric") +} + +jar { + archiveClassifier.set("dev") +} + +sourcesJar { + def commonSources = project(":common").sourcesJar + dependsOn commonSources + from commonSources.archiveFile.map { zipTree(it) } +} + +components.java { + withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { + skip() + } +} \ No newline at end of file diff --git a/Fabric/src/main/java/cn/evole/mods/mcbot/McBotFabric.java b/fabric/src/main/java/cn/evole/mods/mcbot/McBotFabric.java similarity index 100% rename from Fabric/src/main/java/cn/evole/mods/mcbot/McBotFabric.java rename to fabric/src/main/java/cn/evole/mods/mcbot/McBotFabric.java diff --git a/Fabric/src/main/java/cn/evole/mods/mcbot/mixin/PlayerAdvancementsMixin.java b/fabric/src/main/java/cn/evole/mods/mcbot/mixin/PlayerAdvancementsMixin.java similarity index 100% rename from Fabric/src/main/java/cn/evole/mods/mcbot/mixin/PlayerAdvancementsMixin.java rename to fabric/src/main/java/cn/evole/mods/mcbot/mixin/PlayerAdvancementsMixin.java diff --git a/Fabric/src/main/java/cn/evole/mods/mcbot/mixin/ServerGamePktImplMixin.java b/fabric/src/main/java/cn/evole/mods/mcbot/mixin/ServerGamePktImplMixin.java similarity index 100% rename from Fabric/src/main/java/cn/evole/mods/mcbot/mixin/ServerGamePktImplMixin.java rename to fabric/src/main/java/cn/evole/mods/mcbot/mixin/ServerGamePktImplMixin.java diff --git a/Fabric/src/main/java/cn/evole/mods/mcbot/mixin/ServerPlayerMixin.java b/fabric/src/main/java/cn/evole/mods/mcbot/mixin/ServerPlayerMixin.java similarity index 100% rename from Fabric/src/main/java/cn/evole/mods/mcbot/mixin/ServerPlayerMixin.java rename to fabric/src/main/java/cn/evole/mods/mcbot/mixin/ServerPlayerMixin.java diff --git a/Fabric/src/main/java/cn/evole/mods/mcbot/platform/FabricPlatformHelper.java b/fabric/src/main/java/cn/evole/mods/mcbot/platform/FabricPlatformHelper.java similarity index 100% rename from Fabric/src/main/java/cn/evole/mods/mcbot/platform/FabricPlatformHelper.java rename to fabric/src/main/java/cn/evole/mods/mcbot/platform/FabricPlatformHelper.java diff --git a/Fabric/src/main/resources/META-INF/services/cn.evole.mods.mcbot.platform.services.IPlatformHelper b/fabric/src/main/resources/META-INF/services/cn.evole.mods.mcbot.platform.services.IPlatformHelper similarity index 100% rename from Fabric/src/main/resources/META-INF/services/cn.evole.mods.mcbot.platform.services.IPlatformHelper rename to fabric/src/main/resources/META-INF/services/cn.evole.mods.mcbot.platform.services.IPlatformHelper diff --git a/Fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json similarity index 90% rename from Fabric/src/main/resources/fabric.mod.json rename to fabric/src/main/resources/fabric.mod.json index e87548e..3c66244 100644 --- a/Fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -19,8 +19,7 @@ ] }, "mixins": [ - "${mod_id}.mixins.json", - "${mod_id}.fabric.mixins.json" + "${mod_id}.mixins.json" ], "depends": { "fabricloader": ">=${fabric_loader_version}", diff --git a/Fabric/src/main/resources/mcbot.fabric.mixins.json b/fabric/src/main/resources/mcbot.mixins.json similarity index 74% rename from Fabric/src/main/resources/mcbot.fabric.mixins.json rename to fabric/src/main/resources/mcbot.mixins.json index 0594220..c7a8ed9 100644 --- a/Fabric/src/main/resources/mcbot.fabric.mixins.json +++ b/fabric/src/main/resources/mcbot.mixins.json @@ -2,12 +2,11 @@ "required": true, "minVersion": "0.8", "package": "cn.evole.mods.mcbot.mixin", - "refmap": "${mod_id}.refmap.json", "compatibilityLevel": "JAVA_17", "mixins": [ + "ServerPlayerMixin", "PlayerAdvancementsMixin", - "ServerGamePktImplMixin", - "ServerPlayerMixin" + "ServerGamePktImplMixin" ], "client": [ ], diff --git a/forge/build.gradle b/forge/build.gradle new file mode 100644 index 0000000..e14ed72 --- /dev/null +++ b/forge/build.gradle @@ -0,0 +1,82 @@ +plugins { + id 'com.github.johnrengelman.shadow' +} + +println "Forge: $forge_version" + +architectury { + platformSetupLoomIde() + forge() +} + +loom { + forge { + mixinConfig "${mod_id}.mixins.json" + } +} + +configurations { + common { + canBeResolved = true + canBeConsumed = false + } + compileClasspath.extendsFrom common + runtimeClasspath.extendsFrom common + developmentForge.extendsFrom common + + shadowBundle { + canBeResolved = true + canBeConsumed = false + } +} + +dependencies { + forge "net.minecraftforge:forge:$rootProject.minecraft_version-$rootProject.forge_version" + + common(project(path: ':common', configuration: 'namedElements')) { transitive false } + shadowBundle(project(path: ':common', configuration: 'transformProductionForge')) { transitive false } + + forgeRuntimeLibrary(implementation(shadowBundle("cn.evole.onebot:OneBot-Client:$onebot_client_version"){transitive = false})) + forgeRuntimeLibrary(implementation(shadowBundle("org.spongepowered:configurate-yaml:$yaml_version"))) + forgeRuntimeLibrary(implementation(shadowBundle("com.github.houbb:csv:0.2.0"))) + + compileOnly ("org.projectlombok:lombok:$lombok_version") + annotationProcessor ("org.projectlombok:lombok:$lombok_version") +} + +shadowJar { + configurations = [project.configurations.shadowBundle] + archiveClassifier.set("dev-shadow") + + relocate 'org.yaml', 'cn.evole.dependencies.yaml' + relocate 'org.spongepowered', 'cn.evole.dependencies.spongepowered' + relocate 'io.leangen', 'cn.evole.dependencies.leagen' + relocate 'org.checkerframework', 'cn.evole.dependencies.checkerframework' + relocate 'com.google.errorprone', 'cn.evole.dependencies.errorprone' + relocate 'org.apiguardian', 'cn.evole.dependencies.apiguardian' + relocate 'com.github.houbb', 'cn.evole.dependencies.houbb' +} + +remapJar { + input.set shadowJar.archiveFile + dependsOn shadowJar + archiveClassifier.set("minecraftforge") +} + +jar { + archiveClassifier.set("dev") +} + +sourcesJar { + def commonSources = project(":common").sourcesJar + dependsOn commonSources + from commonSources.archiveFile.map { zipTree(it) } +} + +components.java { + withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { + skip() + } +} + + diff --git a/forge/gradle.properties b/forge/gradle.properties new file mode 100644 index 0000000..32f842a --- /dev/null +++ b/forge/gradle.properties @@ -0,0 +1 @@ +loom.platform=forge \ No newline at end of file diff --git a/Forge/src/main/java/cn/evole/mods/mcbot/McBotForge.java b/forge/src/main/java/cn/evole/mods/mcbot/McBotForge.java similarity index 100% rename from Forge/src/main/java/cn/evole/mods/mcbot/McBotForge.java rename to forge/src/main/java/cn/evole/mods/mcbot/McBotForge.java diff --git a/Forge/src/main/java/cn/evole/mods/mcbot/platform/ForgePlatformHelper.java b/forge/src/main/java/cn/evole/mods/mcbot/platform/ForgePlatformHelper.java similarity index 100% rename from Forge/src/main/java/cn/evole/mods/mcbot/platform/ForgePlatformHelper.java rename to forge/src/main/java/cn/evole/mods/mcbot/platform/ForgePlatformHelper.java diff --git a/Forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml similarity index 100% rename from Forge/src/main/resources/META-INF/mods.toml rename to forge/src/main/resources/META-INF/mods.toml diff --git a/Forge/src/main/resources/META-INF/services/cn.evole.mods.mcbot.platform.services.IPlatformHelper b/forge/src/main/resources/META-INF/services/cn.evole.mods.mcbot.platform.services.IPlatformHelper similarity index 100% rename from Forge/src/main/resources/META-INF/services/cn.evole.mods.mcbot.platform.services.IPlatformHelper rename to forge/src/main/resources/META-INF/services/cn.evole.mods.mcbot.platform.services.IPlatformHelper diff --git a/Forge/src/main/resources/mcbot.forge.mixins.json b/forge/src/main/resources/mcbot.mixins.json similarity index 86% rename from Forge/src/main/resources/mcbot.forge.mixins.json rename to forge/src/main/resources/mcbot.mixins.json index c34ff2b..5e8f108 100644 --- a/Forge/src/main/resources/mcbot.forge.mixins.json +++ b/forge/src/main/resources/mcbot.mixins.json @@ -2,7 +2,6 @@ "required": true, "minVersion": "0.8", "package": "cn.evole.mods.mcbot.mixin", - "refmap": "${mod_id}.refmap.json", "compatibilityLevel": "JAVA_17", "mixins": [ ], diff --git a/gradle.properties b/gradle.properties index f097776..de17956 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,14 +2,14 @@ # Every field you add must be added to the root build.gradle expandProps map. # Project -version=2.3.0 -group=cn.evole.mods +mod_version=2.3.0 +maven_group=cn.evole.mods yaml_version=4.1.2 onebot_client_version=0.4.1 lombok_version = 1.18.+ java_version = 17 - +enabled_platforms=fabric,forge # Common mod_id=mcbot mod_name=McBot @@ -20,14 +20,13 @@ description=Adds chat linking between QQ and Minecraft and QQ commands to reques minecraft_version_range=[1.20, 1.21) minecraft_version=1.20.1 mod_version_label=beta -mod_version=2.3.0 # Mappings mappings_channel = parchment mappings_version = 2023.09.03 # Fabric -fabric_version=0.92.1+1.20.1 +fabric_api_version=0.92.1 fabric_loader_version=0.15.11 # Forge diff --git a/settings.gradle b/settings.gradle index bf25fd0..c7fe16d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,6 +17,7 @@ pluginManagement { name = 'Forge' url = 'https://maven.minecraftforge.net/' } + maven { url "https://maven.architectury.dev/" } maven { url 'https://maven.nova-committee.cn/releases' } maven { url 'https://maven.parchmentmc.org/' } } @@ -28,7 +29,7 @@ plugins { rootProject.name = 'McBot' include ( - "Common", - "Fabric", - "Forge" + "common", + "fabric", + "forge" ) \ No newline at end of file