Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: NeoForge support! #4

Merged
merged 1 commit into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,9 @@ jobs:
with:
name: forge-artifacts
path: forge/build/libs/

- name: Upload NeoForge Artifacts
uses: actions/upload-artifact@v3
with:
name: neoforge-artifacts
path: neoforge/build/libs/
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ subprojects {
it.mappings "dev.architectury:yarn-mappings-patch-forge:${project.yarn_mappings_patch}"
}
}

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

allprojects {
Expand Down Expand Up @@ -52,4 +56,4 @@ allprojects {
java {
withSourcesJar()
}
}
}
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ fabric_loader_version=0.15.2
fabric_api_version=0.91.2+1.20.4
yarn_mappings=1.20.4+build.3
yarn_mappings_patch=1.20.4+build.1
neoforge_version=20.4.3-beta

enabled_platforms=fabric,forge
enabled_platforms=fabric,forge,neoforge
architectury_version=11.0.8

cloth_config_version=13.0.114
Expand Down
78 changes: 78 additions & 0 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
}

architectury {
platformSetupLoomIde()
neoForge()
}

configurations {
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentNeoForge.extendsFrom common
}

dependencies {
neoForge "net.neoforged:neoforge:${rootProject.neoforge_version}"

modApi "me.shedaniel.cloth:cloth-config-neoforge:${project.cloth_config_version}"

common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionNeoForge")) { transitive = false }
}

processResources {
inputs.property "version", project.version

filesMatching("META-INF/mods.toml") {
expand "version": project.version,
"minecraft_version_range": minecraft_version_range
}
}

shadowJar {
exclude "fabric.mod.json"
exclude "architectury.common.json"

configurations = [project.configurations.shadowCommon]
archiveClassifier.set("dev-shadow")
}

remapJar {
inputFile.set shadowJar.archiveFile
dependsOn shadowJar
archiveClassifier.set("neoforge")
}

jar {
archiveClassifier.set("dev")
}

sourcesJar {
def commonSources = project(":common").sourcesJar
dependsOn commonSources
from commonSources.archiveFile.map { zipTree(it) }
}

components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}

publishing {
publications {
mavenNeoForge(MavenPublication) {
artifactId = rootProject.archives_base_name + "-neoforge"
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}
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,15 @@
package dev.norbiros.emojitype.neoforge;

import dev.norbiros.emojitype.ConfigDirPlatform;
import net.neoforged.fml.loading.FMLPaths;

import java.nio.file.Path;

public class ConfigDirPlatformImpl {
/**
* This is our actual method to {@link ConfigDirPlatform#getConfigDirectory()}.
*/
public static Path getConfigDirectory() {
return FMLPaths.CONFIGDIR.get();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package dev.norbiros.emojitype.neoforge;

import dev.norbiros.emojitype.EmojiType;
import dev.norbiros.emojitype.config.EmojiTypeConfig;
import net.neoforged.neoforge.client.ConfigScreenHandler;
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.common.Mod;

@Mod(EmojiType.MOD_ID)
public class EmojitypeNeoforge {
public EmojitypeNeoforge() {
EmojiType.init();

ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () -> new ConfigScreenHandler.ConfigScreenFactory((client, parent) -> EmojiTypeConfig.createConfigScreen(parent)));
}
}
34 changes: 34 additions & 0 deletions neoforge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
modLoader = "javafml"
loaderVersion = "[1,)"
license = "GPL-3.0"
issueTrackerURL = "https://github.com/Norbiros/emojitype/issues"
displayURL = "https://modrinth.com/mod/emoji-type"
#updateJSONURL="https://api.modrinth.com/updates/emoji-type/forge_updates.json"
logoFile = "logo.png"
authors = "Cyborgcabbage,Norbiros"

[[mods]]
modId = "emojitype"
version = "${version}"
displayName = "Emoji Type"
description='''
A mod that lets you type minecraft emojis easier!
'''
credits="Thanks to cyborgcabbage for original mod!"

[[mixins]]
config = "emojitype-common.mixins.json"

[[dependencies.emojitype]]
modId="neoforge"
mandatory=true
versionRange="[20.2,)"
ordering="NONE"
side="BOTH"

[[dependencies.emojitype]]
modId = "cloth_config"
mandatory = false
versionRange = "[11.0.0,)"
ordering = "NONE"
side = "BOTH"
7 changes: 7 additions & 0 deletions neoforge/src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"pack": {
"description": "emojitype resources",
"pack_format": 15,
"forge:server_data_pack_format": 12
}
}
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ pluginManagement {
include("common")
include("fabric")
include("forge")
include("neoforge")

rootProject.name = "emojitype"