Skip to content

Commit

Permalink
Initial Port of Neoforge
Browse files Browse the repository at this point in the history
  • Loading branch information
Direwolf20-MC committed May 11, 2024
1 parent 2aa3878 commit 806eb7e
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 25 deletions.
32 changes: 25 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.80'
id 'net.neoforged.gradle.userdev' version '7.0.107'
}

version = "${mod_version}"
Expand Down Expand Up @@ -57,7 +57,12 @@ base {
}

// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
vendor.set(JvmVendorSpec.JETBRAINS)
}
}

//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager

Expand All @@ -79,16 +84,29 @@ runs {
systemProperty 'forge.logging.console.level', 'debug'

modSource project.sourceSets.main

//if the selected toolchain is a JBR, enable DCEVM
//if (run.project.javaToolchains.launcherFor(java.toolchain).map { it.metadata.vendor }.getOrElse("").contains("JetBrains")) {
// run.jvmArgument("-XX:+AllowEnhancedClassRedefinition")
//}
}

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

client2 {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
configure('client')
programArguments.addAll '--username', 'Direwolf21'
}

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

// This run config launches GameTestServer and runs all registered gametests, then exits.
Expand Down Expand Up @@ -129,9 +147,9 @@ dependencies {

// Example mod dependency with JEI
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
compileOnly "mezz.jei:jei-${minecraft_version}-common-api:${jei_version}"
compileOnly "mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}"
runtimeOnly "mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}"
compileOnly "mezz.jei:jei-1.20.4-common-api:${jei_version}"
compileOnly "mezz.jei:jei-1.20.4-forge-api:${jei_version}"
//runtimeOnly "mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}"

// Locally sourced extra mods for runtime (i.e. testing)
for (extraModJar in fileTree(dir: extraModsDir, include: '*.jar')) {
Expand Down Expand Up @@ -183,7 +201,7 @@ tasks.withType(ProcessResources).configureEach {
]
inputs.properties replaceProperties

filesMatching(['META-INF/mods.toml']) {
filesMatching(['META-INF/neoforge.mods.toml']) {
expand replaceProperties + [project: project]
}
}
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ neogradle.subsystems.parchment.mappingsVersion=2023.12.31
# Environment Properties
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
# The Minecraft version must agree with the Neo version to get a valid artifact
minecraft_version=1.20.4
minecraft_version=1.20.6
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.20.4,1.21)
minecraft_version_range=[1.20.6,1.21)
# The Neo version must agree with the Minecraft version to get a valid artifact
neo_version=20.4.158-beta
neo_version=20.6.52-beta
# The Neo version range can use any version of Neo as bounds
neo_version_range=[20.4,)
neo_version_range=[20.6,)
# The loader version range can only use the major version of FML as bounds
loader_version_range=[2,)
#Mod Info
mod_id=mininggadgets
mod_name=Mining Gadgets
mod_version=1.16.0
mod_version=1.17.0
mod_license=MIT
mod_authors=direwolf20
mod_group_id=com.direwolf20.mininggadgets
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
17 changes: 9 additions & 8 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ 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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -144,15 +145,15 @@ 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 @@ -201,11 +202,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
7 changes: 3 additions & 4 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://maven.parchmentmc.org' } // Add this line
maven { url = 'https://maven.neoforged.net/releases' }
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
}
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}
File renamed without changes.

0 comments on commit 806eb7e

Please sign in to comment.