[FEAT] Fabric/NeoForge Template

This commit is contained in:
2023-11-08 22:28:44 +02:00
parent 4f23720734
commit b3114640a2
12 changed files with 36 additions and 30 deletions

1
.gitignore vendored
View File

@@ -44,3 +44,4 @@ bin/
.idea
run/
artifacts

View File

@@ -1,5 +1,5 @@
// Adjust the output jar name here
archivesBaseName = "${mod_name}-Forge-${minecraft_version}"
archivesBaseName = "${mod_name}-NeoForge-${minecraft_version}"
dependencies {
// Add your dependencies here
@@ -31,9 +31,12 @@ publishing {
*/
unimined.minecraft {
minecraftForge {
loader forge_version
mixinConfig("${mod_id}.mixins.json", "${mod_id}-forge.mixins.json")
neoForged {
loader neoforge_version
mixinConfig("${mod_id}.mixins.json", "${mod_id}-neoforge.mixins.json")
// TODO Remove when NeoGradle is fixed
forgeTransformer.binpatchFile = rootProject.projectDir.toPath().resolve("output.lzma")
}
}

View File

@@ -1,16 +1,17 @@
package com.author.examplemod;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.fml.common.Mod;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.entity.player.ItemTooltipEvent;
@Mod(ModConstants.MOD_ID)
public class ExampleModForge {
public ExampleModForge() {
public ExampleModForge(IEventBus modEventBus) {
ModConstants.LOGGER.info("Hello Forge!");
ExampleModCommon.initialize();
MinecraftForge.EVENT_BUS.addListener(this::onItemTooltip);
NeoForge.EVENT_BUS.addListener(this::onItemTooltip);
}
private void onItemTooltip(ItemTooltipEvent event) {

View File

@@ -1,8 +1,8 @@
package com.author.examplemod.services;
import com.author.examplemod.platform.IPlatformHelper;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.loading.FMLLoader;
import net.neoforged.fml.ModList;
import net.neoforged.fml.loading.FMLLoader;
public class ForgePlatformHelper implements IPlatformHelper {

View File

@@ -1,17 +1,17 @@
modLoader="javafml"
loaderVersion="[48,)"
loaderVersion="[1,)"
license="MIT"
issueTrackerURL="https://github.com/minecraftforge/"
[[mods]]
modId="examplemod"
modId="${mod_id}"
version="${version}"
displayName="Example Mod"
displayName="${mod_name}"
#updateJSONURL="https://change.me.example.invalid/updates.json"
displayURL="https://minecraftforge.net"
logoFile="assets/examplemod/icon.png"
credits="Thanks for this example mod goes to Java"
authors="ExampleAuthor"
authors="${mod_author}"
description='''
This is a long form description of the mod. You can write whatever you want here
@@ -20,16 +20,16 @@ Have some lorem ipsum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed sagittis luctus odio eu tempus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque volutpat ligula eget lacus auctor sagittis. In hac habitasse platea dictumst. Nunc gravida elit vitae sem vehicula efficitur. Donec mattis ipsum et arcu lobortis, eleifend sagittis sem rutrum. Cras pharetra quam eget posuere fermentum. Sed id tincidunt justo. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
'''
[[dependencies.examplemod]]
modId="forge"
[[dependencies.${mod_id}]]
modId="neoforge"
mandatory=true
versionRange="[48,)"
versionRange="[20.2,)"
ordering="NONE"
side="BOTH"
[[dependencies.examplemod]]
[[dependencies.${mod_id}]]
modId="minecraft"
mandatory=true
versionRange="[1.20.2,)"
versionRange="[1.20.2,1.21)"
ordering="NONE"
side="BOTH"

View File

@@ -16,8 +16,9 @@ minecraft_version=1.20.2
fabric_loader=0.14.24
fabric_api=0.90.7+1.20.2
# Forge
forge_version=48.0.34
# NeoForged
# Currently 16-beta is the highest version that works, until an issue with NeoGradle is fixed
neoforge_version=16-beta
# Gradle Options
org.gradle.jvmargs=-Xmx3G

BIN
output.lzma Normal file

Binary file not shown.

View File

@@ -20,7 +20,7 @@ This project is powered by [Unimined](https://github.com/unimined/unimined), and
4) `minecraft_version` -> The minecraft version your project targets
5) `fabric_loader` -> The fabric loader version to use. Find this [here](https://fabricmc.net/develop/)
6) `fabric_api` -> The Fabric API for your minecraft version. Find this [here](https://fabricmc.net/develop/)
7) `forge_version` -> The Forge version for your Minecraft version to use
7) `neoforge_version` -> The NeoForge version for your Minecraft version to use. For example: `39-beta`
4) Open up `fabric.mod.json` from the Fabric module, and replace the following values:
1) `description` -> Describe what your mod does
@@ -31,8 +31,8 @@ This project is powered by [Unimined](https://github.com/unimined/unimined), and
6) `minecraft` -> The minecraft version(s) your mod supports
7) If you do not plan on using mixins, remove the `mixins` section
5) Open up `mods.toml` from the Forge module and replace the following values:
1) `loaderVersion` -> The forge version code
5) Open up `mods.toml` from the NeoForge module and replace the following values:
1) `loaderVersion` -> The neoforge version code
2) `license` -> Your mod license
3) `issueTrackerURL` -> Your GitHub repository of the mod
4) `modId` -> Your modid. Make sure to match this with `mod_id` from `gradle.properties`
@@ -42,7 +42,7 @@ This project is powered by [Unimined](https://github.com/unimined/unimined), and
8) `authors` -> Your name
9) `description` -> Your mod description
10) `dependencies.examplemod` -> `dependencies.yourmodid`
11) `versionRange` -> `[forgeVersionCode,)` and `[1.20.2,)` (Replace with the minecraft versions your mod supports)
11) `versionRange` -> `[neoforgeVersionCode,)` and `[1.20.2,)` (Replace with the minecraft versions your mod supports)
6) 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 JVMand 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.
7) Replace the contents of `LICENSE` with your mod license
@@ -52,9 +52,9 @@ This project is powered by [Unimined](https://github.com/unimined/unimined), and
### 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.
***

View File

@@ -15,5 +15,5 @@ pluginManagement {
rootProject.name = 'fdd-xplat'
include 'Common'
include 'Fabric'
include 'Forge'
include 'NeoForge'