Repository navigation
Food
satisfy edited this page Oct 9, 2026
·
2 revisions
Two families – pick by one question: are the effects fixed, or do they come from the ingredients?
The effects live in the item's FoodProperties; Foundation shows them in the tooltip.
| Class | Use for |
|---|---|
EffectFoodItem(props, duration, returnBowl) |
a meal; returnBowl = true gives the bowl back |
EffectDrinkItem(props, duration, returnBottle) |
a drink (drinking animation), gives the bottle back |
PlaceableEffectFoodItem(block, props) |
a dish item that can also be placed as a block |
TeaJugItem(block, props) |
a placeable jug/teapot with effect tooltip |
FoodBlock(props, maxBites, food) |
a placed dish that is eaten bite by bite |
public static final RegistrySupplier<Item> MISO_SOUP = registerItem("miso_soup",
() -> new EffectFoodItem(settings().food(MyFoods.MISO_SOUP), 900, true));The dish takes over the effects of what went into it (cooking pot, stove, roaster …).
| Class | Use for |
|---|---|
IngredientEffectFoodItem(props, foodStages) |
a meal carrying ingredient effects |
PlaceableIngredientEffectFoodItem(block, props, foodStages) |
same, placeable |
IngredientEffectFoodBlock (abstract) |
the placed version, eaten in bites – you supply the block entity |
IngredientEffectFoodBlockEntity |
stores the effects of a placed dish |
IngredientEffectCarrier |
marker interface: "copy ingredient effects onto me" |
IngredientEffects |
read / write / apply the stored effects on an ItemStack
|
When your station finishes a recipe:
if (output.getItem() instanceof IngredientEffectCarrier) {
for (ItemStack ingredient : usedIngredients) {
IngredientEffects.getEffects(ingredient).forEach(effect -> IngredientEffects.addEffect(output, effect));
}
}A placed ingredient dish needs your own block entity type:
public class LasagneBlock extends IngredientEffectFoodBlock {
// constructor + codec() …
@Override
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return new IngredientEffectFoodBlockEntity(MyBlockEntities.EFFECT_FOOD.get(), pos, state);
}
}A drink that can also be placed as a block (cocktails, teas, beer, wine). Since Foundation 1.0.5.
public static final RegistrySupplier<Item> LEMONADE = ITEMS.register("lemonade",
() -> new PlaceableDrinkItem(LEMONADE_BLOCK.get(), new Item.Properties().food(LEMONADE_FOOD)));
public static final RegistrySupplier<Item> RED_WINE = ITEMS.register("red_wine",
() -> new PlaceableDrinkItem(RED_WINE_BLOCK.get(), new Item.Properties())
.crouchToPlace()
.drinkAnytime()
.container(WINE_BOTTLE));| Option | Effect |
|---|---|
crouchToPlace() |
only places while crouching, a normal right-click drinks |
drinkAnytime() |
drinkable with a full hunger bar |
container(item) |
item the player gets back, e.g. a bottle or mug |
What it does for you:
- Drink animation; drinks without a food component take 32 ticks.
- Effects from
FOODare applied by eating, effects fromPOTION_CONTENTSare applied as well. - When placed into a block with a
StorageBlockEntity, the item (with all its data) is stored in slot 0. - Tooltip with all effects from
FOODandPOTION_CONTENTS, in the vanilla potion style.
Hooks for drinks with their own logic (aged wine, beer quality):
| Method | Override to |
|---|---|
applyEffects(stack, level, entity) |
apply your own effects; called on the server before the item is used up |
containerFor(stack) |
return a container depending on the stack |
appendHoverText(...) |
call super for the effect lines, then add your own |
EffectTooltips.append(stack, context, tooltip) gives you the same effect tooltip for any other item.