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 HIGHEST priority and ignores events already cancelled when its listener runs. It reads the hunger value left by earlier listeners. This does not guarantee ordering against another listener at the same priority. It only acts 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 uses a single pass over its supported foods:
- The supported foods are kept in an array sorted by hunger restored (descending), using saturation restored (also descending) as a tie-breaker and the material name (ascending) as a final tie-breaker. A precomputed lookup table chooses the starting index for each hunger level.
- Starting from that index, the plugin walks down the array toward less nourishing foods and takes the first food the player actually carries that is not a customized item. When the player carries several stacks of the same food, the one in the lowest inventory slot is used. As soon as a match is found it is eaten and the search stops.
The first eligible food can restore more hunger than is missing. For example, at hunger 11, rabbit stew (10 hunger) can be chosen before cooked beef (8 hunger), even though only 9 hunger is missing. There is no second pass to minimize wasted restoration.
After eating, the restored hunger is capped at 20, and saturation is capped to the resulting hunger value, matching vanilla limits.
Bowl Foods
Beetroot soup, mushroom stew, and rabbit stew return an empty bowl when auto-eaten, matching vanilla:
- if the eaten stack is used up, the bowl replaces it in the same slot
- otherwise the bowl is added to the inventory, and dropped at the player's feet if there is no room for it
Protected Items
BetterFood compares each candidate with a fresh vanilla item of the same material using Bukkit's ItemStack.isSimilar. Stack size is ignored. Items with different item data are skipped, including:
- a custom display name
- lore
- enchantments, custom model data, and other item components
- persistent data written by other plugins
The check compares the whole item against a freshly created vanilla stack rather than a hand-maintained list of fields, so item data added by future Minecraft versions is skipped automatically. 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)
- 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 is not in the supported list above will also be skipped until it is explicitly added to that list.
On startup, BetterFood runs a coverage audit over every edible item your server version knows about and logs a single console line listing the ones it is intentionally not auto-eating (BetterFood is intentionally not auto-eating these food items: ...), so you can see at a glance exactly which items are skipped on your server version. The line is only printed when there is at least one skipped item, so no line at all means the supported list already covers every edible item on that version.
Troubleshooting
If a player's food is not being eaten, check in this order:
- the player has
betterfood.userand has not turned eating off with/betterfood toggleEating - the food is in the supported list
- the stack is plain vanilla food, with no custom name, lore, enchantment or plugin data (see Protected Items)
- hunger is actually going down. BetterFood is not a timer and only eats when the hunger bar drops.
- no other plugin cancels the hunger change. BetterFood ignores
FoodLevelChangeEvents that are already cancelled.
When asking for help, include the BetterFood and server versions, the food type, whether the stack is plain vanilla food, and the steps that reproduce the problem.