Skip to content

Commit

Permalink
Update to Forge 48.1.0 & Neoforge 20.2.86
Browse files Browse the repository at this point in the history
- Move to Multiloader mod template to support Forge and Neoforge
  • Loading branch information
cech12 committed Jan 3, 2024
1 parent 5c27142 commit fdaf6a8
Show file tree
Hide file tree
Showing 68 changed files with 991 additions and 291 deletions.
15 changes: 13 additions & 2 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,22 @@ body:
description: What version of Minecraft were you running?
validations:
required: true
- type: dropdown
id: modLoader
attributes:
label: Mod Loader
description: What mod loader were you using?
options:
- Fabric
- Forge
- NeoForge
validations:
required: true
- type: input
id: modLoaderVersion
attributes:
label: Forge Version
description: What version of Forge were you using?
label: Mod Loader Version
description: What mod loader version were you using?
validations:
required: true
- type: input
Expand Down
48 changes: 44 additions & 4 deletions .github/workflows/cicd-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ jobs:
mod-id: ceramicbucket
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
publish-curseforge:
publish-forge-on-curseforge:
needs: publish-github
if: startsWith(github.ref, 'refs/tags/')
name: Publish Curseforge
name: Publish Forge on Curseforge
uses: cech12/MinecraftModActions/.github/workflows/publish-curseforge.yml@main
with:
java-version: 17
subproject: forge
title-prefix: forge-
curseforge-id: 363799
game-versions: |
1.20.2
Expand All @@ -49,13 +51,51 @@ jobs:
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }}
publish-modrinth:
publish-forge-on-modrinth:
needs: publish-github
if: startsWith(github.ref, 'refs/tags/')
name: Publish Modrinth
name: Publish Forge on Modrinth
uses: cech12/MinecraftModActions/.github/workflows/publish-modrinth.yml@main
with:
java-version: 17
subproject: forge
title-prefix: forge-
modrinth-id: M9G5zpf1
game-versions: |
1.20.2
release-type: release
loaders: |
forge
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
modrinth-token: ${{ secrets.MODRINTH_API_KEY }}
publish-neoforge-on-curseforge:
needs: publish-github
if: startsWith(github.ref, 'refs/tags/')
name: Publish NeoForge on Curseforge
uses: cech12/MinecraftModActions/.github/workflows/publish-curseforge.yml@main
with:
java-version: 17
subproject: neoforge
title-prefix: neoforge-
curseforge-id: 363799
game-versions: |
1.20.2
release-type: release
loaders: |
neoforge
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }}
publish-neoforge-on-modrinth:
needs: publish-github
if: startsWith(github.ref, 'refs/tags/')
name: Publish NeoForge on Modrinth
uses: cech12/MinecraftModActions/.github/workflows/publish-modrinth.yml@main
with:
java-version: 17
subproject: neoforge
title-prefix: neoforge-
modrinth-id: M9G5zpf1
game-versions: |
1.20.2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ build
# other
eclipse
run
runs
run-data

# Files from Forge MDK
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Forge Recommended Versioning](https://mcforge.readthedocs.io/en/latest/conventions/versioning/).

## [1.20.2-5.0.0.0] - 2024-01-03
- Update to Forge 48.1.0 & Neoforge 20.2.86
- Move to Multiloader mod template to support Forge and Neoforge

## [1.20.2-4.2.0.0] - 2023-10-16
### Changed
- update and move back to Forge 1.20.2-48.0.23 (from NeoForge) until it is stable
Expand Down
230 changes: 76 additions & 154 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,169 +1,91 @@
plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
// Required for NeoGradle
id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7"
}

version = "${minecraft_version}-${mod_version}"
group = mod_group_id
base {
archivesName = mod_id
}

// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft {
mappings channel: 'official', version: minecraft_version

// When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
// In most cases, it is not necessary to enable.
// enableEclipsePrepareRuns = true
// enableIdeaPrepareRuns = true

// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
// It is REQUIRED to be set to true for this template to function.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
copyIdeResources = true

// When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
// The folder name can be set on a run configuration using the "folderName" property.
// By default, the folder name of a run configuration is the name of the Gradle project containing it.
// generateRunFolders = true

// See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

