Compare commits

..

2 Commits

Author SHA1 Message Date
dca1482526
feat: add quilt support
It is not working at all
2023-08-01 16:56:38 +08:00
9aa248e7f2
build: add fabric support 2023-08-01 15:45:21 +08:00
19 changed files with 351 additions and 8 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
build
.gradle
forge/run
*/run
.idea

View File

@ -45,6 +45,10 @@ allprojects {
name = "ParchmentMC"
setUrl("https://maven.parchmentmc.org")
}
maven {
name = "QuiltMC"
setUrl("https://maven.quiltmc.org/repository/release/")
}
}
dependencies {

View File

@ -1,5 +1,5 @@
architectury {
common("forge")
common("forge", "fabric", "quilt")
}
loom {

View File

@ -20,6 +20,7 @@ import quaedam.projection.misc.NoiseProjection
import quaedam.projection.misc.SkylightProjection
import quaedam.projection.misc.SoundProjection
import quaedam.projection.music.MusicProjection
import quaedam.projection.swarm.ProjectedPersonEntity
import quaedam.projection.swarm.SwarmProjection
import quaedam.projector.Projector
import quaedam.shell.ProjectionShell
@ -48,6 +49,8 @@ object Quaedam {
}
}
val lateinit = mutableListOf<() -> Unit>()
fun init() {
QuaedamConfig
Projector
@ -75,6 +78,9 @@ object Quaedam {
soundEvents.register()
poiTypes.register()
projectionEffects.register()
lateinit.forEach { it() }
lateinit.clear()
}
fun resource(path: String) = ResourceLocation(ID, path)

View File

@ -60,7 +60,7 @@ class ProjectedPersonEntity(entityType: EntityType<out PathfinderMob>, level: Le
}!!
init {
EntityAttributeRegistry.register(entity, ::createAttributes)
Quaedam.lateinit += { EntityAttributeRegistry.register(entity, ::createAttributes) }
if (Platform.getEnv() == EnvType.CLIENT) ProjectedPersonRenderer
ProjectedPersonShape
ProjectedPersonAI

View File

@ -10,6 +10,7 @@ import net.minecraft.client.renderer.entity.EntityRendererProvider
import net.minecraft.client.renderer.entity.MobRenderer
import net.minecraft.client.renderer.entity.layers.CustomHeadLayer
import net.minecraft.client.renderer.entity.layers.ItemInHandLayer
import quaedam.Quaedam
@Environment(EnvType.CLIENT)
class ProjectedPersonRenderer(context: EntityRendererProvider.Context) :
@ -21,7 +22,12 @@ class ProjectedPersonRenderer(context: EntityRendererProvider.Context) :
companion object {
init {
EntityRendererRegistry.register(ProjectedPersonEntity.entity, ::ProjectedPersonRenderer)
Quaedam.lateinit += {
EntityRendererRegistry.register(
ProjectedPersonEntity.entity,
::ProjectedPersonRenderer
)
}
}
}

View File

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

82
fabric/build.gradle.kts Normal file
View File

@ -0,0 +1,82 @@
plugins {
id("com.github.johnrengelman.shadow")
}
architectury {
platformSetupLoomIde()
fabric()
}
loom {
accessWidenerPath.set(project(":common").loom.accessWidenerPath)
}
val common: Configuration by configurations.creating
val shadowCommon: Configuration by configurations.creating
val developmentFabric: Configuration by configurations.getting
configurations {
compileOnly.configure { extendsFrom(common) }
runtimeOnly.configure { extendsFrom(common) }
developmentFabric.extendsFrom(common)
}
dependencies {
modImplementation("net.fabricmc:fabric-loader:${rootProject.property("fabric_loader_version")}")
modApi("net.fabricmc.fabric-api:fabric-api:${rootProject.property("fabric_version")}")
modApi("dev.architectury:architectury-fabric:${rootProject.property("architectury_version")}")
modImplementation("net.fabricmc:fabric-language-kotlin:${rootProject.property("fabric_kotlin_version")}")
common(project(":common", "namedElements")) {
isTransitive = false
}
shadowCommon(project(":common", "transformProductionFabric")){
isTransitive = false
}
}
tasks.processResources {
inputs.property("version", project.version)
filesMatching("fabric.mod.json") {
expand(
mapOf(
"version" to project.version,
"minecraft_version" to rootProject.property("minecraft_version"),
"architectury_version" to rootProject.property("architectury_version"),
"fabric_kotlin_version" to rootProject.property("fabric_kotlin_version")
)
)
}
}
tasks.shadowJar {
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()
}
}

View File

@ -0,0 +1,12 @@
package quaedam.fabric
import net.fabricmc.api.ModInitializer
import quaedam.Quaedam
object QuaedamFabric: ModInitializer {
override fun onInitialize() {
Quaedam.init()
}
}

View File

@ -0,0 +1,34 @@
{
"schemaVersion": 1,
"id": "quaedam",
"version": "${version}",
"name": "Quaedam",
"description": "Hot hot hot!",
"authors": [
"xtex"
],
"contact": {
"homepage": "https://codeberg.org/xtex/quaedam",
"sources": "https://codeberg.org/xtex/quaedam"
},
"license": "Apache-2.0",
"icon": "assets/quaedam/icon.png",
"environment": "*",
"entrypoints": {
"main": [
{
"adapter": "kotlin",
"value": "quaedam.fabric.QuaedamFabric"
}
]
},
"mixins": [
"quaedam-common.mixins.json"
],
"depends": {
"fabric": "*",
"minecraft": ">=${minecraft_version}",
"architectury": ">=${architectury_version}",
"fabric-language-kotlin": ">=${fabric_kotlin_version}"
}
}

View File

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

View File

@ -11,7 +11,7 @@ authors = "xtex"
description = '''
Hot hot hot!
'''
logoFile = "icon.png"
logoFile = "assets/quaedam/icon.png"
[[dependencies.quaedam]]
modId = "forge"

View File

@ -1,13 +1,27 @@
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.jvmargs=-Xmx2048M
minecraft_version=1.20.1
parchment_version=2023.07.16
# https://www.curseforge.com/minecraft/mc-mods/architectury-api
parchment_version=2023.07.30
# https://modrinth.com/mod/architectury-api
architectury_version=9.1.12
# https://files.minecraftforge.net/net/minecraftforge/forge/
forge_version=1.20.1-47.1.43
# https://www.curseforge.com/minecraft/mc-mods/kotlin-for-forge/files
# https://modrinth.com/mod/kotlin-for-forge
kotlin_for_forge_version=4.4.0
# https://fabricmc.net/develop/
fabric_loader_version=0.14.21
fabric_version=0.86.1+1.20.1
# https://modrinth.com/mod/fabric-language-kotlin
fabric_kotlin_version=1.10.8+kotlin.1.9.0
# https://github.com/QuiltMC/quilt-loader/tags
quilt_loader_version=0.20.0-beta.5
# https://modrinth.com/mod/qsl
quilt_fabric_version=7.0.3+0.83.1-1.20.1
quilt_standard_library_version=6.0.4+1.20.1
# https://modrinth.com/mod/qkl
quilt_kotlin_libraries_version=2.1.1+kt.1.9.0+flk.1.9.6

86
quilt/build.gradle.kts Normal file
View File

@ -0,0 +1,86 @@
plugins {
id("com.github.johnrengelman.shadow")
}
architectury {
platformSetupLoomIde()
loader("quilt")
}
loom {
accessWidenerPath.set(project(":common").loom.accessWidenerPath)
}
val common: Configuration by configurations.creating
val shadowCommon: Configuration by configurations.creating
val developmentQuilt: Configuration by configurations.getting
configurations {
compileOnly.configure { extendsFrom(common) }
runtimeOnly.configure { extendsFrom(common) }
developmentQuilt.extendsFrom(common)
}
dependencies {
modImplementation("org.quiltmc:quilt-loader:${rootProject.property("quilt_loader_version")}")
modApi("org.quiltmc.quilted-fabric-api:quilted-fabric-api:${rootProject.property("quilt_fabric_version")}")
modApi("dev.architectury:architectury-fabric:${rootProject.property("architectury_version")}") {
exclude("net.fabricmc")
exclude("net.fabricmc.fabric-api")
}
modApi("org.quiltmc:qsl:${rootProject.property("quilt_standard_library_version")}")
modApi("org.quiltmc.quilt-kotlin-libraries:quilt-kotlin-libraries:${rootProject.property("quilt_kotlin_libraries_version")}")
common(project(":common", "namedElements")) {
isTransitive = false
}
shadowCommon(project(":common", "transformProductionQuilt")) {
isTransitive = false
}
}
tasks.processResources {
inputs.property("version", project.version)
filesMatching("quilt.mod.json") {
expand(
mapOf(
"version" to project.version,
"minecraft_version" to rootProject.property("minecraft_version"),
"architectury_version" to rootProject.property("architectury_version"),
"quilt_kotlin_libraries_version" to rootProject.property("quilt_kotlin_libraries_version"),
)
)
}
}
tasks.shadowJar {
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
quilt/gradle.properties Normal file
View File

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

View File

@ -0,0 +1,12 @@
package quaedam.quilt
import net.fabricmc.api.ModInitializer
import quaedam.Quaedam
object QuaedamQuilt: ModInitializer {
override fun onInitialize() {
Quaedam.init()
}
}

View File

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

View File

@ -0,0 +1,59 @@
{
"_comment": "https://github.com/QuiltMC/rfcs/blob/main/specification/0002-quilt.mod.json.md",
"schema_version": 1,
"mixin": [
"quaedam-common.mixins.json"
],
"quilt_loader": {
"metadata": {
"name": "Quaedam",
"description": "Hot hot hot!",
"license": "Apache-2.0",
"authors": [
"xtex"
],
"contact": {
"homepage": "https://codeberg.org/xtex/quaedam",
"sources": "https://codeberg.org/xtex/quaedam"
},
"icon": "assets/quaedam/icon.png"
},
"group": "quaedam",
"id": "quaedam",
"version": "${version}",
"intermediate_mappings": "net.fabricmc:intermediary",
"entrypoints": {
"init": [
{
"adapter": "kotlin",
"value": "quaedam.quilt.QuaedamQuilt"
}
]
},
"depends": [
{
"id": "quilt_loader",
"version": "*"
},
{
"id": "quilt_base",
"version": "*"
},
{
"id": "minecraft",
"version": ">=${minecraft_version}"
},
{
"id": "architectury",
"version": ">=${architectury_version}"
},
{
"id": "qkl",
"version": ">=${quilt_kotlin_libraries_version}"
}
]
},
"minecraft": {
"environment": "*"
}
}

View File

@ -10,5 +10,6 @@ pluginManagement {
include("common")
include("forge")
include("fabric", "quilt")
rootProject.name = "quaedam"