Washim Amin

ROLE & OBJECTIVE

You are an expert Minecraft Bedrock Edition Add-On Developer specializing in Bedrock JSON architecture (Format Version 1.21.50+ / 1.26.0+), @minecraft/server (v2.0.0+), and @minecraft/server-ui.

We are building a full-featured Minecraft Bedrock Add-On called "Village Cloud Kitchen" (Namespace: ck).

CRITICAL RULE: Never use deprecated "Holiday Creator Features" (such as minecraft:on_interact, minecraft:Block_Event in JSON, or world.beforeEvents.worldInitialize). You MUST use the modern Custom Components API registered inside system.beforeEvents.startup using blockComponentRegistry.registerCustomComponent and itemComponentRegistry.registerCustomComponent.

---

CORE BEDROCK ADD-ON ARCHITECTURE & FEATURES

1. The "Cloud Kitchen" Core Block (ck:cloud_kitchen_terminal)

* Custom Component: ck:terminal_component (handles onPlace and onPlayerInteract). * Structure & Village Scan (onPlace & onPlayerInteract): * Uses dimension.getBlock() in a bounding-box scan around the placed terminal to verify it is inside an enclosed room (walls, roof, door) and detects nearby kitchen appliance blocks (ck:commercial_oven, ck:prep_counter, ck:deep_fryer, ck:drink_mixer, ck:packaging_table). * Uses dimension.getEntities({ type: "minecraft:villager_v2", maxDistance: 100, location: block.location }) to verify the kitchen is built near a Village. * Saves the validated kitchen coordinates and active status in world.setDynamicProperty("ck:kitchen_data", JSON.stringify(...)). * Order Dispatch UI: Interacting with the terminal opens an ActionFormData menu showing active Villager orders. Selecting an order removes the matching packaged food from the player's minecraft:inventory container and adds the payout + speed tip to the player's dynamic property wallet (player.getDynamicProperty("ck:wallet")).

2. Custom Kitchen Appliances (Blocks + @minecraft/server-ui Crafting Menus)

Create custom blocks in BP/blocks/ with 3D geometries/textures in RP/ and bind them to custom block components in scripts/main.js:

  1. Custom Commercial Oven (ck:commercial_oven): Uses ck:appliance_component and onTick / onPlayerInteract. Opens a UI where players select baking/roasting recipes, consumes raw ingredients + coal/charcoal, plays cooking particles (minecraft:villager_happy / minecraft:basic_flame_particle) and sounds, and outputs cooked food after a short timer.
  2. Prep & Chopping Counter (ck:prep_counter): Converts raw crops/meats into uncooked prepped foods (e.g., Potato to Raw Fries, Wheat + Water to Pizza Dough, Raw Beef to Raw Burger Patty).
  3. Deep Fryer (ck:deep_fryer): Uses Cooking Oil + prepped items to fry foods (Fries, Fried Chicken, Samosas, Donuts).
  4. Beverage & Shake Mixer (ck:drink_mixer): Blends fruits, milk, ice, and sugar into shakes, sodas, and boba teas.
  5. Packaging Table (ck:packaging_table): Combines cooked dishes with paper to wrap items or fulfill multi-item meal combos.

3. 100+ Food Variety System (Automated JSON Generator Script)

Because Bedrock requires an individual JSON file in BP/items/ for every item, plus entries in RP/textures/item_texture.json and RP/texts/en_US.lang: * Write a standalone Node.js (generate_foods.js) or Python (generate_foods.py) script containing a master dictionary of 100+ foods + 25 raw/prepped ingredients that automatically generates: 1. All 125+ item JSON files in BP/items/ using minecraft:food, minecraft:use_modifiers, and minecraft:icon. 2. A central scripts/foodRegistry.js file exporting all 100+ foods, their categories, required appliance (oven, fryer, mixer, prep), recipe ingredients, and base villager payout prices. 3. Complete RP/textures/item_texture.json and RP/texts/en_US.lang files. * 7 Food Categories to Include (100+ Cooked Dishes Total): Fast Food (20):* Burgers, Fries, Hotdogs, Nuggets, Tacos, Burritos, Nachos, Wraps.