// Default run configurations.
runs {
// applies to all the run configs below
configureEach {
workingDirectory project.file('run')

// 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.
property '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
property 'forge.logging.console.level', 'debug'

//for bucketlib
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"

mods {
"${mod_id}" {
source sourceSets.main
}
}
}

client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', mod_id
subprojects {
apply plugin: 'java'

version "$project.minecraft_version-$project.mod_version"

java.toolchain.languageVersion = JavaLanguageVersion.of(17)
//java.withSourcesJar()
//java.withJavadocJar()

jar {
from(rootProject.file("LICENSE"))
manifest {
attributes([
'Specification-Title' : mod_id,
'Specification-Vendor' : mod_author,
'Specification-Version' : project.jar.archiveVersion,
'Implementation-Title' : project.name,
'Implementation-Version' : project.jar.archiveVersion,
'Implementation-Vendor' : mod_author,
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'Timestamp' : System.currentTimeMillis(),
'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
'Built-On-Minecraft' : minecraft_version
])
}
}

server {
property 'forge.enabledGameTestNamespaces', mod_id
args '--nogui'
}
//sourcesJar {
// from(rootProject.file("LICENSE"))
//}

gameTestServer {
property 'forge.enabledGameTestNamespaces', mod_id
repositories {
mavenCentral()
maven {
name = 'Sponge / Mixin'
url = 'https://repo.spongepowered.org/repository/maven-public/'
}

data {
// example of overriding the workingDirectory set in configureEach above
workingDirectory project.file('run-data')

// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
maven {
name = 'BlameJared Maven (JEI / CraftTweaker / Bookshelf)'
url = 'https://maven.blamejared.com'
}
}
}

// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }

repositories {
maven {
name 'Jitpack'
url 'https://jitpack.io'
}
maven {
url 'https://repo.maven.apache.org/maven2'
name 'Maven Central'
}
}

dependencies {
minecraft "net.minecraftforge:forge:${project.minecraft_version}-${project.forge_version}"

// compile against the BucketLib API but do not include it at runtime
compileOnly fg.deobf("com.github.cech12:BucketLib:${project.bucketlib_version}:api")
// at runtime, use the full BucketLib jar
runtimeOnly fg.deobf("com.github.cech12:BucketLib:${project.bucketlib_version}")
}

tasks.named('processResources', ProcessResources).configure {
var replaceProperties = [
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version: forge_version, forge_version_range: forge_version_range,
loader_version_range: loader_version_range,
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors: mod_authors, mod_description: mod_description, mod_issue_tracker: mod_issue_tracker,
mod_url: mod_url,
bucketlib_version_range: bucketlib_version_range
]
inputs.properties replaceProperties

filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
expand replaceProperties + [project: project]
}
}

tasks.named('jar', Jar).configure {
manifest {
attributes([
'Specification-Title' : mod_id,
'Specification-Vendor' : mod_authors,
'Specification-Version' : project.jar.archiveVersion,
'Implementation-Title' : project.name,
'Implementation-Version' : project.jar.archiveVersion,
'Implementation-Vendor' : mod_authors,
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
tasks.withType(JavaCompile).configureEach {
it.options.encoding = 'UTF-8'
it.options.getRelease().set(17)
}

// This is the preferred method to reobfuscate your jar file
finalizedBy 'reobfJar'
}

// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing:
// tasks.named('publish').configure {
// dependsOn 'reobfJar'
// }

publishing {
publications {
register('mavenJava', MavenPublication) {
artifact jar
processResources {
def expandProps = [
"version": version,
"group": project.group, //Else we target the task's group.
"minecraft_version": minecraft_version,
"minecraft_version_range": minecraft_version_range,
"forge_version": forge_version,
"forge_version_range": forge_version_range,
"forge_loader_version_range": forge_loader_version_range,
//"fabric_version": fabric_version,
//"fabric_loader_version": fabric_loader_version,
"neoforge_version": neoforge_version,
"neoforge_version_range": neoforge_version_range,
"neoforge_loader_version_range": neoforge_loader_version_range,
"mod_id": mod_id,
"mod_name": mod_name,
"mod_author": mod_author,
"mod_license": mod_license,
"mod_url": mod_url,
"mod_issue_tracker": mod_issue_tracker,
"mod_description": project.description,
"bucketlib_version": bucketlib_version,
"bucketlib_version_range": bucketlib_version_range
]

filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml', '*.mixins.json']) {
expand expandProps
}
inputs.properties(expandProps)
}
repositories {
maven {
url "file://${project.projectDir}/mcmodsrepo"
}
}
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
// Disables Gradle's custom module metadata from being published to maven. The
// metadata includes mapped dependencies which are not reasonably consumable by
// other mod developers.
tasks.withType(GenerateModuleMetadata).configureEach {
enabled = false
}
}
34 changes: 34 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
plugins {
id 'idea'
id 'java'
id 'maven-publish'
id 'org.spongepowered.gradle.vanilla' version '0.2.1-SNAPSHOT'
}
base {
archivesName = "${mod_id}-common"
}
minecraft {
version(minecraft_version)
if(file("src/main/resources/${mod_id}.accesswidener").exists()){
accessWideners(file("src/main/resources/${mod_id}.accesswidener"))
}
}

dependencies {
compileOnly group:'org.spongepowered', name:'mixin', version:'0.8.5'
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
}

publishing {
publications {
mavenJava(MavenPublication) {
artifactId base.archivesName.get()
from components.java
}
}
repositories {
maven {
url "file://" + System.getenv("local_maven")
}
}
}
Loading

0 comments on commit fdaf6a8

Please sign in to comment.