Skip to content

Commit

Permalink
Update to 1.21 NeoForge
Browse files Browse the repository at this point in the history
  • Loading branch information
Gegy committed Oct 22, 2024
1 parent 9745448 commit ca92a83
Show file tree
Hide file tree
Showing 21 changed files with 573 additions and 744 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ name: Java CI with Gradle
on: [push]
jobs:

jdk17:
jdk21:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup JDK 17
- name: Setup JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'

- name: Build with Gradle
Expand All @@ -30,7 +30,7 @@ jobs:
run: echo "jarname=$(find build/libs/ -name "*.jar" -not -name "*slim*" -not -name "*source*" | sed 's:.*/::')" >> $GITHUB_OUTPUT

- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ steps.jarname.outputs.jarname }}
path: ${{ steps.jar.outputs.jarfile }}
174 changes: 52 additions & 122 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
buildscript {
repositories {
maven { url = 'https://repo.spongepowered.org/maven' }
maven { url = 'https://maven.parchmentmc.org' }
mavenCentral()
}
dependencies {
classpath "org.parchmentmc:librarian:1.+"
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
}
}
plugins {
id 'maven-publish'
id 'eclipse'
id 'net.neoforged.gradle' version '[6.0.18,6.2)'
id 'com.github.johnrengelman.shadow' version '7.1.0'
id 'idea'
id 'java-library'
id 'maven-publish'
id 'net.neoforged.moddev' version '1.0.0'
id 'com.matthewprenger.cursegradle' version '1.4.0'
}
apply plugin: 'org.parchmentmc.librarian.forgegradle'
apply plugin: 'org.spongepowered.mixin'
apply from: 'https://raw.githubusercontent.com/SizableShrimp/Forge-Class-Remapper/main/classremapper.gradle'

group = 'com.tterrag.dummyplayers'
archivesBaseName = 'DummyPlayers'
base {
archivesName = 'DummyPlayers'
}

ext.buildnumber = 0
project.buildnumber = System.getenv('BUILD_NUMBER') ?: 'custom'
Expand All @@ -33,61 +22,41 @@ if (System.getenv('GITHUB_RUN_NUMBER')) {
version = "${mod_version}-${release_type}+${buildnumber}"
}

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '17' // Need this here so eclipse task generates correctly.
java.toolchain.languageVersion = JavaLanguageVersion.of(21)

neoForge {
version = project.neo_version

minecraft {
mappings channel: 'parchment', version: '2023.07.30-1.20.1'

accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
parchment {
minecraftVersion = minecraft_version
mappingsVersion = parchment_version
}

runs {
client {
taskName 'dummyplayers_client'

workingDirectory project.file('run')

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

mods {
dummyplayers {
source sourceSets.main
}
}
client()
programArguments.addAll '--username', 'Dev###'
}

server {
taskName 'dummyplayers_server'

workingDirectory project.file('run')

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

mods {
dummyplayers {
source sourceSets.main
}
}
server()
programArgument '--nogui'
}

data {
taskName 'dummyplayers_data'

workingDirectory project.file('run')

environment 'target', 'fmluserdevdata'

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

mods {
dummyplayers {
source sourceSets.main
}
}

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

configureEach {
logLevel = org.slf4j.event.Level.DEBUG
}
}

mods {
"${project.mod_id}" {
sourceSet sourceSets.main
sourceSet sourceSets.test
}
}
}
Expand All @@ -97,73 +66,34 @@ sourceSets.main.resources {
}

repositories {
mavenLocal()
}

configurations {
shade
}

repositories {
maven { // Registrate
url "https://maven.tterrag.com/"
}
maven {
name = 'sponge'
url = 'https://repo.spongepowered.org/repository/maven-public/'
content {
includeGroup "org.spongepowered"
}
}
maven { url = "https://maven.ithundxr.dev/snapshots/" }
maven { url = "https://maven.tterrag.com/" }
mavenLocal()
}

dependencies {
minecraft 'net.neoforged:forge:' + minecraft_version + '-' + forge_version

def registrate = "com.tterrag.registrate:Registrate:${registrate_version}"
implementation fg.deobf(registrate)
shade registrate

// Annotation Processors
def mixinap = 'org.spongepowered:mixin:0.8.5-SNAPSHOT:processor'
annotationProcessor mixinap
testAnnotationProcessor mixinap
}

shadowJar {
configurations = [project.configurations.shade]
relocate 'com.tterrag.registrate', 'com.tterrag.dummyplayers.repack.registrate'
archiveClassifier = ''
jarJar(implementation("com.tterrag.registrate:Registrate:MC1.21-${registrate_version}")) {
version {
strictly "[MC1.21-${registrate_version},MC1.22)"
prefer "MC1.21-${registrate_version}"
}
}
}

reobf {
shadowJar {}
}
tasks.withType(ProcessResources).configureEach {
var replaceProperties = [
mod_version: mod_version,
]
inputs.properties replaceProperties

build.dependsOn shadowJar
build.dependsOn reobfShadowJar

jar {
archiveClassifier = 'slim'

manifest {
attributes([
"Specification-Title": "dummyplayers",
"Specification-Vendor": "tterrag",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"tterrag",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
])
filesMatching(['META-INF/neoforge.mods.toml']) {
expand replaceProperties
}
}

if (System.getProperty("idea.sync.active") == "true") {
afterEvaluate {
tasks.withType(JavaCompile).all {
it.options.annotationProcessorPath = files()
}
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}
20 changes: 11 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
mod_version=1.0.2
mod_id=ltminigames
mod_version=1.0.3
release_type=release
minecraft_version=1.20.1
forge_version=47.1.79
minecraft_version=1.21
neo_version=21.0.58-beta
parchment_version=2024.06.23
registrate_version=1.3.0+35

registrate_version=MC1.20-1.3.11

# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
org.gradle.jvmargs=-Xmx1G
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=true
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +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.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit ca92a83

Please sign in to comment.