Pizzeria & Pasta (15):* Pepperoni Pizza, Margherita, Veggie Supreme, Cheese Burst, Lasagna, Alfredo, Mac & Cheese.

Desi & Asian Street Food (20):* Butter Chicken, Biryani, Samosa, Paneer Tikka, Masala Dosa, Ramen, Sushi Rolls, Dumplings, Fried Rice.

Bakery & Desserts (15):* Croissants, Donuts, Choco Lava Cake, Waffles, Pancakes, Apple Pie, Cheesecake, Brownies.

Grilled & Roasts (15):* Roast Chicken, Steak Platter, BBQ Ribs, Kebabs, Grilled Salmon, Lamb Chops.

Beverages & Shakes (15):* Boba Tea, Mango Lassi, Cold Coffee, Berry Smoothie, Cola, Lemonade, Oreo Shake.

4. The Smartphone Item (ck:kitchen_phone) & Villager Order Loop

* Item JSON: BP/items/kitchen_phone.json with custom component ck:phone_component. * Background Order Loop (system.runInterval): * Every 60–90 seconds (1200–1800 ticks), if a player has an active Cloud Kitchen near villagers, pick a random nearby Villager (minecraft:villager_v2), assign them a customer name, and generate an order for 1–3 random foods from foodRegistry.js with a payout and countdown timer.

If the player has ck:kitchen_phone in their inventory, play random.orb / note.pling and display an on-screen pop-up (player.onScreenDisplay.setActionBar or setTitle) showing: "New Order from Villager! Check your Kitchen Phone!"* * Phone App UI (onUse via @minecraft/server-ui): * Right-clicking/long-pressing with ck:kitchen_phone opens a custom ActionFormData "Cloud Kitchen OS" dashboard displaying: * Player's Kitchen Wallet balance ($ / Coins). * Kitchen Status (Connected Village, Appliance Checklist). * Active Orders List: Clicking an order shows exactly what food the Villager wants, how much they pay, time remaining, and options to Deliver Directly / Track Order / Reject Order.

5. Supply Shop Block (ck:supply_shop) & Villager Courier Delivery

* Shop Block & UI: Interacting with ck:supply_shop opens a ModalFormData / ActionFormData wholesale store where players spend their Kitchen Wallet balance to buy raw ingredients, spices, cooking oil, and appliances in bulk. * Villager Courier Delivery Mechanic: * Purchasing supplies does NOT put items directly into the player's inventory. * Instead, the script spawns a custom entity ck:courier_villager (or tags a spawned villager as a Delivery Courier) 25–35 blocks away along the surface. * A system.runInterval delivery controller guides the Courier Villager toward the ck:supply_shop block coordinates (using minecraft:behavior.move_to_block or scripted step navigation). * When the Courier reaches within 2 blocks of the Shop Block, they play a villager trade sound, deposit the ordered items into a barrel/chest adjacent to the Shop Block (or spawn a collectible Delivery Parcel / store inside the Shop Block's dynamic inventory buffer), display a delivery notification on the player's phone, and despawn after walking away.

---

CODING ROADMAP (6 SEQUENTIAL STEPS)

Because this Add-On has many files, do NOT write partial stubs or skip logic. Build it across 6 steps, waiting for my confirmation after each step:

  1. Step 1: BP/manifest.json, RP/manifest.json, and the complete generate_foods.py (or .js) script + scripts/foodRegistry.js with all 100+ foods and ingredients defined.
  2. Step 2: JSON files for all Custom Blocks (ck:cloud_kitchen_terminal, ck:commercial_oven, ck:prep_counter, ck:deep_fryer, ck:drink_mixer, ck:packaging_table, ck:supply_shop) and ck:kitchen_phone item JSON.
  3. Step 3: scripts/main.js and scripts/kitchenManager.js (Custom Component registration in system.beforeEvents.startup, Structure & Village detection, and Dynamic Property Wallet).
  4. Step 4: scripts/applianceUI.js (Interactive cooking, frying, prepping, and baking menus using @minecraft/server-ui with cooking timers and visual/sound effects).
  5. Step 5: scripts/phoneSystem.js (Background villager order generator, phone notifications, and the Smartphone UI dashboard).
  6. Step 6: scripts/shopAndCourier.js + BP/entities/courier_villager.json (Wholesale Supply Shop UI and the Villager Courier spawning and physical delivery system).

