SolarFlare123

Sandwich Maker

Jun 21st, 2025 (edited)
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.85 KB | None | 0 0
  1. function pushIngredient (ingredientName)
  2.     if going==true then
  3.         for i,v in ipairs(chest.list()) do
  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.         going=false
  11.         removeIngredients()
  12.     end
  13. end
  14.  
  15. function removeIngredients ()
  16.     chest.pullItems("front",1)
  17.     chest.pullItems("front",2)
  18.     chest.pullItems("front",3)
  19.     chest.pullItems("front",4)
  20.     chest.pullItems("front",5)
  21.     chest.pullItems("front",6)
  22. end
  23.  
  24. function makeSandwich (sandwichName, count)
  25.     going=true
  26.     while count>0 do
  27.         pushIngredient("minecraft:bread")
  28.         if sandwichName=="simple" then
  29.             pushIngredient("minecraft:cooked_chicken")
  30.             pushIngredient("farmersdelight:onion")
  31.             pushIngredient("farmersdelight:tomato")
  32.         end
  33.         if sandwichName=="complex" then
  34.             pushIngredient("minecraft:cooked_chicken")
  35.             pushIngredient("farmersdelight:bacon_and_eggs")
  36.             pushIngredient("farmersdelight:onion")
  37.             pushIngredient("farmersdelight:tomato")
  38.         end
  39.         if sandwichName=="super" then
  40.             pushIngredient("minecraft:cooked_chicken")
  41.             pushIngredient("farmersdelight:bacon_and_eggs")
  42.             pushIngredient("farmersdelight:onion")
  43.             pushIngredient("farmersdelight:tomato")
  44.             pushIngredient("create_confectionery:bar_of_ruby_chocolate")
  45.         end
  46.         count=count-1
  47.     end
  48.     going=false
  49. end
  50.  
  51. chest=peripheral.wrap("bottom")
  52. station=peripheral.wrap("front")
  53. going=false
  54.  
  55. while true do
  56.     print("what kind of sandwich do you want (simple, complex, super), and how many?")
  57.     makeSandwich(read(), tonumber(read()))
  58.     print("Finished!")
  59. end
Add Comment
Please, Sign In to add comment