Skip to content

Commit

Permalink
Port to 1.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroksl committed Aug 16, 2024
1 parent ea8a764 commit 24dca0a
Show file tree
Hide file tree
Showing 45 changed files with 1,061 additions and 1,073 deletions.
199 changes: 100 additions & 99 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,84 +1,95 @@
buildscript {
dependencies {
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
}
}

plugins {
id 'idea'
id 'java-library'
id 'maven-publish'
id 'net.neoforged.gradle' version '[6.0.18,6.2)'
id 'org.spongepowered.mixin' version '0.7.+'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
id 'net.neoforged.moddev' version '1.0.17'
}

tasks.named('wrapper', Wrapper).configure {
distributionType = Wrapper.DistributionType.BIN
}

version = mod_version
group = mod_group_id

repositories {
mavenLocal()
}

base {
archivesName = mod_id
}

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

println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft {
mappings channel: mapping_channel, version: mapping_version
copyIdeResources = true
runs {
configureEach {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
mods {
"${mod_id}" {
source sourceSets.main
}
}
neoForge {
version = project.neo_version

parchment {
mappingsVersion = project.parchment_mappings_version
minecraftVersion = project.parchment_minecraft_version
}

mods {
ae2netanalyser {
sourceSet sourceSets.main
}
}

runs {
client {
property 'forge.enabledGameTestNamespaces', mod_id
arg "-mixin.config=" + "mixins.aae.json"
client()
}

server {
property 'forge.enabledGameTestNamespaces', mod_id
arg "-mixin.config=" + "mixins.aae.json"
args '--nogui'
server()
programArgument '--nogui'
}

gameTestServer {
property 'forge.enabledGameTestNamespaces', mod_id
gametestWorld {
type = "gameTestServer"
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}

data {
workingDirectory project.file('run-data')
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', 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 {
systemProperty 'forge.logging.markers', 'REGISTRIES'
logLevel = org.slf4j.event.Level.DEBUG
}
}
}

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

configurations {
runtimeClasspath.extendsFrom localRuntime
}

repositories {
mavenLocal()
mavenCentral()
maven {
url = "https://cursemaven.com"
name = "TerraformersMC"
url = "https://maven.terraformersmc.com/"
content {
includeGroup "curse.maven"
includeGroup "dev.emi"
}
}
maven {
url = "https://maven.blamejared.com/"
}
maven {
url = "https://dvs1.progwml6.com/files/maven/"
name 'cursemaven'
url "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven {
name = "Modmaven"
url = "https://modmaven.dev/"
url = uri("https://modmaven.dev/")
content {
includeGroup("appeng")
includeGroup("de.mari_023")
}
}
maven {
url "https://maven.shedaniel.me/"
Expand All @@ -91,81 +102,71 @@ repositories {
}

dependencies {
minecraft "net.neoforged:forge:${minecraft_version}-${forge_version}"
implementation fg.deobf("curse.maven:glodium-957920:5006780")
compileOnly fg.deobf("curse.maven:applied-energistics-2-wireless-terminals-459929:5162352")
compileOnly fg.deobf("mezz.jei:jei-1.20.1-forge:15.0.0.12")
compileOnly fg.deobf("curse.maven:applied-flux-965012:5392513")
compileOnly fg.deobf("appeng:appliedenergistics2-forge:15.2.11")
compileOnly fg.deobf("curse.maven:ex-pattern-provider-892005:5577174")
compileOnly fg.deobf("curse.maven:jade-324717:4768593")
compileOnly fg.deobf("curse.maven:mekanism-268560:5395221")
// rei
compileOnly "me.shedaniel.cloth:basic-math:0.6.1"
compileOnly fg.deobf("dev.architectury:architectury-forge:7.0.66")
compileOnly fg.deobf("me.shedaniel:RoughlyEnoughItems-forge:12.0.622")
compileOnly fg.deobf("me.shedaniel.cloth:cloth-config-forge:9.0.94")
annotationProcessor 'org.spongepowered:mixin:0.8.4:processor'
implementation "curse.maven:glodium-957920:5614731"
implementation "curse.maven:applied-energistics-2-223794:5610903"
implementation "curse.maven:ex-pattern-provider-892005:5617630"
compileOnly "curse.maven:emi-580555:5619579"
compileOnly "curse.maven:applied-flux-965012:5614830"
//compileOnly "curse.maven:jade-324717:5427817"
//compileOnly "me.shedaniel:RoughlyEnoughItems-neoforge:16.0.729"
// runtime test
runtimeOnly fg.deobf("curse.maven:jei-238222:5621194")
runtimeOnly fg.deobf("curse.maven:applied-energistics-2-223794:5565729")
runtimeOnly fg.deobf("curse.maven:ex-pattern-provider-892005:5577174")
runtimeOnly fg.deobf("curse.maven:applied-flux-965012:5392513")
runtimeOnly fg.deobf("curse.maven:jade-324717:4768593")
runtimeOnly fg.deobf("curse.maven:mekanism-268560:5395221")
//runtimeOnly "curse.maven:applied-flux-965012:5614830"
//runtimeOnly "de.mari_023:ae2wtlib:19.1.0-alpha.1"
//runtimeOnly "curse.maven:mega-cells-622112:5575776"
//runtimeOnly "curse.maven:jade-324717:5427817"
// setup Xei
switch (use_Xei) {
case "emi":
//runtimeOnly "dev.emi:emi-neoforge:1.1.10+1.21"
break
case "rei":
//runtimeOnly "me.shedaniel:RoughlyEnoughItems-neoforge:16.0.729"
//runtimeOnly "dev.architectury:architectury-neoforge:13.0.1"
//runtimeOnly "curse.maven:cloth-config-348521:5424576"
break
}
}

tasks.named('processResources', ProcessResources).configure {
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
var replaceProperties = [
minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range,
neo_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,
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/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' : '1',
'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"),
'TweakClass' : "org.spongepowered.asm.launch.MixinTweaker",
'TweakOrder' : 0,
'MixinConfigs' : "mixins.aae.json"
])
}
finalizedBy 'reobfJar'
expand replaceProperties
from "src/main/templates"
into "build/generated/sources/modMetadata"
}

// Example configuration to allow publishing using the maven-publish plugin
publishing {
publications {
register('mavenJava', MavenPublication) {
artifact jar
from components.java
}
}
repositories {
maven {
url "file://${project.projectDir}/mcmodsrepo"
url "file://${project.projectDir}/repo"
}
}
}

mixin {
add sourceSets.main, "mixins.aae.refmap.json"
}

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

idea {
module {
downloadSources = true
downloadJavadoc = true
}
}
26 changes: 15 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
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
parchment_minecraft_version=1.21
parchment_mappings_version=2024.07.28
## Environment Properties
minecraft_version=1.20.1
minecraft_version_range=[1.20.1,1.20.2)
forge_version=47.1.54
forge_version_range=[47,)
loader_version_range=[47,)
mapping_channel=parchment
mapping_version=2023.09.03-1.20.1
minecraft_version=1.21
minecraft_version_range=[1.21,1.21.1)
neo_version=21.1.1
neo_version_range=[21.1.0-beta,)
loader_version_range=[4,)
## Mod Properties
mod_id=advanced_ae
mod_name=Advanced AE
mod_license=LGPL-3.0
mod_version=0.1-1.20.1
mod_version=0.1-1.21.1
mod_group_id=net.pedroksl.advanced_ae
mod_authors=Pedroksl
mod_description=This mod aims to expand on the added capabilities of Extended AE.
mod_description=This mod aims to expand on the added capabilities of Extended AE.
use_Xei=emi
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.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
29 changes: 18 additions & 11 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -83,7 +85,9 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -130,26 +134,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -198,11 +205,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down Expand Up @@ -242,4 +249,4 @@ eval "set -- $(
tr '\n' ' '
)" '"$@"'

exec "$JAVACMD" "$@"
exec "$JAVACMD" "$@"
Loading

0 comments on commit 24dca0a

Please sign in to comment.