Start now by generating Step 1 in full detail.

Give me .mcaddon

Kodari AI
KodariOct 16 at 2:09 pm 2
VillageCloudKitchen
A comprehensive Minecraft Bedrock Add-On that transforms villages into functional cloud kitchens. Players place a Cloud Kitchen Terminal block to validate and register their kitchen structure, then use five specialized appliances (Commercial Oven, Prep Counter, Deep Fryer, Drink Mixer, Packaging Table) to craft 100+ foods across seven categories. A Smartphone item manages villager orders, wallet payments, and delivery tracking. A Supply Shop block enables bulk ingredient purchasing with physical Villager Courier delivery. Features custom block components, dynamic properties for persistent data, and interactive UI menus using @minecraft/server-ui.
  1. Add behavior/resource pack manifests with the script API dependencies.

  2. Define 100 dishes and 25 ingredients in the registry.

  3. Add a standalone generator for item JSON, texture atlas entries, and English names.

Step 1 is complete: the behavior/resource pack manifests, food generator, and registry are in place. The registry defines 100 dishes across the requested categories and 25 ingredients; the generator creates their item JSON files, item texture atlas entries, English names, and registry file.

The .mcaddon is not ready yet—the remaining pack content is planned for Steps 2–6. Confirm when you’re ready for Step 2.

Kodari can make mistakes. Review important code before using.
Files
BP
RP
scripts
generate_foods.py
Code
4 493
generate_foods.py
#!/usr/bin/env python3
"""Generate the Cloud Kitchen food items, localization, atlas, and JS registry."""

import json
from pathlib import Path


ROOT = Path(__file__).resolve().parent

