Migrate the MDK to ForgeGradle 7

This commit is contained in:
Jonathing authored and LexManos committed 2026-02-15 13:13:55 -08:00
1 parent 929064ee69
commit d29524bac3
12 files changed
+118 -438

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ jobs:
name: Upload payload name: Upload payload
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/upload-artifact@v3 # Payload artifact is consumed in Actionable - uses: actions/upload-artifact@v4 # Payload artifact is consumed in Actionable
with: with:
name: payload name: payload
path: ${{ github.event_path }} path: ${{ github.event_path }}
@@ -7,7 +7,7 @@ jobs:
name: Upload payload name: Upload payload
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/upload-artifact@v3 # Payload artifact is consumed in Actionable - uses: actions/upload-artifact@v4 # Payload artifact is consumed in Actionable
with: with:
name: payload name: payload
path: ${{ github.event_path }} path: ${{ github.event_path }}
-65
View File
@@ -1,65 +0,0 @@
Minecraft Forge: Credits/Thank You
Forge is a set of tools and modifications to the Minecraft base game code to assist
mod developers in creating new and exciting content. It has been in development for
several years now, but I would like to take this time thank a few people who have
helped it along its way.
First, the people who originally created the Forge projects way back in Minecraft
alpha. Eloraam of RedPower, and SpaceToad of Buildcraft, without their acceptiance
of me taking over the project, who knows what Minecraft modding would be today.
Secondly, someone who has worked with me, and developed some of the core features
that allow modding to be as functional, and as simple as it is, cpw. For developing
FML, which stabilized the client and server modding ecosystem. As well as the base
loading system that allows us to modify Minecraft's code as elegently as possible.
Mezz, who has stepped up as the issue and pull request manager. Helping to keep me
sane as well as guiding the community into creating better additions to Forge.
Searge, Bspks, Fesh0r, ProfMobious, and all the rest over on the MCP team {of which
I am a part}. For creating some of the core tools needed to make Minecraft modding
both possible, and as stable as can be.
On that note, here is some specific information of the MCP data we use:
* Minecraft Coder Pack (MCP) *
Forge Mod Loader and Minecraft Forge have permission to distribute and automatically
download components of MCP and distribute MCP data files. This permission is not
transitive and others wishing to redistribute the Minecraft Forge source independently
should seek permission of MCP or remove the MCP data files and request their users
to download MCP separately.
And lastly, the countless community members who have spent time submitting bug reports,
pull requests, and just helping out the community in general. Thank you.
--LexManos
=========================================================================
This is Forge Mod Loader.
You can find the source code at all times at https://github.com/MinecraftForge/MinecraftForge/tree/1.12.x/src/main/java/net/minecraftforge/fml
This minecraft mod is a clean open source implementation of a mod loader for minecraft servers
and minecraft clients.
The code is authored by cpw.
It began by partially implementing an API defined by the client side ModLoader, authored by Risugami.
https://www.minecraftforum.net/topic/75440-
This support has been dropped as of Minecraft release 1.7, as Risugami no longer maintains ModLoader.
It also contains suggestions and hints and generous helpings of code from LexManos, author of MinecraftForge.
https://minecraftforge.net/
Additionally, it contains an implementation of topological sort based on that
published at http://keithschwarz.com/interesting/code/?dir=topological-sort
It also contains code from the Maven project for performing versioned dependency
resolution. http://maven.apache.org/
It also contains a partial repackaging of the javaxdelta library from http://sourceforge.net/projects/javaxdelta/
with credit to it's authors.
Forge Mod Loader downloads components from the Minecraft Coder Pack
(http://mcp.ocean-labs.de/index.php/Main_Page) with kind permission from the MCP team.
+15 -7
View File
@@ -79,7 +79,6 @@ final String SPEC_VERSION = gitversion.info.tag
final def MCP_ARTIFACT = project(':mcp').mcp.config.get() final def MCP_ARTIFACT = project(':mcp').mcp.config.get()
final List<File> EXTRA_TXTS = [ final List<File> EXTRA_TXTS = [
rootProject.file('CREDITS.txt'),
rootProject.file('LICENSE.txt'), rootProject.file('LICENSE.txt'),
rootProject.tasks.createChangelog.outputFile rootProject.tasks.createChangelog.outputFile
] ]
@@ -939,23 +938,31 @@ tasks.register('installerJar', InstallerJar) {
jarSigner.sign(it) jarSigner.sign(it)
} }
final mdkGradleWrapper = tasks.register('mdkGradleWrapper', Wrapper) {
gradleVersion = '9.3.1'
}
tasks.register('mdkZip', Zip) { tasks.register('mdkZip', Zip) {
dependsOn mdkGradleWrapper
archiveBaseName = project.name archiveBaseName = project.name
archiveClassifier = 'mdk' archiveClassifier = 'mdk'
archiveVersion = project.version archiveVersion = project.version
destinationDirectory = file('build/libs') destinationDirectory = file('build/libs')
from rootProject.file('gradlew') from mdkGradleWrapper.map(Wrapper.&getScriptFile)
from rootProject.file('gradlew.bat') from mdkGradleWrapper.map(Wrapper.&getBatchScript)
from(EXTRA_TXTS) from(EXTRA_TXTS)
from(rootProject.file('gradle/')){ into('gradle/wrapper/') {
into('gradle/') from mdkGradleWrapper.map(Wrapper.&getJarFile)
from mdkGradleWrapper.map(Wrapper.&getPropertiesFile)
} }
from(rootProject.file('mdk/')){ from(rootProject.file('mdk/')){
rootProject.file('mdk/gitignore.txt').eachLine{ rootProject.file('mdk/gitignore.txt').eachLine {
if (!it.trim().isEmpty() && !it.trim().startsWith('#')) if (!it.trim().isEmpty() && !it.trim().startsWith('#'))
exclude it exclude it
} }
filter(ReplaceTokens, tokens: [ filter(ReplaceTokens, tokens: [
FORGE_VERSION: FORGE_VERSION, FORGE_VERSION: FORGE_VERSION,
FORGE_GROUP: project.group, FORGE_GROUP: project.group,
@@ -964,7 +971,8 @@ tasks.register('mdkZip', Zip) {
MAPPING_CHANNEL: MAPPING_CHANNEL, MAPPING_CHANNEL: MAPPING_CHANNEL,
MAPPING_VERSION: MAPPING_VERSION, MAPPING_VERSION: MAPPING_VERSION,
FORGE_SPEC_VERSION: SPEC_VERSION.split("\\.")[0], FORGE_SPEC_VERSION: SPEC_VERSION.split("\\.")[0],
MC_NEXT_VERSION: MC_NEXT_VERSION MC_NEXT_VERSION: MC_NEXT_VERSION,
EVENTBUS_VERSION: libs.versions.eventbus.get()
]) ])
rename 'gitignore\\.txt', '.gitignore' rename 'gitignore\\.txt', '.gitignore'
rename 'gitattributes\\.txt', '.gitattributes' rename 'gitattributes\\.txt', '.gitattributes'
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
for file in $(find repo | grep --invert-match -e md5 -e sha | grep -e .jar -e .zip); do
file_path=$(realpath $file)
file_name=$(basename $file)
echo "$file_name"
files=$(unzip -l $file | awk '{print $4}')
for f in $files; do
out="_actual/$file_name/$f"
parent=$(dirname "$out")
echo $out
if [ ! -d "$parent" ]; then
mkdir -p "$parent"
fi
if [[ $f == *.class ]]; then
javap -v -p jar:file://$file_path!/$f | tail -n +4 >$out.txt
elif [[ $f != */ && $f != "Name" && $f != "----" ]]; then
unzip -o -q $file $f -d _actual/$file_name
fi
done
done
+30 -201
View File
@@ -1,235 +1,64 @@
// This is a minimal setup of a Forge mod workspace.
// For complex examples (including AccessTransformers, Jar-in-Jar, and Mixin), see our examples repository.
// https://github.com/MinecraftForge/MDKExamples
plugins { plugins {
id 'eclipse' id 'java'
id 'idea' id 'idea'
id 'maven-publish' id 'eclipse'
id 'net.minecraftforge.gradle' version '[6.0.46,6.2)' id 'net.minecraftforge.gradle' version '[7.0.3,8)'
} }
version = mod_version version = '1.0.0'
group = mod_group_id group = 'com.example.examplemod'
base {
archivesName = mod_id
}
// Mojang ships Java 21 to end users in 1.20.5+, so your mod should target Java 21. // Mojang ships Java 21 to end users in 1.20.5+, so your mod should target Java 21.
java.toolchain.languageVersion = JavaLanguageVersion.of(21) 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'}" // Include generated resources
sourceSets.main.resources { srcDir 'src/generated/resources' }
minecraft { minecraft {
// The mappings can be changed at any time and must be in the following format. mappings channel: 'official', version: '@MC_VERSION@'
// Channel: Version:
// official MCVersion Official field/method names from Mojang mapping files
// parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
//
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
// Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started
//
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: mapping_channel, version: mapping_version
// Forge 1.20.6 and newer use official mappings at runtime, so we shouldn't reobf from official to SRG
reobf = false
// 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
// This property enables access transformers for use in development, applied to the Minecraft artifact.
// The access transformer file can be anywhere in the project.
// However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
// This default location is a best practice to automatically put the file in the right place in the final jar.
// See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information.
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs { runs {
// applies to all the run configs below
configureEach { configureEach {
workingDirectory project.file('run') workingDir = layout.projectDirectory.dir('run')
// Optional additional logging. The markers can be added/remove as needed, separated by commas. systemProperty 'eventbus.api.strictRuntimeChecks', 'true'
// "SCAN": For mods scan. systemProperty 'forge.enabledGameTestNamespaces', 'examplemod'
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
// property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
// Recommended for development - enables more descriptive errors at the cost of slower startup and registration.
property 'eventbus.api.strictRuntimeChecks', 'true'
// arg "-mixin.config=${mod_id}.mixins.json"
} }
client { register('client')
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', mod_id
}
server { register('server') {
property 'forge.enabledGameTestNamespaces', mod_id
args '--nogui' args '--nogui'
} }
// This run config launches GameTestServer and runs all registered gametests, then exits. register('gameTestServer')
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
property 'forge.enabledGameTestNamespaces', mod_id
}
data { register('data') {
// example of overriding the workingDirectory set in configureEach above workingDir = layout.projectDirectory.dir('run-data')
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', 'examplemod', '--all', '--output', layout.projectDirectory.dir('src/generated/resources'), '--existing', layout.projectDirectory.dir('src/main/resources')
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
} }
} }
} }
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories { repositories {
// Put repositories for dependencies here minecraft.mavenizer(it) // In Kotlin, it = this
maven fg.forgeMaven
maven fg.minecraftLibsMaven
mavenCentral() mavenCentral()
maven {
name = 'Forge'
url = 'https://maven.minecraftforge.net'
}
maven {
name = 'Minecraft libraries'
url = 'https://libraries.minecraft.net'
}
exclusiveContent {
forRepository {
maven {
name = 'Sponge'
url = 'https://repo.spongepowered.org/repository/maven-public'
}
}
filter {
includeGroupAndSubgroups('org.spongepowered')
}
}
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
// flatDir {
// dir 'libs'
// }
} }
dependencies { dependencies {
// Specify the version of Minecraft to use. implementation minecraft.dependency('net.minecraftforge:forge:@MC_VERSION@-@FORGE_VERSION@')
// Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact. annotationProcessor 'net.minecraftforge:eventbus-validator:@EVENTBUS_VERSION@'
// The "userdev" classifier will be requested and setup by ForgeGradle.
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
// Forge 1.21.6+ uses EventBus 7, which shifts most of its runtime validation to compile-time via an annotation processor
// to improve performance in production environments. This line is required to enable said compile-time validation
// in your development environment, helping you catch issues early.
annotationProcessor 'net.minecraftforge:eventbus-validator:7.0-beta.12'
// 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-${mc_version}-common-api:${jei_version}"
// compileOnly "mezz.jei:jei-${mc_version}-forge-api:${jei_version}"
// runtimeOnly "mezz.jei:jei-${mc_version}-forge:${jei_version}"
// Example mod dependency using a mod jar from ./libs with a flat dir repository
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
// The group id is ignored when searching -- in this case, it is "blank"
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
// For more info:
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}
// This block of code expands all declared replace properties in the specified resource targets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
tasks.named('processResources', ProcessResources) {
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,
]
inputs.properties replaceProperties
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
expand replaceProperties + [project: project]
}
}
// Example for how to get properties into the manifest for reading at runtime.
tasks.named('jar', Jar) {
manifest {
attributes([
'Specification-Title' : mod_id,
'Specification-Vendor' : mod_authors,
'Specification-Version' : '1', // We are version 1 of ourselves
'Implementation-Title' : project.name,
'Implementation-Version' : project.jar.archiveVersion,
'Implementation-Vendor' : mod_authors
])
// attributes['MixinConfigs'] = "${mod_id}.mixins.json"
}
}
// Example configuration to allow publishing using the maven-publish plugin
publishing {
publications {
register('mavenJava', MavenPublication) {
artifact jar
}
}
repositories {
maven {
url "file://${project.projectDir}/mcmodsrepo"
}
}
} }
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation // Use the UTF-8 charset for Java compilation
} // This is done by default in Java 18+, but this ensures it no matter the Java or Gradle version
options.encoding = 'UTF-8'
// IntelliJ no longer downloads javadocs and sources by default, this tells Gradle to force IntelliJ to do it.
idea.module { downloadJavadoc = downloadSources = true }
eclipse {
// Run everytime eclipse builds the code
//autoBuildTasks genEclipseRuns
// Run when importing the project
synchronizationTasks 'genEclipseRuns'
}
// Merge the resources and classes into the same directory, because Java expects modules to be in a single directory.
// And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem
// This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later.
sourceSets.each {
def dir = layout.buildDirectory.dir("sourcesSets/$it.name")
it.output.resourcesDir = dir
it.java.destinationDirectory = dir
} }
+6 -16
View File
@@ -1,13 +1,11 @@
Source installation information for modders Source installation information for modders
------------------------------------------- -------------------------------------------
This code follows the Minecraft Forge installation methodology. It will apply This code follows the Minecraft Forge installation methodology. It will apply
some small patches to the vanilla MCP source code, giving you and it access some small patches to the vanilla MCP source code, giving you and it access
to some of the data and functions you need to build a successful mod. to some of the data and functions you need to build a successful mod.
Note also that the patches are built against "un-renamed" MCP source code (aka Please note that this example MDK is a simple showcase for the most basic of mods.
SRG Names) - this means that you will not be able to read them directly against To see more examples see our dedicated examples repository under the "Additional Resources" section.
normal code.
Setup Process: Setup Process:
============================== ==============================
@@ -17,30 +15,22 @@ Step 1: Open your command-line and browse to the folder where you extracted the
Step 2: You're left with a choice. Step 2: You're left with a choice.
If you prefer to use Eclipse: If you prefer to use Eclipse:
1. Run the following command: `./gradlew genEclipseRuns` 1. Run the following command: `./gradlew genEclipseRuns`
2. Open Eclipse, Import > Existing Gradle Project > Select Folder 2. Open Eclipse, Import > Existing Gradle Project > Select Folder
or run `gradlew eclipse` to generate the project. or run `gradlew eclipse` to generate the project.
If you prefer to use IntelliJ: If you prefer to use IntelliJ:
1. Open IDEA, and import project. 1. Open IDEA, and import project.
2. Select your build.gradle file and have it import. 2. Select your build.gradle file and have it import.
3. Run the following command: `./gradlew genIntellijRuns` 3. Use the run tasks located under the "Slime Launcher" Gradle task group.
4. Refresh the Gradle Project in IDEA if required.
If at any point you are missing libraries in your IDE, or you've run into problems you can If at any point you are missing libraries in your IDE, or you've run into problems you can
run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything
(this does not affect your code) and then start the process again. (this does not affect your code) and then start the process again.
Mapping Names:
=============================
By default, the MDK is configured to use the official mapping names from Mojang for methods and fields
in the Minecraft codebase. These names are covered by a specific license. All modders should be aware of this
license, if you do not agree with it you can change your mapping names to other crowdsourced names in your
build.gradle. For the latest license text, refer to the mapping file itself, or the reference copy here:
https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
Additional Resources: Additional Resources:
========================= =========================
Community Documentation: https://docs.minecraftforge.net/en/latest/gettingstarted/ Community Documentation: https://docs.minecraftforge.net/en/latest/gettingstarted/
Additional Examples: https://github.com/MinecraftForge/MDKExamples
LexManos' Install Video: https://youtu.be/8VEdtQLuLO0 LexManos' Install Video: https://youtu.be/8VEdtQLuLO0
Forge Forums: https://forums.minecraftforge.net/ Forge Forums: https://forums.minecraftforge.net/
Forge Discord: https://discord.minecraftforge.net/ Forge Discord: https://discord.minecraftforge.net/
+1
View File
@@ -22,4 +22,5 @@ eclipse
run run
# Files from Forge MDK # Files from Forge MDK
forge_README.txt
forge*changelog.txt forge*changelog.txt
+7 -64
View File
@@ -1,66 +1,9 @@
# Sets default memory used for Gradle commands. Can be overridden by user or command line properties. org.gradle.caching=true
# This is required to provide enough memory for the Minecraft decompilation process. org.gradle.parallel=true
org.gradle.jvmargs=-Xmx5G org.gradle.configureondemand=true
org.gradle.daemon=false
# In the case that Gradle needs to fork to recompile, this will set the memory for that process. org.gradle.configuration-cache=true
systemProp.net.minecraftforge.gradle.repo.recompile.fork=true org.gradle.configuration-cache.parallel=true
systemProp.net.minecraftforge.gradle.repo.recompile.fork.args=-Xmx5G org.gradle.configuration-cache.problems=warn
# Opts-out of ForgeGradle automatically adding mavenCentral(), Forge's maven and MC libs maven to the repositories block net.minecraftforge.gradle.merge-source-sets=true
systemProp.net.minecraftforge.gradle.repo.attach=false
## Environment Properties
# The Minecraft version must agree with the Forge version to get a valid artifact
minecraft_version=@MC_VERSION@
# 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=[@MC_VERSION@,@MC_NEXT_VERSION@)
# The Forge version must agree with the Minecraft version to get a valid artifact
forge_version=@FORGE_VERSION@
# The Forge version range can use any version of Forge as bounds or match the loader version range
forge_version_range=[@FORGE_SPEC_VERSION@,)
# The loader version range can only use the major version of Forge/FML as bounds
loader_version_range=[@FORGE_SPEC_VERSION@,)
# The mapping channel to use for mappings.
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
#
# | Channel | Version | |
# |-----------|----------------------|--------------------------------------------------------------------------------|
# | official | MCVersion | Official field/method names from Mojang mapping files |
# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official |
#
# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
#
# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge.
# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started
mapping_channel=@MAPPING_CHANNEL@
# The mapping version to query from the mapping channel.
# This must match the format required by the mapping channel.
mapping_version=@MAPPING_VERSION@
## Mod Properties
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
# Must match the String constant located in the main mod class annotated with @Mod.
mod_id=examplemod
# The human-readable display name for the mod.
mod_name=Example Mod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
mod_version=1.0.0
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
mod_group_id=com.example.examplemod
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=YourNameHere, OtherNameHere
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.
+3 -11
View File
@@ -1,13 +1,5 @@
pluginManagement { plugins {
repositories { id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
gradlePluginPortal()
maven {
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
}
}
} }
plugins { rootProject.name = 'examplemod'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.10.0'
}
+27 -70
View File
@@ -1,80 +1,37 @@
# This is an example mods.toml file. It contains the data relating to the loading mods. # See https://docs.minecraftforge.net/en/1.21.x/gettingstarted/modfiles/#modstoml
# There are several mandatory fields (#mandatory), and many more that are optional (#optional). # There are lots of things you can do with the mods.toml, and not all fields are included with this MDK
# The overall format is standard TOML format, v0.5.0. # References: https://github.com/MinecraftForge/MDKExamples
# Note that there are a couple of TOML lists in this file.
# Find more information on toml format here: https://github.com/toml-lang/toml modLoader="javafml"
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml loaderVersion="[@FORGE_SPEC_VERSION@,)"
modLoader="javafml" #mandatory license="All Rights Reserved"
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version #issueTrackerURL="https://github.com/MyOrganization/MyMod/" #optional
loaderVersion="${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. #clientSideOnly=true #optional, default=false
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. [[mods]]
license="${mod_license}" modId="examplemod"
# A URL to refer people to when problems occur with this mod version="1.0.0"
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional displayName="Example Mod"
# If your mod is purely client-side and has no multiplayer functionality (be it dedicated servers or Open to LAN), #updateJSONURL="https://example.com/updates.json" #optional
# set this to true, and Forge will set the correct displayTest for you and skip loading your mod on dedicated servers. #displayURL="https://example.com/" #optional
#clientSideOnly=true #optional - defaults to false if absent
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId="${mod_id}" #mandatory
# The version number of the mod
version="${mod_version}" #mandatory
# A display name for the mod
displayName="${mod_name}" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
# A file name (in the root of the mod JAR) containing a logo for display
#logoFile="examplemod.png" #optional #logoFile="examplemod.png" #optional
# A text field displayed in the mod UI
#credits="" #optional #credits="" #optional
# A text field displayed in the mod UI authors="YourNameHere, OtherNameHere" #optional
authors="${mod_authors}" #optional #displayTest="MATCH_VERSION" #optional, default=MATCH_VERSION when not clientSideOnly, else IGNORE_ALL_VERSION
# Display Test controls the display for your mod in the server connection screen
# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod.
# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod.
# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component.
# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value.
# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself.
#displayTest="MATCH_VERSION" # if nothing is specified, MATCH_VERSION is the default when clientSideOnly=false, otherwise IGNORE_ALL_VERSION when clientSideOnly=true (#optional)
# The description text for the mod (multi line!) (#mandatory) description='''Example mod description.
description='''${mod_description}''' Newline characters can be used like this, and rendered on the mods screen properly.'''
# Access Transformers [[dependencies.examplemod]] #recommended
# Optional, if not specified Forge will attempt to find the default META-INF/accesstransformer.cfg and silently continue if not found. May default to an empty list in a future MC. modId="forge"
# If you specify AT path strings in this list, Forge will attempt to load each of them and throw errors for any that aren't found. mandatory=true
# Specifying an empty list when your mod has no ATs is recommended to opt-out of the default for slightly better loading performance. versionRange="[@FORGE_SPEC_VERSION@,)"
#accessTransformers = []
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.${mod_id}]] #optional
# the modid of the dependency
modId="forge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="${forge_version_range}" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory
# BEFORE - This mod is loaded BEFORE the dependency
# AFTER - This mod is loaded AFTER the dependency
ordering="NONE" ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
side="BOTH" side="BOTH"
# Here's another dependency
[[dependencies.${mod_id}]] [[dependencies.examplemod]] #recommended
modId="minecraft" modId="minecraft"
mandatory=true mandatory=true
# This version range declares a minimum of the current minecraft version up to but not including the next major version versionRange="[@MC_VERSION@,@MC_NEXT_VERSION@,)"
versionRange="${minecraft_version_range}"
ordering="NONE" ordering="NONE"
side="BOTH" side="BOTH"
# Features are specific properties of the game environment, that you may want to declare you require. This example declares
# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't
# stop your mod loading on the server for example.
#[features.${mod_id}]
#openGLVersion="[3.2,)"
+3 -2
View File
@@ -31,8 +31,9 @@ dependencyResolutionManagement {
library('unsafe', 'net.minecraftforge:unsafe:0.9.2') library('unsafe', 'net.minecraftforge:unsafe:0.9.2')
library('accesstransformers', 'net.minecraftforge:accesstransformers:8.2.2') library('accesstransformers', 'net.minecraftforge:accesstransformers:8.2.2')
library('coremods-api', 'net.minecraftforge:coremods-api:5.3.0') library('coremods-api', 'net.minecraftforge:coremods-api:5.3.0')
library('eventbus', 'net.minecraftforge:eventbus:7.0-beta.12') version('eventbus', '7.0-beta.12')
library('eventbus-validator', 'net.minecraftforge:eventbus-validator:7.0-beta.12') library('eventbus', 'net.minecraftforge', 'eventbus').versionRef('eventbus')
library('eventbus-validator', 'net.minecraftforge', 'eventbus-validator').versionRef('eventbus')
library('mergetool-api', 'net.minecraftforge:mergetool-api:1.0') library('mergetool-api', 'net.minecraftforge:mergetool-api:1.0')
library('roimfs', 'net.minecraftforge:roimfs:1.0.0') // ReadOnlyInMemoryFileSystem - Used for JarInJar extraction at runtime library('roimfs', 'net.minecraftforge:roimfs:1.0.0') // ReadOnlyInMemoryFileSystem - Used for JarInJar extraction at runtime