Skip to content

Commit

Permalink
Updated for NeoForge 1.20.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexeption committed Jun 14, 2024
1 parent 17b77d8 commit 5e08ca6
Show file tree
Hide file tree
Showing 24 changed files with 376 additions and 397 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: openjdk:17-jdk
image: openjdk:21-jdk
steps:
- uses: actions/checkout@v2.3.4
- uses: gradle/wrapper-validation[email protected]
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v3
- run: chmod +x ./gradlew
- run: ./gradlew clean build publish curseforge modrinth
- run: ./gradlew clean build publishCurseForge modrinth
env:
REPO_PASSWORD: ${{ secrets.REPO_PASSWORD }}
CURSE_API_KEY: ${{ secrets.CURSE_API_KEY }}
MODRINTH_API_KEY: ${{ secrets.MODRINTH_API_KEY }}
- uses: actions/upload-artifact@v2.2.2
- uses: actions/upload-artifact@v4
with:
name: Builds
path: build/libs/*.jar
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,5 @@ run/

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

runs/
253 changes: 93 additions & 160 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,92 +1,23 @@
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net' }
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '6.+', changing: true
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.4.0"
classpath group: 'com.modrinth.minotaur', name: 'Minotaur', version: '2+'
}
plugins {
id 'java-library'
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.142'
id 'net.darkhax.curseforgegradle' version '1.1.15'
id "com.modrinth.minotaur" version "2.+"
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.spongepowered.mixin'
apply plugin: "com.matthewprenger.cursegradle"
apply plugin: 'maven-publish'
apply plugin: 'com.modrinth.minotaur'

group = 'uk.co.hexeption'
version = '1.20.1-1.0.0'
def env = System.getenv()
if (env.GITHUB_RUN_NUMBER) {
version = version + "+" + "${env.GITHUB_RUN_NUMBER}"
}

java {
archivesBaseName = 'AEInfinityBooster'
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: '1.20.1'

runs {
client {
workingDirectory project.file('run/client')

property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'

mods {
aeinfinitybooster {
source sourceSets.main
}
}
}

server {
workingDirectory project.file('run/server')

property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'

mods {
aeinfinitybooster {
source sourceSets.main
}
}
}

data {
workingDirectory project.file('run/data')

property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'

args '--mod', 'aeinfinitybooster', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')

mods {
aeinfinitybooster {
source sourceSets.main
}
}
}
}
mod_version = 'neoforge-1.20.6-1.0.0' + "+" + "${env.GITHUB_RUN_NUMBER}"
}

mixin {
add sourceSets.main, "AEInfinityBooster.refmap.json"

config "AEInfinityBooster.mixins.json"
}

sourceSets.main.resources { srcDir 'src/generated/resources' }
version = mod_version
group = mod_group_id

repositories {
mavenLocal()
maven {
name "Modmaven"
url "https://modmaven.dev/"
Expand All @@ -105,110 +36,112 @@ repositories {
}
}

dependencies {
minecraft 'net.minecraftforge:forge:1.20.1-47.1.43'
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
runtimeOnly fg.deobf("mezz.jei:jei-1.20.1-forge:15.0.0.12")
compileOnly fg.deobf("appeng:appliedenergistics2-forge:15.0.9-beta")
runtimeOnly fg.deobf("appeng:appliedenergistics2-forge:15.0.9-beta")
base {
archivesName = mod_id
}

jar {
manifest {
attributes([
"Specification-Title" : "aeinfinitybooster",
//"Specification-Vendor": "aeinfinitybooster authors",
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : project.jar.archiveVersion,
//"Implementation-Vendor": "aeinfinitybooster authors",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConfigs" : "AEInfinityBooster.mixins.json"
])
// Mojang ships Java 21 to end users starting in 1.20.5, so mods should target Java 21.
java.toolchain.languageVersion = JavaLanguageVersion.of(21)

runs {
configureEach {
systemProperty 'forge.logging.markers', 'REGISTRIES'
systemProperty 'forge.logging.console.level', 'debug'

modSource project.sourceSets.main
}

client {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}

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

gameTestServer {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}

data {
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
}

jar.finalizedBy('reobfJar')
sourceSets.main.resources { srcDir 'src/generated/resources' }

mixin {
add sourceSets.main, "AEInfinityBooster.refmap.json"
configurations {
runtimeClasspath.extendsFrom localRuntime
}

task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
dependencies {
implementation "net.neoforged:neoforge:${neo_version}"
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
runtimeOnly "mezz.jei:jei-1.20.6-neoforge:18.0.0.62"
compileOnly "appeng:appliedenergistics2-neoforge:18.1.3-alpha"
runtimeOnly "appeng:appliedenergistics2-neoforge:18.1.3-alpha"
}

task deobfJar(type: Jar) {
from sourceSets.main.output
archiveClassifier = 'deobf'
tasks.withType(ProcessResources).configureEach {
var replaceProperties = [
minecraft_version : minecraft_version,
minecraft_version_range: minecraft_version_range,
neo_version : neo_version,
neo_version_range : neo_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
]
inputs.properties replaceProperties

filesMatching(['META-INF/neoforge.mods.toml']) {
expand replaceProperties
}
}

artifacts {
archives jar
archives sourcesJar
archives deobfJar

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

curseforge {
if (env.CURSE_API_KEY) {
apiKey = env.CURSE_API_KEY
}
project {
id = '559313'
changelog = 'A changelog can be found at https://github.com/Hexeption/AEInfinityBooster'
releaseType = 'release'
addGameVersion '1.20'
addGameVersion '1.20.1'

mainArtifact(jar) {
displayName = "AEInfinityBooster v$version"
}
relations {
requiredDependency 'applied-energistics-2'
}
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
artifact sourcesJar
artifact deobfJar
}
}
task publishCurseForge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {

apiToken = env.CURSE_API_KEY

// The main file to upload
def mainFile = upload(559313, jar)
mainFile.releaseType = 'release'
mainFile.changelog = 'A changelog can be found at https://github.com/Hexeption/AEInfinityBooster'
mainFile.changelogType = 'markdown'
mainFile.gameVersions = ['1.20.6']
mainFile.addModLoader("neoforge")
mainFile.displayName = "AEInfinityBooster v${version}"


// select the repositories you want to publish to
repositories {
// uncomment to publish to the local maven
// mavenLocal()
if (env.REPO_PASSWORD) {
maven {
url = "https://nexus.hexeption.dev/repository/hex-mods/"
credentials {
username = "admin"
password = env.REPO_PASSWORD
}
}
}
}
}

modrinth {
if (env.MODRINTH_API_KEY) {
token = env.MODRINTH_API_KEY
}
token = env.MODRINTH_API_KEY
projectId = 'VQhDBNs8'
versionName = "AEInfinityBooster v$version"
changelog = 'A changelog can be found at https://github.com/Hexeption/AEInfinityBooster'
versionNumber = "$version"
uploadFile = jar
gameVersions = ["1.20.1"]
loaders = ["forge"]
gameVersions = ["1.20.6"]
loaders = ["neoforge"]
dependencies {
required.version "ae2", "forge-15.0.9-beta"
required.version "ae2", "18.1.3-alpha"
}
}

20 changes: 20 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

neogradle.subsystems.parchment.minecraftVersion=1.20.6
neogradle.subsystems.parchment.mappingsVersion=2024.05.01

minecraft_version=1.20.6
minecraft_version_range=[1.20.6,1.21)

neo_version=20.6.112-beta
neo_version_range=[20.6,)

loader_version_range=[2,)

## Mod Properties
mod_id=aeinfinitybooster
mod_name=AEInfinityBooster
mod_license=GNU Lesser General Public License
mod_version=1.0.0
mod_group_id=uk.co.hexeption.aeinfinitybooster
mod_authors=Hexeption
mod_description=Adds Infinite Range Card and Dimension Card to AE2
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
Loading

0 comments on commit 5e08ca6

Please sign in to comment.