FOOD_ROWS = """
burger|Classic Burger|fast_food|prep|ck:raw_burger_patty,minecraft:bread,minecraft:beetroot|12|8
cheeseburger|Cheeseburger|fast_food|prep|ck:raw_burger_patty,ck:mozzarella,minecraft:bread|15|9
double_burger|Double Burger|fast_food|prep|ck:raw_burger_patty,ck:raw_burger_patty,minecraft:bread|19|12
veggie_burger|Veggie Burger|fast_food|prep|minecraft:carrot,minecraft:beetroot,minecraft:bread|11|7
fries|Golden Fries|fast_food|fryer|ck:raw_fries,ck:cooking_oil|7|5
loaded_fries|Loaded Fries|fast_food|fryer|ck:raw_fries,ck:cooking_oil,ck:mozzarella|12|8
hotdog|Classic Hotdog|fast_food|prep|ck:hotdog_sausage,minecraft:bread|10|7
chili_dog|Chili Dog|fast_food|prep|ck:hotdog_sausage,minecraft:bread,ck:curry_spice|13|8
chicken_nuggets|Chicken Nuggets|fast_food|fryer|ck:chicken_nuggets,ck:cooking_oil|10|7
spicy_nuggets|Spicy Nuggets|fast_food|fryer|ck:chicken_nuggets,ck:cooking_oil,ck:curry_spice|12|8
beef_taco|Beef Taco|fast_food|prep|ck:raw_burger_patty,ck:taco_shell,minecraft:kelp|11|7
fish_taco|Fish Taco|fast_food|fryer|ck:raw_salmon,ck:taco_shell,minecraft:kelp,ck:cooking_oil|12|7
burrito|Bean Burrito|fast_food|prep|ck:tortilla,minecraft:beetroot,minecraft:carrot|11|8
breakfast_burrito|Breakfast Burrito|fast_food|prep|ck:tortilla,minecraft:egg,minecraft:potato|13|9
nachos|Cheesy Nachos|fast_food|oven|ck:tortilla,ck:mozzarella|10|6
loaded_nachos|Loaded Nachos|fast_food|oven|ck:tortilla,ck:mozzarella,ck:raw_burger_patty|15|9
chicken_wrap|Crispy Chicken Wrap|fast_food|fryer|ck:raw_chicken,ck:tortilla,ck:cooking_oil|13|8
veggie_wrap|Garden Veggie Wrap|fast_food|prep|ck:tortilla,minecraft:carrot,minecraft:beetroot|10|6
onion_rings|Onion Rings|fast_food|fryer|minecraft:potato,ck:cooking_oil|8|5
crispy_chicken_sandwich|Crispy Chicken Sandwich|fast_food|fryer|ck:raw_chicken,minecraft:bread,ck:cooking_oil|15|9
pepperoni_pizza|Pepperoni Pizza|pizzeria_pasta|oven|ck:pizza_dough,ck:tomato_sauce,ck:mozzarella,ck:hotdog_sausage|20|12
margherita_pizza|Margherita Pizza|pizzeria_pasta|oven|ck:pizza_dough,ck:tomato_sauce,ck:mozzarella|17|10
veggie_supreme_pizza|Veggie Supreme Pizza|pizzeria_pasta|oven|ck:pizza_dough,ck:tomato_sauce,ck:mozzarella,minecraft:carrot,minecraft:beetroot|19|11
cheese_burst_pizza|Cheese Burst Pizza|pizzeria_pasta|oven|ck:pizza_dough,ck:mozzarella,ck:mozzarella|20|12
bbq_chicken_pizza|BBQ Chicken Pizza|pizzeria_pasta|oven|ck:pizza_dough,ck:tomato_sauce,ck:mozzarella,ck:raw_chicken|21|12
garlic_bread|Garlic Bread|pizzeria_pasta|oven|minecraft:bread,minecraft:kelp,ck:mozzarella|9|6
lasagna|Lasagna|pizzeria_pasta|oven|ck:pasta,ck:tomato_sauce,ck:mozzarella,ck:raw_burger_patty|21|13
alfredo_pasta|Alfredo Pasta|pizzeria_pasta|oven|ck:pasta,ck:milk,ck:mozzarella|18|11
mac_and_cheese|Mac and Cheese|pizzeria_pasta|oven|ck:pasta,ck:milk,ck:mozzarella|15|10
spaghetti_bolognese|Spaghetti Bolognese|pizzeria_pasta|oven|ck:pasta,ck:tomato_sauce,ck:raw_burger_patty|19|12
pesto_pasta|Pesto Pasta|pizzeria_pasta|oven|ck:pasta,minecraft:kelp,ck:mozzarella|17|10
ravioli|Cheese Ravioli|pizzeria_pasta|oven|ck:pasta,ck:mozzarella,ck:milk|16|10
baked_ziti|Baked Ziti|pizzeria_pasta|oven|ck:pasta,ck:tomato_sauce,ck:mozzarella|17|11
meatball_sub|Meatball Sub|pizzeria_pasta|oven|ck:raw_burger_patty,minecraft:bread,ck:tomato_sauce|16|10
calzone|Cheese Calzone|pizzeria_pasta|oven|ck:pizza_dough,ck:mozzarella,ck:tomato_sauce|16|10
butter_chicken|Butter Chicken|desi_asian|oven|ck:raw_chicken,ck:milk,ck:curry_spice|22|13
chicken_biryani|Chicken Biryani|desi_asian|oven|ck:rice,ck:raw_chicken,ck:curry_spice|22|13
vegetable_biryani|Vegetable Biryani|desi_asian|oven|ck:rice,minecraft:carrot,minecraft:potato,ck:curry_spice|18|11
samosa|Golden Samosa|desi_asian|fryer|ck:samosa_dough,minecraft:potato,ck:cooking_oil|9|6
paneer_tikka|Paneer Tikka|desi_asian|oven|ck:paneer,ck:curry_spice|16|9
masala_dosa|Masala Dosa|desi_asian|oven|ck:dosa_batter,minecraft:potato,ck:curry_spice|15|9
ramen|Hearty Ramen|desi_asian|oven|ck:ramen_noodles,ck:raw_chicken,ck:egg|18|11
sushi_rolls|Salmon Sushi Rolls|desi_asian|prep|ck:sushi_rice,ck:raw_salmon,minecraft:kelp|17|9
dumplings|Steamed Dumplings|desi_asian|oven|ck:dumpling_wrapper,ck:raw_burger_patty|15|9
fried_rice|Vegetable Fried Rice|desi_asian|fryer|ck:rice,minecraft:carrot,ck:cooking_oil,ck:egg|16|10
chicken_korma|Chicken Korma|desi_asian|oven|ck:raw_chicken,ck:milk,ck:curry_spice|21|13
chana_masala|Chana Masala|desi_asian|oven|minecraft:beetroot,ck:tomato_sauce,ck:curry_spice|16|10
naan|Buttered Naan|desi_asian|oven|ck:pizza_dough,ck:milk|8|5
tandoori_chicken|Tandoori Chicken|desi_asian|oven|ck:raw_chicken,ck:curry_spice|20|12
spring_rolls|Crispy Spring Rolls|desi_asian|fryer|ck:dumpling_wrapper,minecraft:carrot,ck:cooking_oil|12|7
pad_thai|Pad Thai|desi_asian|fryer|ck:rice,ck:egg,ck:raw_chicken,ck:cooking_oil|19|11
teriyaki_bowl|Teriyaki Chicken Bowl|desi_asian|oven|ck:rice,ck:raw_chicken,ck:curry_spice|19|11
bao_buns|Steamed Bao Buns|desi_asian|oven|ck:pizza_dough,ck:raw_burger_patty|14|8
sweet_and_sour_chicken|Sweet and Sour Chicken|desi_asian|fryer|ck:raw_chicken,minecraft:apple,ck:cooking_oil|19|11
kimchi_pancake|Savory Kimchi Pancake|desi_asian|fryer|ck:dosa_batter,minecraft:beetroot,ck:cooking_oil|14|8
croissant|Buttery Croissant|bakery_desserts|oven|ck:pizza_dough,ck:milk|8|5
glazed_donut|Glazed Donut|bakery_desserts|fryer|ck:pizza_dough,ck:cooking_oil,minecraft:sugar|9|6
chocolate_donut|Chocolate Donut|bakery_desserts|fryer|ck:pizza_dough,ck:cooking_oil,minecraft:cocoa_beans|11|7
chocolate_lava_cake|Chocolate Lava Cake|bakery_desserts|oven|minecraft:wheat,minecraft:egg,minecraft:cocoa_beans,ck:milk|16|10
waffles|Golden Waffles|bakery_desserts|oven|minecraft:wheat,minecraft:egg,ck:milk|10|7
pancakes|Fluffy Pancakes|bakery_desserts|oven|minecraft:wheat,minecraft:egg,ck:milk|9|6
apple_pie|Homestyle Apple Pie|bakery_desserts|oven|minecraft:apple,minecraft:wheat,minecraft:sugar|12|8
cheesecake|Creamy Cheesecake|bakery_desserts|oven|ck:mozzarella,ck:milk,minecraft:sugar,minecraft:wheat|15|9
brownies|Fudge Brownies|bakery_desserts|oven|minecraft:cocoa_beans,minecraft:wheat,minecraft:sugar,minecraft:egg|12|8
cinnamon_roll|Cinnamon Roll|bakery_desserts|oven|ck:pizza_dough,minecraft:sugar|10|7
blueberry_muffin|Blueberry Muffin|bakery_desserts|oven|minecraft:wheat,minecraft:sweet_berries,minecraft:egg|10|7
banana_bread|Banana Bread|bakery_desserts|oven|minecraft:wheat,minecraft:apple,minecraft:egg|10|7
sugar_cookie|Sugar Cookie|bakery_desserts|oven|minecraft:wheat,minecraft:sugar|6|4
cream_puff|Vanilla Cream Puff|bakery_desserts|oven|ck:pizza_dough,ck:milk,minecraft:sugar|12|8
baklava|Honey Baklava|bakery_desserts|oven|ck:pizza_dough,minecraft:honey_bottle,minecraft:sugar|14|9
roast_chicken|Herb Roast Chicken|grilled_roasts|oven|ck:raw_chicken,minecraft:potato|23|14
steak_platter|Steak Platter|grilled_roasts|oven|ck:raw_burger_patty,minecraft:potato,minecraft:carrot|25|15
bbq_ribs|Smoky BBQ Ribs|grilled_roasts|oven|ck:raw_ribs,ck:curry_spice|24|15
beef_kebab|Grilled Beef Kebab|grilled_roasts|oven|ck:raw_burger_patty,minecraft:carrot|16|10
chicken_kebab|Spiced Chicken Kebab|grilled_roasts|oven|ck:raw_chicken,ck:curry_spice|16|10
grilled_salmon|Grilled Salmon|grilled_roasts|oven|ck:raw_salmon,minecraft:kelp|18|11
lamb_chops|Roasted Lamb Chops|grilled_roasts|oven|ck:raw_lamb_chops,minecraft:potato|23|14
grilled_vegetables|Grilled Vegetable Platter|grilled_roasts|oven|minecraft:carrot,minecraft:potato,minecraft:beetroot|13|8
smoked_brisket|Slow-Smoked Brisket|grilled_roasts|oven|ck:raw_burger_patty,ck:curry_spice|24|15
grilled_pork_chop|Grilled Pork Chop|grilled_roasts|oven|minecraft:porkchop,minecraft:potato|18|11
herb_roasted_lamb|Herb-Roasted Lamb|grilled_roasts|oven|ck:raw_lamb_chops,minecraft:carrot,ck:curry_spice|25|15
honey_glazed_ham|Honey-Glazed Ham|grilled_roasts|oven|minecraft:porkchop,minecraft:honey_bottle|22|13
grilled_tuna|Grilled Tuna Steak|grilled_roasts|oven|ck:raw_salmon,ck:curry_spice|19|11
roast_turkey|Festive Roast Turkey|grilled_roasts|oven|ck:raw_chicken,minecraft:potato,minecraft:carrot|26|16
stuffed_peppers|Stuffed Peppers|grilled_roasts|oven|minecraft:beetroot,ck:rice,ck:raw_burger_patty|17|10
boba_tea|Brown Sugar Boba Tea|beverages_shakes|mixer|ck:milk,ck:boba_pearls,minecraft:sugar|14|6
mango_lassi|Mango Lassi|beverages_shakes|mixer|ck:milk,minecraft:apple,ck:curry_spice|12|6
cold_coffee|Iced Coffee|beverages_shakes|mixer|ck:milk,minecraft:cocoa_beans,minecraft:ice|12|5
berry_smoothie|Berry Smoothie|beverages_shakes|mixer|ck:milk,minecraft:sweet_berries|11|6
cola|Fizzy Cola|beverages_shakes|mixer|minecraft:sugar,minecraft:water_bucket|9|4
lemonade|Fresh Lemonade|beverages_shakes|mixer|minecraft:sugar,minecraft:water_bucket,minecraft:glow_berries|9|4
oreo_shake|Cookie Crumble Shake|beverages_shakes|mixer|ck:milk,minecraft:cookie,minecraft:sugar|15|7
strawberry_milkshake|Strawberry Milkshake|beverages_shakes|mixer|ck:milk,minecraft:sweet_berries,minecraft:sugar|13|7
chocolate_milkshake|Chocolate Milkshake|beverages_shakes|mixer|ck:milk,minecraft:cocoa_beans,minecraft:sugar|13|7
iced_tea|Peach Iced Tea|beverages_shakes|mixer|minecraft:sugar,minecraft:water_bucket,minecraft:apple|10|4
hot_chocolate|Rich Hot Chocolate|beverages_shakes|mixer|ck:milk,minecraft:cocoa_beans,minecraft:sugar|12|6
orange_soda|Orange Fizz|beverages_shakes|mixer|minecraft:sugar,minecraft:water_bucket,minecraft:glow_berries|9|4
apple_juice|Chilled Apple Juice|beverages_shakes|mixer|minecraft:apple,minecraft:water_bucket|9|4
watermelon_juice|Watermelon Cooler|beverages_shakes|mixer|minecraft:melon_slice,minecraft:water_bucket|10|5
vanilla_frappe|Vanilla Frappe|beverages_shakes|mixer|ck:milk,minecraft:sugar,minecraft:snowball|13|6
""".strip()

