Port to 1.20.5 and temporarily(?) delete forge
Forge will be re-added when it is ported
This commit is contained in:
parent
ac3fddf1cc
commit
5536dbd85d
15
README.md
15
README.md
|
|
@ -1,28 +1,27 @@
|
||||||
# MultiLoader Template
|
# MultiLoader Template
|
||||||
|
|
||||||
This project provides a Gradle project template that can compile mods for both Forge and Fabric using a common sourceset. This project does not require any third party libraries or dependencies. If you have any questions or want to discuss the project join our [Discord](https://discord.myceliummod.network).
|
This project provides a Gradle project template that can compile mods for multiple modloaders using a common sourceset. This project does not require any third party libraries or dependencies. If you have any questions or want to discuss the project join our [Discord](https://discord.myceliummod.network).
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
### IntelliJ IDEA
|
### IntelliJ IDEA
|
||||||
This guide will show how to import the MultiLoader Template into IntelliJ IDEA. The setup process is roughly equivalent to setting up Forge and Fabric independently and should be very familiar to anyone who has worked with their MDKs.
|
This guide will show how to import the MultiLoader Template into IntelliJ IDEA. The setup process is roughly equivalent to setting up the modloaders independently and should be very familiar to anyone who has worked with their MDKs.
|
||||||
|
|
||||||
1. Clone or download this repository to your computer.
|
1. Clone or download this repository to your computer.
|
||||||
2. Configure the project by editing the `group`, `mod_name`, `mod_author`, and `mod_id` properties in the `gradle.properties` file. You will also need to change the `rootProject.name` property in `settings.gradle`, this should match the folder name of your project, or else IDEA may complain.
|
2. Configure the project by editing the `group`, `mod_name`, `mod_author`, and `mod_id` properties in the `gradle.properties` file. You will also need to change the `rootProject.name` property in `settings.gradle`, this should match the folder name of your project, or else IDEA may complain.
|
||||||
3. Open the template's root folder as a new project in IDEA. This is the folder that contains this README file and the gradlew executable.
|
3. Open the template's root folder as a new project in IDEA. This is the folder that contains this README file and the gradlew executable.
|
||||||
4. If your default JVM/JDK is not Java 17 you will encounter an error when opening the project. This error is fixed by going to `File > Settings > Build, Execution, Deployment > Build Tools > Gradle > Gradle JVM`and changing the value to a valid Java 17 JVM. You will also need to set the Project SDK to Java 17. This can be done by going to `File > Project Structure > Project SDK`. Once both have been set open the Gradle tab in IDEA and click the refresh button to reload the project.
|
4. If your default JVM/JDK is not Java 21 you will encounter an error when opening the project. This error is fixed by going to `File > Settings > Build, Execution, Deployment > Build Tools > Gradle > Gradle JVM` and changing the value to a valid Java 21 JVM. You will also need to set the Project SDK to Java 21. This can be done by going to `File > Project Structure > Project SDK`. Once both have been set open the Gradle tab in IDEA and click the refresh button to reload the project.
|
||||||
5. Open the Gradle tab in IDEA if it has not already been opened. Navigate to `Your Project > Common > Tasks > vanilla gradle > decompile`. Run this task to decompile Minecraft.
|
5. Open the Gradle tab in IDEA if it has not already been opened. Navigate to `Your Project > Common > Tasks > vanilla gradle > decompile`. Run this task to decompile Minecraft.
|
||||||
6. Open the Gradle tab in IDEA if it has not already been opened. Navigate to `Your Project > Forge > Tasks > forgegradle runs > genIntellijRuns`. Run this task to set up run configurations for Forge.
|
6. Open your Run/Debug Configurations. Under the Application category there should now be options to run NeoForge and Fabric projects. Select one of the client options and try to run it.
|
||||||
7. Open your Run/Debug Configurations. Under the Application category there should now be options to run Forge and Fabric projects. Select one of the client options and try to run it.
|
7. Assuming you were able to run the game in step 7 your workspace should now be set up.
|
||||||
8. Assuming you were able to run the game in step 7 your workspace should now be set up.
|
|
||||||
|
|
||||||
### Eclipse
|
### Eclipse
|
||||||
While it is possible to use this template in Eclipse it is not recommended. During the development of this template multiple critical bugs and quirks related to Eclipse were found at nearly every level of the required build tools. While we continue to work with these tools to report and resolve issues support for projects like these are not there yet. For now Eclipse is considered unsupported by this project. The development cycle for build tools is notoriously slow so there are no ETAs available.
|
While it is possible to use this template in Eclipse it is not recommended. During the development of this template multiple critical bugs and quirks related to Eclipse were found at nearly every level of the required build tools. While we continue to work with these tools to report and resolve issues support for projects like these are not there yet. For now Eclipse is considered unsupported by this project. The development cycle for build tools is notoriously slow so there are no ETAs available.
|
||||||
|
|
||||||
## Development Guide
|
## Development Guide
|
||||||
When using this template the majority of your mod is developed in the Common project. The Common project is compiled against the vanilla game and is used to hold code that is shared between the different loader-specific versions of your mod. The Common project has no knowledge or access to ModLoader specific code, apis, or concepts. Code that requires something from a specific loader must be done through the project that is specific to that loader, such as the Forge or Fabric project.
|
When using this template the majority of your mod is developed in the Common project. The Common project is compiled against the vanilla game and is used to hold code that is shared between the different loader-specific versions of your mod. The Common project has no knowledge or access to ModLoader specific code, apis, or concepts. Code that requires something from a specific loader must be done through the project that is specific to that loader, such as the NeoForge or Fabric project.
|
||||||
|
|
||||||
Loader specific projects such as the Forge and Fabric project are used to load the Common project into the game. These projects also define code that is specific to that loader. Loader specific projects can access all of the code in the Common project. It is important to remember that the Common project can not access code from loader specific projects.
|
Loader specific projects such as the NeoForge and Fabric project are used to load the Common project into the game. These projects also define code that is specific to that loader. Loader specific projects can access all of the code in the Common project. It is important to remember that the Common project can not access code from loader specific projects.
|
||||||
|
|
||||||
## Removing Platforms and Loaders
|
## Removing Platforms and Loaders
|
||||||
While the MultiLoader Template includes support for many platforms and loaders you can easily remove support for the ones you don't need. This can be done by deleting the subproject folder and then removing it from the `settings.gradle` file. For example if you wanted to remove support for Forge you would follow the following steps.
|
While the MultiLoader Template includes support for many platforms and loaders you can easily remove support for the ones you don't need. This can be done by deleting the subproject folder and then removing it from the `settings.gradle` file. For example if you wanted to remove support for Forge you would follow the following steps.
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,6 @@ processResources {
|
||||||
"version": version,
|
"version": version,
|
||||||
"group": project.group, //Else we target the task's group.
|
"group": project.group, //Else we target the task's group.
|
||||||
"minecraft_version": minecraft_version,
|
"minecraft_version": minecraft_version,
|
||||||
"forge_version": forge_version,
|
|
||||||
"forge_loader_version_range": forge_loader_version_range,
|
|
||||||
"forge_version_range": forge_version_range,
|
|
||||||
"minecraft_version_range": minecraft_version_range,
|
"minecraft_version_range": minecraft_version_range,
|
||||||
"fabric_version": fabric_version,
|
"fabric_version": fabric_version,
|
||||||
"fabric_loader_version": fabric_loader_version,
|
"fabric_loader_version": fabric_loader_version,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "com.example.examplemod.mixin",
|
"package": "com.example.examplemod.mixin",
|
||||||
"refmap": "${mod_id}.refmap.json",
|
"refmap": "${mod_id}.refmap.json",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"mixins": [],
|
"mixins": [],
|
||||||
"client": [
|
"client": [
|
||||||
"MixinMinecraft"
|
"MixinMinecraft"
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "com.example.examplemod.mixin",
|
"package": "com.example.examplemod.mixin",
|
||||||
"refmap": "${mod_id}.refmap.json",
|
"refmap": "${mod_id}.refmap.json",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"mixins": [],
|
"mixins": [],
|
||||||
"client": [
|
"client": [
|
||||||
"MixinTitleScreen"
|
"MixinTitleScreen"
|
||||||
|
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
||||||
plugins {
|
|
||||||
id 'multiloader-loader'
|
|
||||||
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
|
||||||
id 'org.spongepowered.mixin' version '0.7-SNAPSHOT'
|
|
||||||
}
|
|
||||||
base {
|
|
||||||
archivesName = "${mod_name}-forge-${minecraft_version}"
|
|
||||||
}
|
|
||||||
mixin {
|
|
||||||
add(sourceSets.main, "${mod_id}.refmap.json")
|
|
||||||
|
|
||||||
config("${mod_id}.mixins.json")
|
|
||||||
config("${mod_id}.forge.mixins.json")
|
|
||||||
}
|
|
||||||
|
|
||||||
minecraft {
|
|
||||||
mappings channel: 'official', version: minecraft_version
|
|
||||||
|
|
||||||
copyIdeResources = true //Calls processResources when in dev
|
|
||||||
|
|
||||||
// Automatically enable forge AccessTransformers if the file exists
|
|
||||||
// This location is hardcoded in Forge and can not be changed.
|
|
||||||
// https://github.com/MinecraftForge/MinecraftForge/blob/be1698bb1554f9c8fa2f58e32b9ab70bc4385e60/fmlloader/src/main/java/net/minecraftforge/fml/loading/moddiscovery/ModFile.java#L123
|
|
||||||
def at = file('src/main/resources/META-INF/accesstransformer.cfg')
|
|
||||||
if (at.exists()) {
|
|
||||||
accessTransformer = at
|
|
||||||
}
|
|
||||||
|
|
||||||
runs {
|
|
||||||
client {
|
|
||||||
workingDirectory file('runs/client')
|
|
||||||
ideaModule "${rootProject.name}.${project.name}.main"
|
|
||||||
taskName 'Client'
|
|
||||||
mods {
|
|
||||||
modClientRun {
|
|
||||||
source sourceSets.main
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
workingDirectory file('runs/server')
|
|
||||||
ideaModule "${rootProject.name}.${project.name}.main"
|
|
||||||
taskName 'Server'
|
|
||||||
mods {
|
|
||||||
modServerRun {
|
|
||||||
source sourceSets.main
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data {
|
|
||||||
workingDirectory file('runs/data')
|
|
||||||
ideaModule "${rootProject.name}.${project.name}.main"
|
|
||||||
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
|
|
||||||
taskName 'Data'
|
|
||||||
mods {
|
|
||||||
modDataRun {
|
|
||||||
source sourceSets.main
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets.main.resources.srcDir 'src/generated/resources'
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
|
||||||
annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT:processor")
|
|
||||||
}
|
|
||||||
|
|
||||||
jar.finalizedBy('reobfJar')
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
mavenJava(MavenPublication) {
|
|
||||||
fg.component(it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets.each {
|
|
||||||
def dir = layout.buildDirectory.dir("sourcesSets/$it.name")
|
|
||||||
it.output.resourcesDir = dir
|
|
||||||
it.java.destinationDirectory = dir
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
package com.example.examplemod;
|
|
||||||
|
|
||||||
import net.minecraftforge.fml.common.Mod;
|
|
||||||
|
|
||||||
@Mod(Constants.MOD_ID)
|
|
||||||
public class ExampleMod {
|
|
||||||
|
|
||||||
public ExampleMod() {
|
|
||||||
|
|
||||||
// This method is invoked by the Forge mod loader when it is ready
|
|
||||||
// to load your mod. You can access Forge and Common code in this
|
|
||||||
// project.
|
|
||||||
|
|
||||||
// Use Forge to bootstrap the Common mod.
|
|
||||||
Constants.LOG.info("Hello Forge world!");
|
|
||||||
CommonClass.init();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
package com.example.examplemod.mixin;
|
|
||||||
|
|
||||||
import com.example.examplemod.Constants;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.screens.TitleScreen;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
@Mixin(TitleScreen.class)
|
|
||||||
public class MixinTitleScreen {
|
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "init()V")
|
|
||||||
private void init(CallbackInfo info) {
|
|
||||||
|
|
||||||
Constants.LOG.info("This line is printed by an example mod mixin from Forge!");
|
|
||||||
Constants.LOG.info("MC Version: {}", Minecraft.getInstance().getVersionType());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
package com.example.examplemod.platform;
|
|
||||||
|
|
||||||
import com.example.examplemod.platform.services.IPlatformHelper;
|
|
||||||
import net.minecraftforge.fml.ModList;
|
|
||||||
import net.minecraftforge.fml.loading.FMLLoader;
|
|
||||||
|
|
||||||
public class ForgePlatformHelper implements IPlatformHelper {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPlatformName() {
|
|
||||||
|
|
||||||
return "Forge";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isModLoaded(String modId) {
|
|
||||||
|
|
||||||
return ModList.get().isLoaded(modId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDevelopmentEnvironment() {
|
|
||||||
|
|
||||||
return !FMLLoader.isProduction();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
modLoader = "javafml" #mandatory
|
|
||||||
loaderVersion = "${forge_loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See https://files.minecraftforge.net/ for a list of versions.
|
|
||||||
license = "${license}" # Review your options at https://choosealicense.com/.
|
|
||||||
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
|
|
||||||
[[mods]] #mandatory
|
|
||||||
modId = "${mod_id}" #mandatory
|
|
||||||
version = "${version}" #mandatory
|
|
||||||
displayName = "${mod_name}" #mandatory
|
|
||||||
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional (see https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/)
|
|
||||||
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional (displayed in the mod UI)
|
|
||||||
logoFile = "${mod_id}.png" #optional
|
|
||||||
credits = "${credits}" #optional
|
|
||||||
authors = "${mod_author}" #optional
|
|
||||||
description = '''${description}''' #mandatory (Supports multiline text)
|
|
||||||
[[dependencies.${mod_id}]] #optional
|
|
||||||
modId = "forge" #mandatory
|
|
||||||
mandatory = true #mandatory
|
|
||||||
versionRange = "${forge_version_range}" #mandatory
|
|
||||||
ordering = "NONE" # The order that this dependency should load in relation to your mod, required to be either 'BEFORE' or 'AFTER' if the dependency is not mandatory
|
|
||||||
side = "BOTH" # Side this dependency is applied on - 'BOTH', 'CLIENT' or 'SERVER'
|
|
||||||
[[dependencies.${mod_id}]]
|
|
||||||
modId = "minecraft"
|
|
||||||
mandatory = true
|
|
||||||
versionRange = "${minecraft_version_range}"
|
|
||||||
ordering = "NONE"
|
|
||||||
side = "BOTH"
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
com.example.examplemod.platform.ForgePlatformHelper
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
"required": true,
|
|
||||||
"minVersion": "0.8",
|
|
||||||
"package": "com.example.examplemod.mixin",
|
|
||||||
"refmap": "${mod_id}.refmap.json",
|
|
||||||
"compatibilityLevel": "JAVA_17",
|
|
||||||
"mixins": [],
|
|
||||||
"client": [
|
|
||||||
"MixinTitleScreen"
|
|
||||||
],
|
|
||||||
"server": [],
|
|
||||||
"injectors": {
|
|
||||||
"defaultRequire": 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -4,29 +4,24 @@
|
||||||
# Project
|
# Project
|
||||||
version=1.0.0
|
version=1.0.0
|
||||||
group=com.example.examplemod
|
group=com.example.examplemod
|
||||||
java_version=17
|
java_version=21
|
||||||
|
|
||||||
# Common
|
# Common
|
||||||
minecraft_version=1.20.4
|
minecraft_version=1.20.5
|
||||||
mod_name=ExampleMod
|
mod_name=ExampleMod
|
||||||
mod_author=Jared
|
mod_author=Jared
|
||||||
mod_id=examplemod
|
mod_id=examplemod
|
||||||
license=C0-1.0
|
license=C0-1.0
|
||||||
credits=
|
credits=
|
||||||
description=The description of your mod. \nAccepts multilines.
|
description=The description of your mod. \nAccepts multilines.
|
||||||
minecraft_version_range=[1.20.4, 1.21)
|
minecraft_version_range=[1.20.5, 1.21)
|
||||||
|
|
||||||
# Fabric
|
# Fabric
|
||||||
fabric_version=0.92.1+1.20.4
|
fabric_version=0.97.6+1.20.5
|
||||||
fabric_loader_version=0.15.3
|
fabric_loader_version=0.15.10
|
||||||
|
|
||||||
# Forge
|
|
||||||
forge_version=49.0.19
|
|
||||||
forge_loader_version_range=[49,)
|
|
||||||
forge_version_range=[49,)
|
|
||||||
|
|
||||||
# NeoForge
|
# NeoForge
|
||||||
neoforge_version=20.4.83-beta
|
neoforge_version=20.5.0-beta
|
||||||
neoforge_loader_version_range=[2,)
|
neoforge_loader_version_range=[2,)
|
||||||
|
|
||||||
# Gradle
|
# Gradle
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"required": true,
|
"required": true,
|
||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "com.example.examplemod.mixin",
|
"package": "com.example.examplemod.mixin",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"mixins": [],
|
"mixins": [],
|
||||||
"client": [
|
"client": [
|
||||||
"MixinTitleScreen"
|
"MixinTitleScreen"
|
||||||
|
|
|
||||||
|
|
@ -26,17 +26,6 @@ pluginManagement {
|
||||||
includeGroup("codechicken")
|
includeGroup("codechicken")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exclusiveContent {
|
|
||||||
forRepository {
|
|
||||||
maven {
|
|
||||||
name = 'Forge'
|
|
||||||
url = uri("https://maven.minecraftforge.net")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
filter {
|
|
||||||
includeGroupAndSubgroups("net.minecraftforge")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exclusiveContent {
|
exclusiveContent {
|
||||||
forRepository {
|
forRepository {
|
||||||
maven {
|
maven {
|
||||||
|
|
@ -46,6 +35,7 @@ pluginManagement {
|
||||||
}
|
}
|
||||||
filter {
|
filter {
|
||||||
includeGroupAndSubgroups("org.spongepowered")
|
includeGroupAndSubgroups("org.spongepowered")
|
||||||
|
includeGroup("net.minecraftforge")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -59,5 +49,4 @@ plugins {
|
||||||
rootProject.name = 'MultiLoader-Template'
|
rootProject.name = 'MultiLoader-Template'
|
||||||
include("common")
|
include("common")
|
||||||
include("fabric")
|
include("fabric")
|
||||||
include("forge")
|
|
||||||
include("neoforge")
|
include("neoforge")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user