Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7a152e1
Refactor: Buildscripts
emyfops Mar 9, 2024
dbaadbc
Fix: Absolute flatdir path
emyfops Mar 9, 2024
737e291
Refactor: Don't include the jars
emyfops Mar 9, 2024
6899b7b
Refactor: Misinput
emyfops Mar 9, 2024
689ad83
Feature: 1.20.+ version
emyfops Mar 9, 2024
688ecd4
Fix: Mixin mod conflict
emyfops Mar 9, 2024
ca8b3b4
Feature: Forge 1.19.3 to 1.20.x
emyfops Mar 9, 2024
a8faff8
Removed maven name
emyfops Mar 9, 2024
dcaa53c
Global val instead of absolute path
emyfops Mar 9, 2024
15d75b6
Fix: Forge dev KFF
emyfops Mar 10, 2024
aef495c
Fix: misinput
emyfops Mar 10, 2024
8763aa7
Fix: Crash on forge dev env
emyfops Mar 10, 2024
45ca80e
Feature: NeoForge modloader
emyfops Mar 10, 2024
af8c6a1
Refactor: Change module name to com.lambda.common
emyfops Mar 10, 2024
492a315
Fix: Forge dev env
emyfops Mar 10, 2024
60a6551
Revert "Refactor: Change module name to com.lambda.common"
emyfops Mar 10, 2024
783a9ee
Removed comment
emyfops Mar 10, 2024
54c5cd4
Merge branch 'master' into refactor/buildscript
emyfops Mar 10, 2024
35305c7
Fix: Crash at launch
emyfops Mar 10, 2024
ee2da65
Fix: Fabric
emyfops Mar 10, 2024
5b69414
Removed bundle
emyfops Mar 10, 2024
3e0950c
Fix: NeoForge
emyfops Mar 10, 2024
63debfb
Avoid including mod jar in fabric
emyfops Mar 10, 2024
b946660
Removed log entrypoints
emyfops Mar 10, 2024
2c7754b
Fix: Forge
emyfops Mar 10, 2024
b152805
Fix: Missing mods forge env
emyfops Mar 10, 2024
4ea2c83
Small changes
Avanatiker Mar 11, 2024
26422a6
Fix: Forge dev and prod
emyfops Mar 11, 2024
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
34 changes: 18 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.fabricmc.loom.task.RemapJarTask

val modId = project.properties["mod_id"].toString()
val modVersion = project.properties["mod_version"].toString()
val mavenGroup = project.properties["maven_group"].toString()
val minecraftVersion = project.properties["minecraft_version"].toString()
val yarnMappings = project.properties["yarn_mappings"].toString()
val modId = property("mod_id").toString()
val modVersion = property("mod_version").toString()
val mavenGroup = property("maven_group").toString()
val minecraftVersion = property("minecraft_version").toString()
val yarnMappings = property("yarn_mappings").toString()

val libs = file("libs")

