Skip to content

Commit

Permalink
Add NeoForge loader as target.
Browse files Browse the repository at this point in the history
  • Loading branch information
fnuecke committed Apr 15, 2024
1 parent 6dad82d commit a51784e
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
org.gradle.jvmargs=-Xmx4G
org.gradle.daemon=false

enabledPlatforms=fabric,forge
enabledPlatforms=fabric,forge,neoforge

modId=markdown_manual
mavenGroup=li.cil.markdown_manual
Expand Down
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ fabric-architectury = { group = "dev.architectury", name = "architectury-fabric"

forge-platform = { group = "net.minecraftforge", name = "forge", version.ref = "forge-platform" }
forge-architectury = { group = "dev.architectury", name = "architectury-forge", version.ref = "architectury" }

neoforge-platform = { group = "net.neoforged", name = "neoforge", version.ref = "neoforge-platform" }
neoforge-architectury = { group = "dev.architectury", name = "architectury-neoforge", version.ref = "architectury" }
36 changes: 36 additions & 0 deletions neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
val modId: String by project
val minecraftVersion: String = libs.versions.minecraft.get()
val neoforgeVersion: String = libs.versions.neoforge.platform.get()
val architecturyVersion: String = libs.versions.architectury.get()

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

repositories {
maven("https://maven.neoforged.net/releases")
}

dependencies {
neoForge(libs.neoforge.platform)
modImplementation(libs.neoforge.architectury)
}

tasks {
processResources {
val properties = mapOf(
"version" to project.version,
"minecraftVersion" to minecraftVersion,
"neoforgeVersion" to neoforgeVersion,
"architecturyVersion" to architecturyVersion
)
inputs.properties(properties)
filesMatching("META-INF/mods.toml") {
expand(properties)
}
}

remapJar {
atAccessWideners.add("${modId}.accesswidener")
}
}
1 change: 1 addition & 0 deletions neoforge/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
loom.platform = neoforge
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package li.cil.manual.client.neoforge;

import li.cil.manual.api.util.Constants;
import li.cil.manual.client.ClientSetup;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.loading.FMLEnvironment;

@Mod(Constants.MOD_ID)
public final class MarkdownManualNeoForge {
public MarkdownManualNeoForge() {
if (FMLEnvironment.dist == Dist.CLIENT) {
ClientSetup.initialize();
}
}
}
41 changes: 41 additions & 0 deletions neoforge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
modLoader = "javafml"
loaderVersion = "[2,)"
issueTrackerURL = "https://github.com/MightyPirates/MarkdownManual/issues"
license = "MIT"

[[mods]]
modId = "markdown_manual"
version = "${version}"
displayName = "Markdown Manual"
authors = "Sangar"
description = '''
Library mod providing a convenient way of defining in-game manuals.
'''

[[dependencies.markdown_manual]]
modId = "neoforge"
type = "required"
versionRange = "[${neoforgeVersion},)"
ordering = "NONE"
side = "BOTH"

[[dependencies.markdown_manual]]
modId = "minecraft"
type = "required"
versionRange = "${minecraftVersion}"
ordering = "NONE"
side = "BOTH"

[[dependencies.markdown_manual]]
modId = "architectury"
type = "required"
versionRange = "[${architecturyVersion},)"
ordering = "AFTER"
side = "BOTH"

[mc-publish]
modrinth = "nPQ9xkPg"
curseforge = 502485
dependencies = [
"architectury@>=${architecturyVersion}(required){modrinth:lhGA9TYQ}{curseforge:419699}"
]
6 changes: 6 additions & 0 deletions neoforge/src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"pack": {
"description": "Markdown Manual",
"pack_format": 8
}
}
7 changes: 5 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ pluginManagement {
}

include("common")
include("fabric")
include("forge")

val enabledPlatforms: String by settings
for (enabledPlatform in enabledPlatforms.split(",")) {
include(enabledPlatform)
}

val modId: String by settings
rootProject.name = modId

0 comments on commit a51784e

Please sign in to comment.