build: add fabric support
This commit is contained in:
parent
2b62599485
commit
9aa248e7f2
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,4 @@
|
||||
build
|
||||
.gradle
|
||||
forge/run
|
||||
*/run
|
||||
.idea
|
||||
|
@ -45,6 +45,10 @@ allprojects {
|
||||
name = "ParchmentMC"
|
||||
setUrl("https://maven.parchmentmc.org")
|
||||
}
|
||||
maven {
|
||||
name = "QuiltMC"
|
||||
setUrl("https://maven.quiltmc.org/repository/release/")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -1,5 +1,5 @@
|
||||
architectury {
|
||||
common("forge")
|
||||
common("forge", "fabric", "quilt")
|
||||
}
|
||||
|
||||
loom {
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
17
fabric-like/build.gradle.kts
Normal file
17
fabric-like/build.gradle.kts
Normal file
@ -0,0 +1,17 @@
|
||||
architectury {
|
||||
common("fabric", "quilt")
|
||||
}
|
||||
|
||||
loom {
|
||||
accessWidenerPath.set(project(":common").loom.accessWidenerPath)
|
||||
}
|
||||
|
||||
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")}")
|
||||
|
||||
compileOnly(project(":common", "namedElements")) {
|
||||
isTransitive = false
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package quaedam.fabriclike
|
||||
|
||||
import net.fabricmc.api.ModInitializer
|
||||
import quaedam.Quaedam
|
||||
|
||||
object QuaedamFabricLike: ModInitializer {
|
||||
|
||||
override fun onInitialize() {
|
||||
Quaedam.init()
|
||||
}
|
||||
|
||||
}
|
13
fabric-like/src/main/resources/quaedam.mixins.json
Normal file
13
fabric-like/src/main/resources/quaedam.mixins.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "quaedam.fabric.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"minVersion": "0.8",
|
||||
"client": [
|
||||
],
|
||||
"mixins": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
88
fabric/build.gradle.kts
Normal file
88
fabric/build.gradle.kts
Normal file
@ -0,0 +1,88 @@
|
||||
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
|
||||
}
|
||||
common(project(":fabric-like", "namedElements")) {
|
||||
isTransitive = false
|
||||
}
|
||||
shadowCommon(project(":fabric-like", "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()
|
||||
}
|
||||
}
|
34
fabric/src/main/resources/fabric.mod.json
Normal file
34
fabric/src/main/resources/fabric.mod.json
Normal 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.fabriclike.QuaedamFabricLike"
|
||||
}
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"quaedam-common.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
"fabric": "*",
|
||||
"minecraft": ">=${minecraft_version}",
|
||||
"architectury": ">=${architectury_version}",
|
||||
"fabric-language-kotlin": ">=${fabric_kotlin_version}"
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ authors = "xtex"
|
||||
description = '''
|
||||
Hot hot hot!
|
||||
'''
|
||||
logoFile = "icon.png"
|
||||
logoFile = "assets/quaedam/icon.png"
|
||||
|
||||
[[dependencies.quaedam]]
|
||||
modId = "forge"
|
||||
|
@ -1,13 +1,17 @@
|
||||
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
|
||||
# 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
|
||||
|
@ -10,5 +10,6 @@ pluginManagement {
|
||||
|
||||
include("common")
|
||||
include("forge")
|
||||
include("fabric-like", "fabric")
|
||||
|
||||
rootProject.name = "quaedam"
|
||||
|
Loading…
Reference in New Issue
Block a user