Health and hunger system

This commit is contained in:
2026-09-26 21:07:36 -03:00
parent 0fa6ec4ed3
commit 8d9c85d379
18 changed files with 662 additions and 8 deletions
+13
View File
@@ -138,6 +138,18 @@ export interface BlockRegistry {
compiled_states?: CompiledStateDefinition[];
}
// what eating an item does, like minecraft's food properties
export interface FoodProperties {
// hunger points it restores, a bar is 20
nutrition: number;
// saturation it gives is nutrition * saturation_modifier * 2, like minecraft. bread's is 0.6
saturation_modifier: number;
// can be eaten when not hungry
always_edible?: boolean;
// what's left in the hand after, like a bowl after soup
returns?: string;
}
export interface ItemRegistry<T = unknown | undefined> {
texture_id: string | ((item: ItemStack<T>) => string);
// what players see, like "Iron Ingot". made from the id when not set, see display_name in common/utils.ts
@@ -146,6 +158,7 @@ export interface ItemRegistry<T = unknown | undefined> {
tool_type?: string;
max_stack?: number;
lore?: string;
food?: FoodProperties;
components?: Record<string, unknown>;
on_create?(item: ItemStack<T>): void;