INGREDIENT_ROWS = """
raw_burger_patty|Raw Burger Patty|beef_raw|2
raw_fries|Prepared Potato Fries|potato|2
hotdog_sausage|Hotdog Sausage|porkchop_raw|2
chicken_nuggets|Raw Chicken Nuggets|chicken_raw|2
tortilla|Soft Tortilla|bread|2
taco_shell|Crunchy Taco Shell|bread|2
pizza_dough|Pizza Dough|bread|2
tomato_sauce|Tomato Sauce|beetroot|1
mozzarella|Mozzarella Cheese|milk_bucket|2
pasta|Uncooked Pasta|wheat|2
rice|Rice|wheat_seeds|1
curry_spice|Curry Spice Blend|dye_powder_orange|1
samosa_dough|Samosa Dough|bread|2
paneer|Fresh Paneer|milk_bucket|2
dosa_batter|Dosa Batter|wheat|2
ramen_noodles|Ramen Noodles|wheat|2
sushi_rice|Seasoned Sushi Rice|wheat|2
dumpling_wrapper|Dumpling Wrapper|bread|2
raw_chicken|Raw Chicken Portions|chicken_raw|2
raw_salmon|Raw Salmon Fillet|fish_salmon_raw|2
raw_ribs|Raw Rib Rack|porkchop_raw|2
raw_lamb_chops|Raw Lamb Chops|mutton_raw|2
cooking_oil|Cooking Oil|honey_bottle|1
milk|Fresh Milk|milk_bucket|1
boba_pearls|Tapioca Boba Pearls|slimeball|1
""".strip()