plugins {
kotlin("jvm") version "1.9.22"
Expand All @@ -22,6 +24,7 @@ architectury {
subprojects {
apply(plugin = "dev.architectury.loom")
apply(plugin = "org.jetbrains.dokka")

dependencies {
"minecraft"("com.mojang:minecraft:$minecraftVersion")
"mappings"("net.fabricmc:yarn:$yarnMappings:v2")
Expand Down Expand Up @@ -66,19 +69,18 @@ allprojects {
repositories {
maven("https://api.modrinth.com/maven")
maven("https://jitpack.io")
maven("https://maven.shedaniel.me/") {
name = "Architectury"
}
maven("https://maven.shedaniel.me/") { name = "Architectury" }
maven("https://maven.terraformersmc.com/releases/")
}

tasks {
withType<JavaCompile> {
options.encoding = "UTF-8"
options.release = 17
}
compileKotlin {
kotlinOptions.jvmTarget = "17"
flatDir {
dirs(libs)
}
}

java {
// withSourcesJar() // Uncomment this line when the plugin system is ready

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
17 changes: 10 additions & 7 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
val fabricLoaderVersion = project.properties["fabric_loader_version"].toString()
val fabricKotlinVersion = project.properties["fabric_kotlin_version"].toString()
val mixinExtrasVersion = project.properties["mixinextras_version"].toString()
val fabricLoaderVersion = property("fabric_loader_version").toString()
val fabricKotlinVersion = property("fabric_kotlin_version").toString()
val mixinExtrasVersion = property("mixinextras_version").toString()
val kotlinXCoroutineVersion = property("kotlinx_coroutines_version").toString()

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

loom {
silentMojangMappingsLicense()
accessWidenerPath.set(File("src/main/resources/lambda.accesswidener"))
}

repositories {
maven("https://maven.fabricmc.net/") {
name = "Fabric"
}
maven("https://maven.fabricmc.net/")
maven("https://jitpack.io")

mavenCentral()
mavenLocal()
}
Expand All @@ -21,12 +22,14 @@ 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:$fabricLoaderVersion")

// Add dependencies on the required Kotlin modules.
modImplementation("net.fabricmc:fabric-language-kotlin:$fabricKotlinVersion")
implementation("org.reflections:reflections:0.10.2")
implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:$mixinExtrasVersion")!!)
}

// Avoid nested jars
tasks.named("remapJar") {
enabled = false
}
Expand Down
7 changes: 4 additions & 3 deletions common/src/main/kotlin/com/lambda/Lambda.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ import org.apache.logging.log4j.LogManager
import org.apache.logging.log4j.Logger

object Lambda {
private const val MOD_NAME = "Lambda"
const val MOD_NAME = "Lambda"
const val MOD_ID = "lambda"
private const val SYMBOL = "λ"
private val VERSION: String = LoaderInfo.getVersion()
val VERSION: String = LoaderInfo.getVersion()

val LOG: Logger = LogManager.getLogger(SYMBOL)
val mc: MinecraftClient = MinecraftClient.getInstance()
val mc: MinecraftClient by lazy { MinecraftClient.getInstance() }

val gson: Gson = GsonBuilder()
.setPrettyPrinting()
.registerTypeAdapter(BlockPos::class.java, BlockPosSerializer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ object BoringModule : Module(
mapOf("One" to 1, "Two" to 2, "Three" to 3, "Four" to 4, "Five" to 5)
)
private val boringEnum by setting("Boring Enum", BoringEnum.ONE)
private val blockSetting by setting("Boring Block", Blocks.STONE)
//private val blockSetting by setting("Boring Block", Blocks.STONE) // Registries are not initialized yet
private val blockPosSetting by setting("Boring BlockPos", BlockPos(420, 69, 1337))
// private val blockListSetting by setting("Boring Block List", listOf(Blocks.STONE, Blocks.DIRT, Blocks.GRASS_BLOCK))

Expand All @@ -49,4 +49,4 @@ object BoringModule : Module(
LOG.info("I'm ${if (superBoring) "super boring ($boringValue)" else "boring"}! $isEnabled")
}
}
}
}
2 changes: 1 addition & 1 deletion common/src/main/kotlin/com/lambda/util/FolderRegister.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ object FolderRegister {
val minecraft: File = mc.runDirectory
val lambda: File = File(minecraft, "lambda")
val config: File = File(lambda, "config")
}
}
40 changes: 31 additions & 9 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
val fabricLoaderVersion = project.properties["fabric_loader_version"].toString()
val fabricApiVersion = project.properties["fabric_api_version"].toString()
val fabricKotlinVersion = project.properties["fabric_kotlin_version"].toString()
val fabricLoaderVersion = property("fabric_loader_version").toString()
val fabricApiVersion = property("fabric_api_version").toString()
val fabricKotlinVersion = property("fabric_kotlin_version").toString()

architectury {
platformSetupLoomIde()
Expand All @@ -20,17 +20,39 @@ val common: Configuration by configurations.creating {
configurations["developmentFabric"].extendsFrom(this)
}

dependencies {
common(project(":common", configuration = "namedElements")) {
isTransitive = false
val includeLib: Configuration by configurations.creating
val includeMod: Configuration by configurations.creating

fun DependencyHandlerScope.setupConfigurations() {
includeLib.dependencies.forEach {
implementation(it)
include(it)
}
shadowCommon(project(path = ":common", configuration = "transformProductionFabric")) {
isTransitive = false

includeMod.dependencies.forEach {
modImplementation(it)
}
}

dependencies {
// Fabric API (Do not touch)
modImplementation("net.fabricmc:fabric-loader:$fabricLoaderVersion")
modImplementation("net.fabricmc.fabric-api:fabric-api:$fabricApiVersion")
modImplementation("net.fabricmc:fabric-language-kotlin:$fabricKotlinVersion")
implementation("org.reflections:reflections:0.10.2")

// Add dependencies on the required Kotlin modules.
includeLib("org.reflections:reflections:0.10.2")
includeLib("org.javassist:javassist:3.27.0-GA")

// Add mods to the mod jar
// includeMod(...)

// Common (Do not touch)
common(project(":common", configuration = "namedElements")) { isTransitive = false }
shadowCommon(project(path = ":common", configuration = "transformProductionFabric")) { isTransitive = false }

// Finish the configuration
setupConfigurations()
}

tasks {
Expand Down
5 changes: 3 additions & 2 deletions fabric/src/main/kotlin/com/lambda/fabric/LambdaFabric.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package com.lambda.fabric
import net.fabricmc.api.ClientModInitializer
import com.lambda.Lambda
import com.lambda.Lambda.LOG
import com.lambda.Lambda.MOD_NAME
import com.lambda.Lambda.VERSION

object LambdaFabric : ClientModInitializer {
override fun onInitializeClient() {
Lambda.initialize()

LOG.info("Lambda Fabric initialized")
LOG.info("$MOD_NAME Fabric $VERSION initialized.")
}
}
6 changes: 3 additions & 3 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"lambda.mixins.common.json"
],
"depends": {
"fabricloader": ">=${fabric_loader_version}",
"fabric-api": "*",
"minecraft": "1.20.4",
"fabricloader": ">=0.14.24",
"fabric-api": ">=0.83.0+1.20",
"minecraft": ">=1.20.0",
"java": ">=17",
"fabric-language-kotlin": ">=${fabric_kotlin_version}"
}
Expand Down
79 changes: 60 additions & 19 deletions forge/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
val forgeVersion = project.properties["forge_version"].toString()
val kotlinForgeVersion = project.properties["kotlin_forge_version"].toString()
val mixinExtrasVersion = project.properties["mixinextras_version"].toString()
val forgeVersion = property("forge_version").toString()
val kotlinForgeVersion = property("kotlin_forge_version").toString()
val architecturyVersion = property("architectury_version").toString()
val mixinExtrasVersion = property("mixinextras_version").toString()

architectury {
platformSetupLoomIde()
Expand All @@ -11,20 +12,29 @@ base.archivesName.set("${base.archivesName.get()}-forge")

loom {
accessWidenerPath.set(project(":common").loom.accessWidenerPath)

forge {
convertAccessWideners = true
extraAccessWideners.add(loom.accessWidenerPath.get().asFile.name)
mixinConfig("lambda.mixins.common.json")
}

mods {
register("forge") {
sourceSet("main", project(":forge"))

sourceSets.forEach {
val dir = layout.buildDirectory.dir("sourcesSets/${it.name}")
it.output.setResourcesDir(dir)
it.java.destinationDirectory.set(dir)
}
}
}
}

repositories {
maven("https://thedarkcolour.github.io/KotlinForForge/") {
name = "KotlinForForge"
}
maven("https://cursemaven.com") {
name = "Curse"
}
maven("https://thedarkcolour.github.io/KotlinForForge/")
maven("https://cursemaven.com")
}

val common: Configuration by configurations.creating {
Expand All @@ -33,18 +43,49 @@ val common: Configuration by configurations.creating {
configurations["developmentForge"].extendsFrom(this)
}

dependencies {
forge("net.minecraftforge:forge:$forgeVersion")
implementation("thedarkcolour:kotlinforforge:$kotlinForgeVersion")
common(project(":common", configuration = "namedElements")) {
isTransitive = false
val includeLib: Configuration by configurations.creating
val includeMod: Configuration by configurations.creating

fun DependencyHandlerScope.setupConfigurations() {
includeLib.dependencies.forEach {
implementation(it)
include(it)
}
shadowCommon(project(path = ":common", configuration = "transformProductionForge")) {
isTransitive = false

// Please look at this before yelling at me
// https://docs.architectury.dev/loom/using_libraries/
includeMod.dependencies.forEach {
implementation(it)
forgeRuntimeLibrary(it)
}
implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:$mixinExtrasVersion")!!)
implementation(include("io.github.llamalad7:mixinextras-forge:$mixinExtrasVersion")!!)
implementation("org.reflections:reflections:0.10.2")
}

dependencies {
// Forge API
forge("net.minecraftforge:forge:$forgeVersion")

// Architectury API
modApi("dev.architectury:architectury-forge:$architecturyVersion")

// Add dependencies on the required Kotlin modules.
includeLib("org.reflections:reflections:0.10.2")
includeLib("org.javassist:javassist:3.27.0-GA")

implementation("io.github.llamalad7:mixinextras-forge:$mixinExtrasVersion")
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:$mixinExtrasVersion")!!)

// Add mods to the mod jar
includeMod("thedarkcolour:kotlinforforge:$kotlinForgeVersion")

// Bugfixes
compileOnly(kotlin("stdlib")) // Hack https://github.com/thedarkcolour/KotlinForForge/issues/93

// Common (Do not touch)
common(project(":common", configuration = "namedElements")) { isTransitive = false } // We cannot common here because it is treated as a different mod and forge will panic
shadowCommon(project(path = ":common", configuration = "transformProductionForge")) { isTransitive = false }

// Finish the configuration
setupConfigurations()
}

tasks {
Expand Down
5 changes: 3 additions & 2 deletions forge/src/main/kotlin/com/lambda/forge/LambdaForge.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package com.lambda.forge
import net.minecraftforge.fml.common.Mod
import com.lambda.Lambda
import com.lambda.Lambda.LOG
import com.lambda.Lambda.MOD_NAME
import com.lambda.Lambda.VERSION

@Mod(Lambda.MOD_ID)
object LambdaForge {
init {
Lambda.initialize()

LOG.info("Lambda Forge initialized")
LOG.info("$MOD_NAME Forge $VERSION initialized.")
}
}
6 changes: 3 additions & 3 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "GNU General Public License v3.0"
modId = "lambda"
version = "${version}"
displayName = "Lambda"
authors = "Constructor"
authors = "${authors}"
description = '''
'''
logoFile = "assets/lambda/lambda.png"
Expand All @@ -15,14 +15,14 @@ displayTest = "IGNORE_ALL_VERSION"
[[dependencies.lambda]]
modId = "forge"
mandatory = true
versionRange = "[47,)"
versionRange = "[44,)"
ordering = "NONE"
side = "CLIENT"

[[dependencies.lambda]]
modId = "minecraft"
mandatory = true
versionRange = "[1.20.4,)"
versionRange = "[1.19.3,1.21)"
ordering = "NONE"
side = "CLIENT"

Expand Down
Loading