Skip to content

Commit 45ca80e

Browse files
committed
Feature: NeoForge modloader
1 parent 8763aa7 commit 45ca80e

File tree

14 files changed

+147
-19
lines changed

14 files changed

+147
-19
lines changed

build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ allprojects {
6767
version = modVersion
6868

6969
repositories {
70-
maven("https://impactdevelopment.github.io/maven/")
7170
maven("https://api.modrinth.com/maven")
7271
maven("https://jitpack.io")
7372
maven("https://maven.shedaniel.me/") { name = "Architectury" }

common/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ val fabricKotlinVersion = property("fabric_kotlin_version").toString()
33
val mixinExtrasVersion = property("mixinextras_version").toString()
44
val kotlinXCoroutineVersion = property("kotlinx_coroutines_version").toString()
55

6-
architectury { common("fabric", "forge") }
6+
architectury { common("fabric", "forge", "neoforge") }
77

88
loom {
99
accessWidenerPath.set(File("src/main/resources/lambda.accesswidener"))

fabric/src/main/kotlin/com/lambda/fabric/LambdaFabric.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import com.lambda.Lambda.LOG
77
object LambdaFabric : ClientModInitializer {
88
override fun onInitializeClient() {
99
Lambda.initialize()
10-
1110
LOG.info("Lambda Fabric initialized")
1211
}
1312
}

forge/build.gradle.kts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,8 @@ loom {
1919
}
2020

2121
repositories {
22-
maven("https://thedarkcolour.github.io/KotlinForForge/") {
23-
name = "KotlinForForge"
24-
}
25-
maven("https://cursemaven.com") {
26-
name = "Curse"
27-
}
22+
maven("https://thedarkcolour.github.io/KotlinForForge/")
23+
maven("https://cursemaven.com")
2824
}
2925

3026
val common: Configuration by configurations.creating {
@@ -49,10 +45,6 @@ fun DependencyHandlerScope.setupConfigurations() {
4945
}
5046

5147
dependencies {
52-
// TODO: Fix forge dev env saying there are missings mods but not in prod, maybe it needs deobfuscated mods?
53-
54-
compileOnly(kotlin("stdlib")) // Hacky fix https://github.com/thedarkcolour/KotlinForForge/issues/93
55-
5648
// Forge API
5749
forge("net.minecraftforge:forge:$forgeVersion")
5850

@@ -67,6 +59,9 @@ dependencies {
6759
common(project(":common", configuration = "namedElements")) { isTransitive = false }
6860
shadowCommon(project(path = ":common", configuration = "transformProductionForge")) { isTransitive = false }
6961

62+
// KFF Fix
63+
compileOnly(kotlin("stdlib")) // Hacky fix https://github.com/thedarkcolour/KotlinForForge/issues/93
64+
7065
// Finish the configuration
7166
setupConfigurations()
7267
}

forge/src/main/kotlin/com/lambda/forge/LambdaForge.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import com.lambda.Lambda.LOG
88
object LambdaForge {
99
init {
1010
Lambda.initialize()
11-
1211
LOG.info("Lambda Forge initialized")
1312
}
1413
}

forge/src/main/resources/META-INF/mods.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ license = "GNU General Public License v3.0"
66
modId = "lambda"
77
version = "${version}"
88
displayName = "Lambda"
9-
authors = "Constructor"
9+
authors = "${authors}"
1010
description = '''
1111
'''
1212
logoFile = "assets/lambda/lambda.png"

gradle.properties

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
# Lambda https://github.com/lambda-client/NeoLambda
1+
# Lambda https://github.com/lambda-client/lambda
22
mod_id=lambda
33
mod_version=1.0.0
4+
mod_description=Minecraft utility mod coded in Kotlin
45
maven_group=com.lambda
6+
authors=Constructor
57

68
# General
79
minecraft_version=1.20.4
@@ -22,6 +24,9 @@ fabric_kotlin_version=1.10.18+kotlin.1.9.22
2224
forge_version=1.20.4-49.0.31
2325
kotlin_forge_version=4.10.0
2426

27+
# NeoForge https://neoforged.net
28+
neo_version=20.4.196
29+
2530
# Kotlin https://kotlinlang.org/
2631
kotlin.code.style=official
2732

neoforge/build.gradle.kts

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
val neoVersion = property("neo_version").toString()
2+
val kotlinForgeVersion = property("kotlin_forge_version").toString()
3+
val mixinExtrasVersion = property("mixinextras_version").toString()
4+
5+
architectury {
6+
platformSetupLoomIde()
7+
neoForge()
8+
}
9+
10+
base.archivesName.set("${base.archivesName.get()}-neoforge")
11+
12+
loom {
13+
accessWidenerPath.set(project(":common").loom.accessWidenerPath)
14+
}
15+
16+
repositories {
17+
maven("https://maven.neoforged.net/releases/")
18+
maven("https://thedarkcolour.github.io/KotlinForForge/")
19+
}
20+
21+
val common: Configuration by configurations.creating {
22+
configurations.compileClasspath.get().extendsFrom(this)
23+
configurations.runtimeClasspath.get().extendsFrom(this)
24+
configurations["developmentNeoForge"].extendsFrom(this)
25+
}
26+
27+
val includeLib: Configuration by configurations.creating
28+
val includeMod: Configuration by configurations.creating
29+
30+
fun DependencyHandlerScope.setupConfigurations() {
31+
includeLib.dependencies.forEach {
32+
implementation(it)
33+
include(it)
34+
}
35+
36+
includeMod.dependencies.forEach {
37+
modImplementation(it)
38+
include(it)
39+
}
40+
}
41+
42+
dependencies {
43+
// NeoForge API
44+
neoForge("net.neoforged:neoforge:$neoVersion")
45+
46+
// Add dependencies on the required Kotlin modules.
47+
includeLib("thedarkcolour:kotlinforforge:$kotlinForgeVersion")
48+
49+
// Add mods to the mod jar
50+
// includeMod(...)
51+
52+
// Common (Do not touch)
53+
common(project(":common", configuration = "namedElements")) { isTransitive = false }
54+
shadowCommon(project(path = ":common", configuration = "transformProductionNeoForge")) { isTransitive = false }
55+
56+
// Finish the configuration
57+
setupConfigurations()
58+
}
59+
60+
tasks {
61+
processResources {
62+
inputs.property("version", project.version)
63+
64+
filesMatching("META-INF/mods.toml") {
65+
expand(getProperties())
66+
expand(mutableMapOf("version" to project.version))
67+
}
68+
}
69+
}

neoforge/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
loom.platform=neoforge
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.lambda.neoforge
2+
3+
import net.neoforged.fml.common.Mod
4+
import com.lambda.Lambda
5+
import com.lambda.Lambda.LOG
6+
7+
@Mod(Lambda.MOD_ID)
8+
object LambdaNeoForge {
9+
init {
10+
Lambda.initialize()
11+
LOG.info("Lambda NeoForge initialized")
12+
}
13+
}

0 commit comments

Comments
 (0)