Skip to content

Commit

Permalink
Init NeoForge project
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Jan 23, 2025
1 parent b2e0a1f commit 5cd19bb
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ kyoriMoonshine = "2.0.4"
guice = "7.0.0"
velocityApi = "3.3.0-SNAPSHOT"
minecraft = "1.21.1"
neoform = "1.21.1-20240808.144430"
neoforge = "21.1.97"
fabricLoader = "0.16.9"
fabricApi = "0.105.0+1.21.1"
fabricPermissionsApi = "0.3.1"
adventurePlatformFabric = "5.14.2"
adventurePlatformNeoforge = "6.0.1"
luckPermsApi = "5.4"
essentialsx = "2.20.1"
discordsrv = "1.28.1"
Expand Down Expand Up @@ -78,6 +81,7 @@ adventureTextSerializerLegacy = { group = "net.kyori", name = "adventure-text-se
adventureSerializerConfigurate4 = { group = "net.kyori", name = "adventure-serializer-configurate4", version.ref = "adventure" }
minimessage = { group = "net.kyori", name = "adventure-text-minimessage", version.ref = "adventure" }
adventurePlatformFabric = { group = "net.kyori", name = "adventure-platform-fabric", version.ref = "adventurePlatformFabric" }
adventurePlatformNeoforge = { group = "net.kyori", name = "adventure-platform-neoforge", version.ref = "adventurePlatformNeoforge" }
log4jBom = { group = "org.apache.logging.log4j", name = "log4j-bom", version.ref = "log4j" }
log4jApi = { group = "org.apache.logging.log4j", name = "log4j-api" }
event = { group = "com.seiama", name = "event-api", version.ref = "event" }
Expand All @@ -96,7 +100,8 @@ cloudSigned = { group = "org.incendo", name = "cloud-minecraft-signed-arguments"
cloudPaperSigned = { group = "org.incendo", name = "cloud-paper-signed-arguments", version.ref = "cloudMinecraft" }
cloudSponge = { group = "org.incendo", name = "cloud-sponge", version.ref = "cloudSponge" }
cloudVelocity = { group = "org.incendo", name = "cloud-velocity", version.ref = "cloudMinecraft" }
cloudFabric = { group = "org.incendo", name = "cloud-fabric", version.ref = "cloudModded"}
cloudFabric = { group = "org.incendo", name = "cloud-fabric", version.ref = "cloudModded" }
cloudNeoforge = { group = "org.incendo", name = "cloud-neoforge", version.ref = "cloudModded" }

configurateCore = { group = "org.spongepowered", name = "configurate-core", version.ref = "configurate" }
configurateHocon = { group = "org.spongepowered", name = "configurate-hocon", version.ref = "configurate" }
Expand Down
16 changes: 16 additions & 0 deletions mod-common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
plugins {
id("carbon.base-conventions")
id("net.neoforged.moddev")
}

neoForge {
enable {
neoFormVersion = libs.versions.neoform.get()
}
}

dependencies {
api(projects.carbonchatCommon) {
exclude("org.slf4j")
}
}
100 changes: 100 additions & 0 deletions neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
plugins {
id("carbon.shadow-platform")
id("net.neoforged.moddev")
}

neoForge {
enable {
version = libs.versions.neoforge.get()
}
mods.register("carbonchat") {
sourceSet(sourceSets.main.get())
sourceSet(project(":carbonchat-mod-common").sourceSets.main.get())
}
runs.register("server") {
server()
}
}

val shade: Configuration by configurations.creating

configurations.implementation {
extendsFrom(shade)
}

shade.extendsFrom(configurations.runtimeDownload.get())

dependencies {
shade(projects.carbonchatCommon) {
exclude("net.kyori", "adventure-api")
exclude("net.kyori", "adventure-text-serializer-gson")
exclude("net.kyori", "adventure-text-serializer-plain")
exclude("org.incendo", "cloud-core")
exclude("org.incendo", "cloud-services")
exclude("org.incendo", "cloud-brigadier")
exclude("org.incendo", "cloud-minecraft-signed-arguments")
exclude("io.leangen.geantyref")
}

implementation(libs.cloudNeoforge)
jarJar(libs.cloudNeoforge)
implementation(libs.cloudSigned)
jarJar(libs.cloudSigned)

implementation(libs.adventurePlatformNeoforge)
jarJar(libs.adventurePlatformNeoforge)

// implementation(libs.miniplaceholders)

runtimeDownload(libs.mysql)
// jarJar(libs.jarRelocator)
// runtimeOnly(libs.jarRelocator) {
// isTransitive = false
// }
runtimeDownload(libs.checkerQual)
}

val prodJar = tasks.register<Zip>("productionJar") {
destinationDirectory = layout.buildDirectory.dir("libs")
archiveClassifier = ""
archiveExtension = "jar"
from(zipTree(tasks.shadowJar.flatMap { it.archiveFile }))
from(tasks.jarJar.flatMap { it.outputDirectory })
}

carbonPlatform {
productionJar = prodJar.flatMap { it.archiveFile }
}

tasks {
shadowJar {
archiveClassifier = "dev-all"
configurations = listOf(shade)
relocateDependency("org.incendo.cloud.minecraft.extras")
standardRuntimeRelocations()
relocateGuice()
relocateDependency("org.checkerframework")
}
writeDependencies {
standardRuntimeRelocations()
relocateGuice()
relocateDependency("org.checkerframework")
}
processResources {
replace("META-INF/neoforge.mods.toml", mapOf(
"modId" to rootProject.name.lowercase(),
"name" to rootProject.name,
"version" to project.version,
"description" to project.description,
"github_url" to GITHUB_REPO_URL
))
}
jar {
archiveClassifier = "dev"
}
}

publishMods.modrinth {
minecraftVersions.set(listOf(libs.versions.minecraft.get()))
modLoaders.addAll("neoforge")
}
Empty file.
3 changes: 3 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ pluginManagement {

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0"
id("net.neoforged.moddev.repositories") version "2.0.75"
id("quiet-fabric-loom") version "1.9-SNAPSHOT"
}

Expand All @@ -87,7 +88,9 @@ listOf(
"common",
"paper",
// "sponge", // TODO API 10
"mod-common",
"fabric",
"neoforge",
"velocity"
).forEach {
include("carbonchat-$it")
Expand Down

0 comments on commit 5cd19bb

Please sign in to comment.