Skip to main content

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 default (normal) 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 uses a single pass over its supported foods:

  1. The supported foods are kept in an array sorted by hunger restored (descending), using saturation restored as a tie-breaker. A precomputed lookup table maps each possible hunger level to the index where this array should start being scanned, so the search begins at the strongest food that does not overshoot the missing hunger.
  2. 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. As soon as a match is found it is eaten and the search stops.

There is no second comparison pass and no overflow arithmetic — the precomputed start index is what keeps the plugin from 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

BetterFood will avoid auto-consuming food if it has either of these custom-item characteristics:

  • custom display name
  • lore

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:

FoodHunger RestoredSaturation Restored
Apple42.4
Baked Potato56.0
Beetroot11.2
Beetroot Soup67.2
Bread56.0
Carrot33.6
Cooked Beef812.8
Cooked Chicken67.2
Cooked Cod56.0
Cooked Mutton69.6
Cooked Porkchop812.8
Cooked Rabbit56.0
Cooked Salmon69.6
Cookie20.4
Dried Kelp10.6
Glow Berries20.4
Golden Carrot614.4
Melon Slice21.2
Mushroom Stew67.2
Potato10.6
Pumpkin Pie84.8
Rabbit Stew1012.0
Sweet Berries20.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)
  • 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.