SolarFlare123

Sandwich Maker

Jun 21st, 2025 (edited)
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.61 KB | None | 0 0
  1. function pushIngredient (ingredientName)
  2.     for i,v in ipairs(chest.list()) do
  3.         print("Index=",i," Value=",v)
  4.         if v.name==ingredientName then
  5.             station.pullItems("bottom",i,1)
  6.             return
  7.         end
  8.     end
  9.     print("Try restocking, couldn't find ",ingredientName,"!")
  10. end
  11.  
  12. function makeSandwich (sandwichName, count)
  13.     while count>0 do
  14.         pushIngredient("minecraft:bread")
  15.         if sandwichName=="simple" then
  16.             pushIngredient("minecraft:cooked_chicken")
  17.             pushIngredient("farmers_delight:onion")
  18.             pushIngredient("farmers_delight:tomato")
  19.         end
  20.         if sandwichName=="complex" then
  21.             pushIngredient("minecraft:cooked_chicken")
  22.             pushIngredient("farmers_delight:bacon_and_eggs")
  23.             pushIngredient("farmers_delight:onion")
  24.             pushIngredient("farmers_delight:tomato")
  25.         end
  26.         if sandwichName="super" then
  27.             pushIngredient("minecraft:cooked_chicken")
  28.             pushIngredient("farmers_delight:bacon_and_eggs")
  29.             pushIngredient("farmers_delight:onion")
  30.             pushIngredient("farmers_delight:tomato")
  31.             pushIngredient("create_confectionary:ruby_chocolate")
  32.         end
  33.         count=count-1
  34.     end
  35. end
  36.  
  37. chest=peripheral.wrap("bottom")
  38. station=peripheral.wrap("front")
  39.  
  40. while true do
  41.     print("what kind of sandwich do you want (basic, complex, super), and how many?")
  42.     makeSandwich(read(), read())
  43.     print("finished! All ingredients are counted and supplied into the culinary station.")
  44. end
  45.  
  46. --notes: Double check the mod/item IDs.
Add Comment
Please, Sign In to add comment