BetterFood Behavior
BetterFood uses hunger-aware food selection instead of simply eating the most nutritious item first.
When It Triggers
BetterFood reacts to vanilla FoodLevelChangeEvent at the highest event priority and only when the player's hunger is going down. The player must have the betterfood.user permission, and they must not have turned automatic eating off via /betterfood toggleEating.
Selection Rules
When the plugin decides what to eat, it works in two passes:
- Ideal candidate – it first asks for the single best food for the missing hunger:
- Prefer the food with the highest hunger value that still fits within the missing hunger (saturation breaks ties).
- If nothing fits cleanly, fall back to the food with the smallest overflow (saturation breaks ties).
- Inventory match – it then scans the player's inventory storage for that ideal food. If the player does not actually carry it, the plugin walks the full inventory and applies the same fit/overflow comparison to every supported food the player owns, then picks the best available.
The intent is to avoid burning strong food on a small hunger gap when a weaker item would do.
After eating, the restored hunger is capped at 20, and saturation is capped to the resulting hunger value, matching vanilla limits.
Protected Items
The current code protects much more than just renamed or lore-bearing food. BetterFood will avoid auto-consuming food if it has custom-item characteristics such as:
- custom name or item name
- lore
- custom model data
- enchantments
- attribute modifiers
- unbreakable state
- persistent data container tags
This is intended to reduce the chance of consuming plugin items or decorative items by mistake.
Supported Foods
BetterFood will auto-consume the following foods:
| Food | Hunger Restored | Saturation Restored |
|---|---|---|
| Apple | 4 | 2.4 |
| Baked Potato | 5 | 6.0 |
| Beetroot | 1 | 1.2 |
| Beetroot Soup | 6 | 7.2 |
| Bread | 5 | 6.0 |
| Carrot | 3 | 3.6 |
| Cooked Beef | 8 | 12.8 |
| Cooked Chicken | 6 | 7.2 |
| Cooked Cod | 5 | 6.0 |
| Cooked Mutton | 6 | 9.6 |
| Cooked Porkchop | 8 | 12.8 |
| Cooked Rabbit | 5 | 6.0 |
| Cooked Salmon | 6 | 9.6 |
| Cookie | 2 | 0.4 |
| Dried Kelp | 1 | 0.6 |
| Glow Berries | 2 | 0.4 |
| Golden Carrot | 6 | 14.4 |
| Melon Slice | 2 | 1.2 |
| Mushroom Stew | 6 | 7.2 |
| Potato | 1 | 0.6 |
| Pumpkin Pie | 8 | 4.8 |
| Rabbit Stew | 10 | 12.0 |
| Sweet Berries | 2 | 0.4 |
Excluded Foods
The following edible items are intentionally excluded from auto-eating. These are raw meats, special items, or foods with negative or unpredictable effects:
- Beef (raw)
- Cake
- Chicken (raw)
- Chorus Fruit
- Cod (raw)
- Enchanted Golden Apple
- Golden Apple
- Honey Bottle
- Mutton (raw)
- Poisonous Potato
- Porkchop (raw)
- Pufferfish
- Rabbit (raw)
- Rotten Flesh
- Salmon (raw)
- Spider Eye
- Suspicious Stew
- Tropical Fish
Any other edible material added by newer Minecraft versions that has not been classified yet will also be skipped. The plugin logs a warning at startup if it detects unclassified edible materials.
Container Remainders
If a consumed food leaves a remainder item, BetterFood preserves it.
Examples include bowls or other container-returning foods. The remainder is returned to inventory or dropped at the player if inventory space is unavailable.