Food API

Food API

A flexible food system API for NeoForge. Adds configurable hunger capacity and drain speed via attributes, dynamic food bar rendering with multi-row support, and a provider-based icon replacement system for seamless mod integration.

by
119 Downloads
neoforgefoodgame-mechanics
Rent Server with this Mod

Screenshots

Food API Screenshot 1
Food API Screenshot 2

About this Mod

🍖 Food API

A flexible hunger system library for NeoForge

MODRINTH
GITHUB

📖 About

Food API is a developer-focused library that removes the hardcoded limitations of Minecraft's vanilla hunger system. It exposes hunger capacity and drain speed as proper entity attributes, adds multi-row food bar rendering, and provides a clean provider-based system for replacing food icons — all with optional compatibility for popular HUD mods.

✨ Features

Dynamic hunger capacity — max hunger is now an attribute, supports up to 2 rows (40 units).

Configurable drain speed — control how fast hunger depletes via a multiplier attribute.

Multi-row food bar — second row renders seamlessly above the first, fully synced with vanilla shake animation.

Icon provider system — replace any food icon (empty, half, full, hunger, overlay, saturation) per-player, per-row, per-slot with a simple registration API.

Optional mod compat — native support for Overflowing Bars and AppleSkin when present.

🖼️ Screenshots

Vanilla rendering — single row, standard icons



With Overflowing Bars — row counter, overlay icons stacked on top

📦 New Attributes

Two new player attributes are registered automatically when Food API is loaded:

Attribute ID Default Range Description
Max Hunger food_api:max_hunger 20 1 – 40 Maximum hunger capacity. 20 = one row, 40 = two rows.
Hunger Rate food_api:hunger_rate 1.0 0.0 – 10.0 Hunger drain speed multiplier. 0 = no drain, 2 = twice as fast.

Both attributes are synced to the client and can be modified via commands, other mods, or directly in code:

// Example: give a player double hunger capacity
player.getAttribute(AttributeRegistries.MAX_HUNGER)
      .setBaseValue(40);

// Example: slow hunger drain to half speed
player.getAttribute(AttributeRegistries.HUNGER_RATE)
      .setBaseValue(0.5);

🔧 API Usage

Replacing food icons

Register a provider with an ID and priority. Higher priority wins. Return null to fall through to the next provider.

FoodIconRegistry.register(
    ResourceLocation.fromNamespaceAndPath("mymod", "my_provider"),
    10, // priority — higher = checked first (vanilla = 0)
    (player, iconIndex, row, type) -> {
        // iconIndex: 0 = rightmost icon, 9 = leftmost
        // row: 0 = bottom row, 1 = top row
        return switch (type) {
            case FULL  -> ResourceLocation.fromNamespaceAndPath("mymod", "hud/my_food_full");
            case HALF  -> ResourceLocation.fromNamespaceAndPath("mymod", "hud/my_food_half");
            case EMPTY -> ResourceLocation.fromNamespaceAndPath("mymod", "hud/my_food_empty");
            default    -> null; // let other providers or vanilla handle the rest
        };
    }
);

Icon types

Type Description
EMPTY Background (empty slot)
HALF Half-filled icon
FULL Fully filled icon
EMPTY_HUNGER Background during Hunger effect
HALF_HUNGER Half icon during Hunger effect
FULL_HUNGER Full icon during Hunger effect
HALF_OVERLAY Half icon on top row (Overflowing Bars only)
FULL_OVERLAY Full icon on top row (Overflowing Bars only)
SATURATION Saturation overlay texture (AppleSkin only)

Registering at the right time

Call FoodIconRegistry.register(...) during FMLClientSetupEvent or earlier:

@SubscribeEvent
public static void onClientSetup(FMLClientSetupEvent event) {
    FoodIconRegistry.register(...);
}

🔗 Optional Dependencies

Food API works standalone. These mods unlock extra features when present:

  • Overflowing Bars — enables row counter display and overlay icon rendering on the top row
  • AppleSkin — enables saturation overlay icon replacement via FoodIconType.SATURATION

Made with 🩷 by ArimoV2

Available Versions

Food API 1.1release
MC 1.21.1neoforge
March 16, 2026
Food API 1.0release
MC 1.21.1neoforge
March 15, 2026

How to Install Food API on Your Server

1

Order Server

Order a Minecraft Java server with at least 3 GB RAM (4 GB recommended).

2

Set neoforge Loader

In the panel under "Egg", select the neoforge loader and matching Minecraft version (1.21.1).

3

Install Mod

Open the mod browser in the dashboard and search for "Food API". Click "Install" – done! Alternatively, upload the .jar via SFTP to the /mods folder.

Compatibility

Mod Loaders

neoforge

Minecraft Versions

1.21.1

Server-side

Required

Recommended RAM

4 GB(min. 3 GB)

Frequently Asked Questions

Food API server crashes on startup – what to do?

Most common cause: wrong neoforge version or insufficient RAM. Check the server log (latest.log) for "OutOfMemoryError" or "Mixin" errors. With Mado Hosting: ensure at least 3 GB RAM is allocated and the loader matches the mod version (1.21.1). You can switch loaders with one click in the panel.

Is Food API compatible with neoforge?

Food API officially supports neoforge for Minecraft 1.21.1. The Mado dashboard automatically detects incompatible loader combinations.

Server lagging with Food API – how to optimize performance?

Recommended RAM: 4 GB (per 8 players). Use /spark profiler to check if Food API consumes the most tick time. Common fixes: reduce server view-distance to 8-10, install "performant" or "starlight" as supplementary mods on Forge. With Mado Hosting, your server runs on NVMe SSDs with dedicated CPU cores for minimal latency.

Rent Modded Server

Install Food API with just one click on your server.

Recommended RAM
4 GBab €8/mo
Min. 3 GB | +1 GB pro 8 Spieler
Create Server Now
1-Click Mod Install
NVMe SSD Storage
DDoS Protection included

Details

License
Mozilla Public License 2.0
Server-side
Required

Supported Versions

1.21.1