Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
03166c25dd | |||
40ba1ba66a | |||
99463299ff | |||
a9b358bf59 | |||
b3114640a2 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -44,3 +44,4 @@ bin/
|
||||
.idea
|
||||
|
||||
run/
|
||||
artifacts
|
@@ -3,7 +3,7 @@ package com.author.examplemod;
|
||||
import com.author.examplemod.platform.IPlatformHelper;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.food.FoodProperties;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
@@ -20,14 +20,9 @@ public class ExampleModCommon {
|
||||
// This method serves as a hook to modify item tooltips. The vanilla game
|
||||
// has no mechanism to load tooltip listeners so this must be registered
|
||||
// by a mod loader like Forge or Fabric.
|
||||
public static void onItemTooltip(ItemStack stack, TooltipFlag context, List<Component> tooltip) {
|
||||
public static void onItemTooltip(ItemStack stack, Item.TooltipContext context, TooltipFlag flag, List<Component> tooltip) {
|
||||
if (!stack.isEmpty()) {
|
||||
final FoodProperties food = stack.getItem().getFoodProperties();
|
||||
|
||||
if (food != null) {
|
||||
tooltip.add(Component.literal("Nutrition: " + food.getNutrition()));
|
||||
tooltip.add(Component.literal("Saturation: " + food.getSaturationModifier()));
|
||||
}
|
||||
tooltip.add(Component.literal("Hey you!"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,7 @@
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14",
|
||||
"fabric": "*",
|
||||
"minecraft": "1.20.x",
|
||||
"java": ">=17"
|
||||
"minecraft": ">=1.21",
|
||||
"java": ">=21"
|
||||
}
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package com.author.examplemod;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod(ModConstants.MOD_ID)
|
||||
public class ExampleModForge {
|
||||
|
||||
public ExampleModForge() {
|
||||
ModConstants.LOGGER.info("Hello Forge!");
|
||||
ExampleModCommon.initialize();
|
||||
MinecraftForge.EVENT_BUS.addListener(this::onItemTooltip);
|
||||
}
|
||||
|
||||
private void onItemTooltip(ItemTooltipEvent event) {
|
||||
ExampleModCommon.onItemTooltip(event.getItemStack(), event.getFlags(), event.getToolTip());
|
||||
}
|
||||
}
|
@@ -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,9 @@ 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")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ processResources {
|
||||
from project(":Common").sourceSets.main.resources
|
||||
def buildProps = project.properties.clone()
|
||||
|
||||
filesMatching("META-INF/mods.toml") {
|
||||
filesMatching("META-INF/neoforge.mods.toml") {
|
||||
expand buildProps
|
||||
}
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package com.author.examplemod;
|
||||
|
||||
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(IEventBus modEventBus) {
|
||||
ModConstants.LOGGER.info("Hello Forge!");
|
||||
ExampleModCommon.initialize();
|
||||
NeoForge.EVENT_BUS.addListener(this::onItemTooltip);
|
||||
}
|
||||
|
||||
private void onItemTooltip(ItemTooltipEvent event) {
|
||||
ExampleModCommon.onItemTooltip(event.getItemStack(), event.getContext(), event.getFlags(), event.getToolTip());
|
||||
}
|
||||
}
|
@@ -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 {
|
||||
|
@@ -1,17 +1,17 @@
|
||||
modLoader="javafml"
|
||||
loaderVersion="[48,)"
|
||||
loaderVersion="[1,)"
|
||||
license="MIT"
|
||||
issueTrackerURL="https://github.com/minecraftforge/"
|
||||
issueTrackerURL="https://github.com/neoforged/"
|
||||
|
||||
[[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"
|
||||
displayURL="https://neoforged.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"
|
||||
mandatory=true
|
||||
versionRange="[48,)"
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="neoforge"
|
||||
type="required"
|
||||
versionRange="[21.0.0-beta,)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
[[dependencies.examplemod]]
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.20.2,)"
|
||||
type="required"
|
||||
versionRange="[1.21,1.21.1)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
10
build.gradle
10
build.gradle
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id "xyz.wagyourtail.unimined" version "1.1.0-SNAPSHOT" apply false
|
||||
id "xyz.wagyourtail.unimined" version "1.2.9" apply false
|
||||
}
|
||||
|
||||
// Edit in gradle.properties
|
||||
@@ -15,8 +15,8 @@ subprojects {
|
||||
group = rootProject.group
|
||||
version = rootProject.version
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
|
||||
// Add your maven repositories here
|
||||
repositories {
|
||||
@@ -73,10 +73,10 @@ subprojects {
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
it.options.encoding = 'UTF-8'
|
||||
it.options.release = 17
|
||||
it.options.release = 21
|
||||
}
|
||||
|
||||
tasks.withType(GenerateModuleMetadata) {
|
||||
tasks.withType(GenerateModuleMetadata).configureEach {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
|
@@ -10,14 +10,14 @@ mod_id=examplemod
|
||||
mod_name=ExampleMod
|
||||
|
||||
# Shared
|
||||
minecraft_version=1.20.2
|
||||
minecraft_version=1.21
|
||||
|
||||
# Fabric
|
||||
fabric_loader=0.14.24
|
||||
fabric_api=0.90.7+1.20.2
|
||||
fabric_loader=0.15.11
|
||||
fabric_api=0.102.0+1.21
|
||||
|
||||
# Forge
|
||||
forge_version=48.0.34
|
||||
# NeoForge
|
||||
neoforge_version=167
|
||||
|
||||
# Gradle Options
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Sun Nov 05 19:31:04 SAST 2023
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
18
readme.md
18
readme.md
@@ -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,20 +31,16 @@ 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`
|
||||
5) `displayName` -> The name of your mod
|
||||
6) `displayURL` -> Your Modrinth/Curseforge/GitHub page of the mod
|
||||
7) `logoFile` -> Your mod icon
|
||||
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.
|
||||
6) 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.
|
||||
7) Replace the contents of `LICENSE` with your mod license
|
||||
8) Replace the contents of `readme.md` with your mod readme
|
||||
|
||||
@@ -52,9 +48,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.
|
||||
|
||||
***
|
||||
|
||||
|
@@ -13,7 +13,4 @@ pluginManagement {
|
||||
}
|
||||
|
||||
rootProject.name = 'fdd-xplat'
|
||||
include 'Common'
|
||||
include 'Fabric'
|
||||
include 'Forge'
|
||||
|
||||
include('Common', 'Fabric', 'NeoForge')
|
||||
|
Reference in New Issue
Block a user