FOOD_TEXTURES = {
    "fast_food": "textures/items/cooked_beef",
    "pizzeria_pasta": "textures/items/bread",
    "desi_asian": "textures/items/cooked_chicken",
    "bakery_desserts": "textures/items/cookie",
    "grilled_roasts": "textures/items/cooked_beef",
    "beverages_shakes": "textures/items/potion_bottle_drink",
}


def parse_foods():
    foods = []
    for line in FOOD_ROWS.splitlines():
        item_id, name, category, appliance, ingredient_ids, payout, nutrition = line.split("|")
        foods.append({
            "id": f"ck:{item_id}",
            "name": name,
            "category": category,
            "appliance": appliance,
            "ingredients": ingredient_ids.split(","),
            "payout": int(payout),
            "nutrition": int(nutrition),
        })
    return foods


def parse_ingredients():
    ingredients = []
    for line in INGREDIENT_ROWS.splitlines():
        item_id, name, texture, nutrition = line.split("|")
        ingredients.append({
            "id": f"ck:{item_id}",
            "name": name,
            "texture": f"textures/items/{texture}",
            "nutrition": int(nutrition),
        })
    return ingredients


def make_registry_source():
    return f'''const FOOD_ROWS = `
{FOOD_ROWS}
`.trim();

const INGREDIENT_ROWS = `
{INGREDIENT_ROWS}
`.trim();

const parseFoods = (rows) => rows.split("\\n").map((row) => {{
  const [id, name, category, appliance, ingredientList, payout, nutrition] = row.split("|");
  return {{
    id: `ck:${{id}}`,
    name,
    category,
    appliance,
    ingredients: ingredientList.split(","),
    payout: Number(payout),
    nutrition: Number(nutrition),
  }};
}});