Files
bworld/docs/modding/items/food.md
T
2026-09-29 23:29:14 -03:00

1.9 KiB
Raw Blame History

Food

An item with a food property can be eaten. Players eat by right clicking while holding it, when they're hungry.

{
	"format_version": 1,
	"item": {
		"id": "farmersdelight:cooked_rice",
		"texture": "farmersdelight:cooked_rice",
		"max_stack": 16,
		"food": { "nutrition": 6, "saturation_modifier": 0.4, "returns": "bworld:bowl" }
	}
}
Field Default Meaning
nutrition required Hunger points it restores, out of 20. A whole number.
saturation_modifier required Like Minecraft's: the saturation it gives is nutrition × modifier × 2. Bread's is 0.6.
always_edible false Can be eaten even when not hungry.
returns none An item left in the hand after eating, like a bowl after soup.

Food that places a block, like potatoes with places, is planted when clicked somewhere it can go and eaten otherwise.

Hunger and Health

Hunger and health work like Minecraft's:

  • Sprinting, swimming, jumping, breaking blocks, taking damage and healing add exhaustion. Every 4 exhaustion costs a point of saturation, or of hunger once saturation is gone.
  • A full stomach heals: quickly while there's saturation, slowly with at least 18 hunger.
  • At 0 hunger, players lose health every 4 seconds, down to half a heart.

Server scripts can feed players directly, and read and change their hunger. See Players.

player.feed(4, 0.3); // like eating 4 nutrition with a 0.3 modifier
player.add_exhaustion(8); // two points of saturation or hunger