Skip to content
BasaltSoftware
Bedrock 1.26.60

Site colour

Discord
Esc

    ↑↓ moveEnter openEsc close

    Keyboard shortcuts
    Ctrl K
    Search the whole site, from any page
    /
    Jump to the sidebar search, or search the whole site where there isn't one
    Enter
    Open the top search result
    Esc
    Clear the search, or close this panel
    ?
    Show these shortcuts

    Class in @minecraft/server

    Extends ItemComponent

    What eating a food gives. Read only.

    import { ItemFoodComponent } from '@minecraft/server';
    import { ItemStack, type ItemFoodComponent } from '@minecraft/server';
    const item = new ItemStack('minecraft:diamond_sword');
    const component: ItemFoodComponent | undefined = item.getComponent('minecraft:food');
    if (component) {
    console.log(item.typeId, component.canAlwaysEat);
    }
    import { ItemStack } from '@minecraft/server';
    const item = new ItemStack('minecraft:diamond_sword');
    const component = item.getComponent('minecraft:food');
    if (component) {
    console.log(item.typeId, component.canAlwaysEat);
    }

    static read-only

    static readonly componentId = "minecraft:food";

    read-only

    readonly canAlwaysEat: boolean;

    Whether it can be eaten with a full hunger bar.

    read-only

    readonly nutrition: number;

    The hunger points it fills.

    read-only

    readonly saturationModifier: number;

    Saturation given is the nutrition times this times two.

    read-only

    readonly usingConvertsTo: string;

    What’s left in the hand after, as minecraft:bowl, or "" for nothing.

    ItemComponentTypeMap.food, ItemComponentTypeMap.minecraft:food

    From ItemComponent: typeId, isValid