Skip to content

Commit

Permalink
wip neoforged
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Oct 31, 2023
1 parent 4695e01 commit 4f2f4ca
Show file tree
Hide file tree
Showing 44 changed files with 524 additions and 29 deletions.
9 changes: 1 addition & 8 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ dependencies {
if (jei_minecraft_version == minecraft_version) {
modRuntimeOnly "mezz.jei:jei-$jei_minecraft_version-fabric:$jei_version"
}

modCompileOnly("me.shedaniel:RoughlyEnoughItems-api:$rei_version") {
transitive = false
}

modCompileOnly "curse.maven:jade-324717:$jade_forge_version"
modCompileOnly "mcp.mobius.waila:wthit-api:mojmap-$wthit_version"
}

apply from: 'dependencies.gradle'
Expand Down Expand Up @@ -128,7 +121,7 @@ task curseforge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {

modrinth {
token = project.findProperty("modrinth.token") ?: System.getenv("MODRINTH_TOKEN") ?: "none"
projectId = project.modrinth_fabric_project_id
projectId = project.modrinth_project_id
versionType = project.modrinth_release_type
versionNumber = project.version + "+fabric-" + project.minecraft_version
uploadFile = remapJar
Expand Down
8 changes: 1 addition & 7 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,6 @@ dependencies {
if (jei_minecraft_version == minecraft_version) {
runtimeOnly fg.deobf("mezz.jei:jei-$jei_minecraft_version-forge:$jei_version")
}

compileOnly fg.deobf("me.shedaniel.cloth:cloth-config-forge:$cloth_config_version")

compileOnly fg.deobf("curse.maven:jade-324717:$jade_forge_version")
compileOnly fg.deobf("mcp.mobius.waila:wthit-api:forge-$wthit_version")
compileOnly fg.deobf("curse.maven:the-one-probe-245211:$theoneprobe_version")
}

apply from: 'dependencies.gradle'
Expand Down Expand Up @@ -242,7 +236,7 @@ task curseforge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {

modrinth {
token = project.findProperty("modrinth.token") ?: System.getenv("MODRINTH_TOKEN") ?: "none"
projectId = project.modrinth_forge_project_id
projectId = project.modrinth_project_id
versionType = project.modrinth_release_type
versionNumber = project.version + "+forge-" + project.minecraft_version
uploadFile = jar
Expand Down
16 changes: 9 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
mod_id=balm
mod_version = 8.0.1
mod_group=net.blay09.mods
pack_format_number=18

# Publishing
curseforge_release_type=release
curseforge_forge_project_id=531761
curseforge_fabric_project_id=500525
modrinth_release_type=release
modrinth_fabric_project_id=MBAkmtvl
modrinth_forge_project_id=MBAkmtvl
modrinth_project_id=MBAkmtvl

# Minecraft
minecraft_version = 1.20.2
Expand All @@ -23,6 +23,13 @@ forge_version_range=[48.0.0,)
forge_loader_version_range=[48,)
forge_mixins=true

# NeoForge
neoforge_version = 20.2.8-beta
neoforge_version_range=[20.2,)
neoforge_loader_version_range=[1,)
mapping_channel=official
mapping_version=1.20.2

# Fabric
fabric_version = 0.89.0+1.20.2
fabric_loader_version = 0.14.22
Expand All @@ -31,13 +38,8 @@ fabric_loader_version = 0.14.22
jei_minecraft_version=1.19.2
jei_version=11.4.0.288
rei_version=10.0.581
wthit_version=6.1.1
jade_fabric_version=4160727
jade_forge_version=4159759
mixin_version=0.8.5
modmenu_version=7.2.2
theoneprobe_version=4159743
cloth_config_version=11.0.99

# Gradle
org.gradle.jvmargs=-Xmx3G
Expand Down
5 changes: 5 additions & 0 deletions neoforge/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Disable autocrlf on generated files, they always generate with LF
# Add any extra files or paths here to make git stop saying they
# are changed when only line endings change.
src/generated/**/.cache/cache text eol=lf
src/generated/**/*.json text eol=lf
26 changes: 26 additions & 0 deletions neoforge/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project

# idea
out
*.ipr
*.iws
*.iml
.idea

# gradle
build
.gradle

# other
eclipse
run
runs
run-data

repo
155 changes: 155 additions & 0 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
plugins {
id 'java-library'
id 'idea'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.5'
id 'net.darkhax.curseforgegradle' version '1.0.14'
id "com.modrinth.minotaur" version "2.+"
}

version = mod_version
group = mod_group

repositories {
mavenLocal()
}

base {
archivesName = "${mod_id}-neoforge-${minecraft_version}"
}

java.toolchain.languageVersion = JavaLanguageVersion.of(17)

runs {
configureEach {
// Recommended logging data for a userdev environment
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
systemProperty 'forge.logging.markers', 'REGISTRIES'

// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
systemProperty 'forge.logging.console.level', 'debug'

modSource project.sourceSets.main
}

client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}

server {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
programArgument '--nogui'
}

// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}

data {
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
// workingDirectory project.file('run-data')

// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
}

sourceSets.main.resources { srcDir 'src/generated/resources' }

dependencies {
implementation "net.neoforged:neoforge:${neoforge_version}"
compileOnly project(":shared")

compileOnly "org.jetbrains:annotations:22.0.0"

compileOnly "mezz.jei:jei-$jei_minecraft_version-common-api:$jei_version"
if (jei_minecraft_version == minecraft_version) {
runtimeOnly "mezz.jei:jei-$jei_minecraft_version-forge:$jei_version"
}
}

apply from: 'dependencies.gradle'

tasks.withType(JavaCompile) {
source(project(":shared").sourceSets.main.allSource)
}

def resourceTargets = ['META-INF/mods.toml', 'pack.mcmeta']
def replaceProperties = [
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
neoforge_version: neoforge_version, neoforge_version_range: neoforge_version_range,
neoforge_loader_version_range: neoforge_loader_version_range,
mod_id: mod_id, mod_version: mod_version
]
tasks.withType(ProcessResources).configureEach {
inputs.properties replaceProperties

filesMatching(resourceTargets) {
expand replaceProperties
}
}

jar {
from(rootProject.file("LICENSE")) {
rename { "${it}_${mod_id}" }
}
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}

publishing {
publications {
mavenJava(MavenPublication) {
artifactId = mod_id + "-neoforge"
version = project.version + (!project.version.endsWith("SNAPSHOT") ? "+" + minecraft_version : "")

from components.java
}
}

repositories {
maven {
var releasesRepoUrl = "https://maven.twelveiterations.com/repository/maven-releases/"
var snapshotsRepoUrl = "https://maven.twelveiterations.com/repository/maven-snapshots/"
url = uri(version.toString().endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl)
name = "twelveIterationsNexus"
credentials(PasswordCredentials)
}
}
}

task curseforge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {
dependsOn('build')
description = 'Publishes the NeoForge build to CurseForge.'
group = 'publishing'

apiToken = project.findProperty("curseforge.api_key") ?: System.getenv("CURSEFORGE_TOKEN") ?: "none"

def mainFile = upload(curseforge_forge_project_id, file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar"))
mainFile.changelog = rootProject.file('CHANGELOG.md').text
project.minecraft_versions.split(',').toList().each { mainFile.addGameVersion(it) }
mainFile.releaseType = "release"
}

modrinth {
token = project.findProperty("modrinth.token") ?: System.getenv("MODRINTH_TOKEN") ?: "none"
projectId = project.modrinth_project_id
versionType = project.modrinth_release_type
versionNumber = project.version + "+neoforge-" + project.minecraft_version
uploadFile = jar
changelog = rootProject.file("CHANGELOG.md").text
gameVersions = project.minecraft_versions.split(',').toList()
syncBodyFrom = rootProject.file("modrinth.md").text
loaders = ['neoforge']
}
2 changes: 2 additions & 0 deletions neoforge/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dependencies {
}
27 changes: 27 additions & 0 deletions neoforge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
modLoader="javafml"
loaderVersion="${neoforge_loader_version_range}"
license="All rights reserved"
issueTrackerURL="https://github.com/TwelveIterationMods/Balm/issues"
[[mods]]
modId="balm"
version="${mod_version}"
displayName="Balm"
displayURL="https://mods.twelveiterations.com/"
logoFile="balm-icon.png"
credits="BlayTheNinth"
authors="BlayTheNinth"
description='''
Abstraction Layer (but not really)™ for Blay's multiplatform mods
'''
[[dependencies.balm]]
modId="neoforge"
mandatory=true
versionRange="${neoforge_version_range}"
ordering="NONE"
side="BOTH"
[[dependencies.balm]]
modId="minecraft"
mandatory=true
versionRange="${minecraft_version_range}"
ordering="NONE"
side="BOTH"
30 changes: 30 additions & 0 deletions neoforge/src/main/resources/balm.mixins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"required": true,
"minVersion": "0.8",
"package": "net.blay09.mods.balm.mixin",
"compatibilityLevel": "JAVA_17",
"refmap": "balm.refmap.json",
"mixins": [
"CropBlockMixin",
"StemBlockMixin",
"ReloadableServerResourcesMixin",
"SlotAccessor",
"MinecraftServerMixin",
"EntityMixin"
],
"client": [
"AbstractContainerScreenAccessor",
"CheckboxAccessor",
"ImageButtonAccessor",
"KeyMappingAccessor",
"KeyMappingMixin",
"MouseHandlerAccessor",
"ScreenAccessor",
"MinecraftMixin",
"LootTableMixin",
"ModelBakeryMixin"
],
"injectors": {
"defaultRequire": 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "balm:balm"
}
10 changes: 10 additions & 0 deletions neoforge/src/main/resources/data/balm/tags/items/black_dyes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"replace": false,
"values": [
"minecraft:black_dye",
{
"id": "#forge:dyes/black",
"required": false
}
]
}
10 changes: 10 additions & 0 deletions neoforge/src/main/resources/data/balm/tags/items/blue_dyes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"replace": false,
"values": [
"minecraft:blue_dye",
{
"id":"#forge:dyes/blue",
"required": false
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"replace": false,
"values": [
{"id":"#forge:dyes/brown", "required": false},
"minecraft:brown_dye"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"replace": false,
"values": [
{"id":"#forge:cookingoil", "required": false}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"replace": false,
"values": [
{"id":"#forge:dyes/cyan", "required": false},
"minecraft:cyan_dye"
]
}
Loading

0 comments on commit 4f2f4ca

Please sign in to comment.