-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port to MC 1.20.2 and add support for NeoForge.
- Loading branch information
Showing
12 changed files
with
256 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ build | |
# other | ||
eclipse | ||
run | ||
runs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
plugins { | ||
id 'net.neoforged.gradle.userdev' version '7.0.43' | ||
id 'net.darkhax.curseforgegradle' | ||
id 'com.modrinth.minotaur' | ||
} | ||
|
||
apply from: '../gradle/patreon.gradle' | ||
|
||
base { | ||
archivesName = "${mod_name}-NeoForge-${minecraft_version}" | ||
} | ||
|
||
runs { | ||
configureEach { | ||
modSource project.sourceSets.main | ||
} | ||
client { | ||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id | ||
} | ||
server { | ||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id | ||
programArgument '--nogui' | ||
} | ||
|
||
gameTestServer { | ||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation "net.neoforged:neoforge:${neoforge_version}" | ||
compileOnly project(':common') | ||
} | ||
|
||
// NeoGradle compiles the game, but we don't want to add our common code to the game's code | ||
TaskCollection.metaClass.excludingNeoTasks = { -> | ||
delegate.matching { !it.name.startsWith("neo") } | ||
} | ||
|
||
tasks.withType(JavaCompile).excludingNeoTasks().configureEach { | ||
source(project(':common').sourceSets.main.allSource) | ||
} | ||
|
||
tasks.withType(Javadoc).excludingNeoTasks().configureEach { | ||
source(project(':common').sourceSets.main.allJava) | ||
} | ||
|
||
tasks.named("sourcesJar", Jar) { | ||
from(project(':common').sourceSets.main.allSource) | ||
} | ||
|
||
tasks.withType(ProcessResources).excludingNeoTasks().configureEach { | ||
from project(':common').sourceSets.main.resources | ||
} | ||
|
||
processResources { | ||
|
||
from project(":common").sourceSets.main.resources | ||
|
||
def buildProps = project.properties.clone() | ||
|
||
// Replaces FML's magic file.jarVersion string with the correct version at | ||
// build time. | ||
buildProps.put('file', [jarVersion: project.version]) | ||
|
||
if (project.hasProperty('patreon')) { | ||
|
||
def supporters = new ArrayList<String>() | ||
|
||
for (entry in project.ext.patreon.pledges) { | ||
|
||
def pledge = entry.value; | ||
|
||
if (pledge.isValid()) { | ||
|
||
supporters.add(pledge.getDisplayName()) | ||
} | ||
} | ||
|
||
buildProps.put('mod_supporters', supporters.join(', ')) | ||
} | ||
|
||
filesMatching('*.mixins.json') { | ||
filter(org.apache.tools.ant.filters.LineContains, negate: true, contains: ['refmap' ] ) | ||
} | ||
|
||
filesMatching(['META-INF/mods.toml', 'pack.mcmeta', '*.mixins.json']) { | ||
|
||
expand buildProps | ||
} | ||
} | ||
|
||
// -- MAVEN PUBLISHING -- | ||
project.publishing { | ||
|
||
publications { | ||
|
||
mavenJava(MavenPublication) { | ||
|
||
artifactId = base.archivesName.get() | ||
from components.java | ||
} | ||
} | ||
|
||
repositories { | ||
|
||
maven { | ||
|
||
// Sets maven credentials if they are provided. This is generally | ||
// only used for external/remote uploads. | ||
if (project.hasProperty('mavenUsername') && project.hasProperty('mavenPassword')) { | ||
|
||
credentials { | ||
|
||
username findProperty('mavenUsername') | ||
password findProperty('mavenPassword') | ||
} | ||
} | ||
|
||
url getDefaultString('mavenURL', 'undefined', true) | ||
} | ||
} | ||
} | ||
|
||
// CurseForge Publishing | ||
task publishCurseForge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) { | ||
|
||
apiToken = findProperty('curse_auth') | ||
|
||
def mainFile = upload(curse_project, jar) | ||
mainFile.changelogType = 'markdown' | ||
mainFile.changelog = project.ext.mod_changelog | ||
mainFile.addJavaVersion('Java 17') | ||
mainFile.releaseType = 'release' | ||
mainFile.addGameVersion('Server', 'Client') | ||
|
||
// Append Patreon Supporters | ||
def patreonInfo = project.findProperty('patreon') | ||
|
||
if (patreonInfo) { | ||
mainFile.changelog += "\n\nThis project is made possible by [Patreon](${patreonInfo.campaignUrlTracked}) support from players like you. Thank you!\n\n${patreonInfo.pledgeLog}" | ||
} | ||
|
||
doLast { | ||
|
||
if (project.hasProperty('mod_homepage')) { | ||
|
||
project.ext.curse_file_url = "${mod_homepage}/files/${mainFile.curseFileId}" | ||
} | ||
} | ||
} | ||
|
||
// Modrinth | ||
modrinth { | ||
|
||
def patreonInfo = project.findProperty('patreon') | ||
def changelog = project.ext.mod_changelog | ||
|
||
if (patreonInfo) { | ||
changelog += "\n\nThis project is made possible by [Patreon](${patreonInfo.campaignUrlTracked}) support from players like you. Thank you!\n\n${patreonInfo.pledgeLog}" | ||
} | ||
|
||
token.set(project.findProperty('modrinth_auth')) | ||
projectId.set(modrinth_project) | ||
changelog = changelog | ||
versionName.set("${mod_name}-NeoForge-${minecraft_version}-$version") | ||
versionType.set('release') | ||
uploadFile.set(tasks.jar) | ||
|
||
loaders = ["neoforge"] | ||
gameVersions = ["${minecraft_version}"] | ||
} |
12 changes: 12 additions & 0 deletions
12
neoforge/src/main/java/net/darkhax/maxhealthfix/MaxHealthFixNeoForge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package net.darkhax.maxhealthfix; | ||
|
||
import net.neoforged.fml.common.Mod; | ||
|
||
@Mod(Constants.MOD_ID) | ||
public class MaxHealthFixNeoForge { | ||
|
||
public MaxHealthFixNeoForge() { | ||
|
||
Constants.LOG.info("Loaded {} for Forge.", Constants.MOD_ID); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
modLoader = "javafml" | ||
loaderVersion = "${neoforge_version_range}" | ||
license = "${mod_license}" | ||
issueTrackerURL="${mod_issues}" | ||
|
||
[[mods]] | ||
modId = "${mod_id}" | ||
version = "${version}" | ||
displayName = "${mod_name}" | ||
updateJSONURL = "https://updates.blamejared.com/get?n=${mod_id}&gv=${minecraft_version}&ml=neoforge" | ||
displayURL = "${mod_homepage}" | ||
credits = "This project is made possible with Patreon support from players like you. Thank you! ${mod_supporters}" | ||
authors = "${mod_author}" | ||
description = ''' | ||
${mod_description} | ||
''' | ||
|
||
[[mixins]] | ||
config = "${mod_id}.common.mixins.json" | ||
|
||
[[dependencies.${ mod_id }]] | ||
modId = "neoforge" | ||
mandatory = true | ||
versionRange = "${neoforge_version_range}" | ||
ordering = "NONE" | ||
side = "BOTH" | ||
|
||
[[dependencies.${ mod_id }]] | ||
modId = "minecraft" | ||
mandatory = true | ||
versionRange = "${minecraft_version}" | ||
ordering = "NONE" | ||
side = "BOTH" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters