init load

This commit is contained in:
2023-06-29 20:35:27 +08:00
parent 1c4cfb55b5
commit 32a3dff678
24 changed files with 736 additions and 0 deletions

91
forge/build.gradle.kts Normal file
View File

@@ -0,0 +1,91 @@
plugins {
id("com.github.johnrengelman.shadow")
}
architectury {
platformSetupLoomIde()
forge()
}
loom {
accessWidenerPath.set(project(":common").loom.accessWidenerPath)
forge.apply {
convertAccessWideners.set(true)
extraAccessWideners.add(loom.accessWidenerPath.get().asFile.name)
mixinConfig("quaedam-common.mixins.json")
mixinConfig("quaedam.mixins.json")
}
}
val common: Configuration by configurations.creating
val shadowCommon: Configuration by configurations.creating
val developmentForge: Configuration by configurations.getting
configurations {
compileOnly.configure { extendsFrom(common) }
runtimeOnly.configure { extendsFrom(common) }
developmentForge.extendsFrom(common)
}
repositories {
maven {
name = "Kotlin for Forge"
url = uri("https://thedarkcolour.github.io/KotlinForForge/")
}
}
dependencies {
forge("net.minecraftforge:forge:${rootProject.property("forge_version")}")
modApi("dev.architectury:architectury-forge:${rootProject.property("architectury_version")}")
common(project(":common", "namedElements")) { isTransitive = false }
shadowCommon(project(":common", "transformProductionForge")) { isTransitive = false }
implementation("thedarkcolour:kotlinforforge:${rootProject.property("kotlin_for_forge_version")}")
}
tasks.processResources {
inputs.property("version", project.version)
filesMatching("META-INF/mods.toml") {
expand(mapOf(
"version" to project.version,
"minecraft_version" to rootProject.property("minecraft_version"),
"architectury_version" to rootProject.property("architectury_version"),
"kotlin_for_forge_version" to rootProject.property("kotlin_for_forge_version")
))
}
}
tasks.shadowJar {
exclude("fabric.mod.json")
exclude("architectury.common.json")
configurations = listOf(shadowCommon)
archiveClassifier.set("dev-shadow")
}
tasks.remapJar {
injectAccessWidener.set(true)
inputFile.set(tasks.shadowJar.get().archiveFile)
dependsOn(tasks.shadowJar)
archiveClassifier.set(null as String?)
}
tasks.jar {
archiveClassifier.set("dev")
}
tasks.sourcesJar {
val commonSources = project(":common").tasks.getByName<Jar>("sourcesJar")
dependsOn(commonSources)
from(commonSources.archiveFile.map { zipTree(it) })
}
components.getByName("java") {
this as AdhocComponentWithVariants
this.withVariantsFromConfiguration(project.configurations["shadowRuntimeElements"]) {
skip()
}
}

1
forge/gradle.properties Normal file
View File

@@ -0,0 +1 @@
loom.platform=forge

View File

@@ -0,0 +1,14 @@
package quaedam.forge
import net.minecraftforge.fml.loading.FMLPaths
import java.nio.file.Path
object QuaedamExpectPlatformImpl {
/**
* This is our actual method to [ExampleExpectPlatform.getConfigDirectory].
*/
@JvmStatic // Jvm Static is required so that java can access it
fun getConfigDirectory(): Path {
return FMLPaths.CONFIGDIR.get()
}
}

View File

@@ -0,0 +1,15 @@
package quaedam.forge
import dev.architectury.platform.forge.EventBuses
import quaedam.Quaedam
import net.minecraftforge.fml.common.Mod
import thedarkcolour.kotlinforforge.forge.MOD_BUS
@Mod(Quaedam.MOD_ID)
object QuaedamForge {
init {
// Submit our event bus to let architectury register our content on the right time
EventBuses.registerModEventBus(Quaedam.MOD_ID, MOD_BUS)
Quaedam.init()
}
}

View File

@@ -0,0 +1,42 @@
modLoader = "kotlinforforge"
loaderVersion = "[4,)"
issueTrackerURL = "https://codeberg.org/xtex/quaedam/issues"
license = "Apache-2.0"
[[mods]]
modId = "quaedam"
version = "${version}"
displayName = "Quaedam"
authors = "xtex"
description = '''
This is an example description! Tell everyone what your mod is about!
'''
#logoFile = ""
[[dependencies.quaedam]]
modId = "forge"
mandatory = true
versionRange = "[43,)"
ordering = "NONE"
side = "BOTH"
[[dependencies.quaedam]]
modId = "minecraft"
mandatory = true
versionRange = "[${minecraft_version},)"
ordering = "NONE"
side = "BOTH"
[[dependencies.quaedam]]
modId = "architectury"
mandatory = true
versionRange = "[${architectury_version},)"
ordering = "AFTER"
side = "BOTH"
[[dependencies.quaedam]]
modId = "kotlinforforge"
mandatory = true
versionRange = "[${kotlin_for_forge_version}]"
ordering = "AFTER"
side = "BOTH"

View File

@@ -0,0 +1,6 @@
{
"pack": {
"description": "Quaedam",
"pack_format": 9
}
}

View File

@@ -0,0 +1,12 @@
{
"required": true,
"package": "quaedam.mixin.forge",
"compatibilityLevel": "JAVA_17",
"client": [
],
"mixins": [
],
"injectors": {
"defaultRequire": 1
}
}