Looking for the download? Go to CurseForge or Modrinth.
Add Modrinth to your repositories block in build.gradle, and add the mod to your dependencies block.
build.gradle
repositories {
[...]
maven { url "https://api.modrinth.com/maven" }
}build.gradle
dependencies {
// Replace the version number with the correct one for your version.
// See all versions at https://modrinth.com/mod/mealapi/versions
modApi "maven.modrinth:mealapi:0.3+1.17"
}Meal API isn't confined to one Minecraft version in its fabric.mod.json, however there is no guarantee a release will work on versions past what it's marked for.
Add the mod id mealapi to your dependencies in your fabric.mod.json.
Replace 0.3 with the relevant version, if applicable.
"depends": {
[...]
"mealapi": ">=0.3"
},If desired, add the dependency to your build.gradle in the dependencies block with include in order to package Meal API within your mod.
Make sure you are importing API classes from the newest API version. Classes from old API versions will be marked as deprecated. Each API version has its own package in io.github.foundationgames.mealapi.api. Directly touching the impl classes is discouraged. Deprecated API versions will be removed after being deprecated for about 2 major (x.x) mod versions.
Decide how you want to register your meal items, based on the inclusion of your mod.
Create a new initializer class, implementing MealAPIInitializer.
Add that class to your entrypoints array in fabric.mod.json under the name "mealapi".
Implement the onMealApiInit() method. This method is where you will register your custom item as a meal.
You will be registering your item as a meal in your "main" initializer class, in onInitialize()
Add this code wherever you are registering your item as a meal.
// Makes MY_ITEM be worth 50 fullness points
MealItemRegistry.getInstance().register(MY_ITEM, ((player, stack) -> 50));See this repository's wiki for additional features of the API.