Advertisement
Lanzr

alchemist

Dec 5th, 2023 (edited)
750
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.26 KB | None | 0 0
  1. -- user param
  2. local paramNum = 2
  3.  
  4. local s_deployer = "create:deployer"
  5. local s_sto = "minecraft:barrel"
  6. local s_SGS = "back"
  7.  
  8. local p_deployer = peripheral.find(s_deployer)
  9. local p_sto = peripheral.find(s_sto)
  10. local p_SGS = peripheral.wrap(s_SGS)
  11. s_deployer = peripheral.getName(p_deployer)
  12. s_sto = peripheral.getName(p_sto)
  13.  
  14. local nowPos = 1
  15.  
  16. local function lz_brew()
  17.     for i = 2, paramNum + 1, 1 do
  18.         local ret = p_sto.getItemDetail(i)
  19.         if(ret == nil) then
  20.             print("not enough ingredient in slot "..i)
  21.             return nil
  22.         end
  23.         p_sto.pushItems(s_deployer,i,1,1)
  24.         p_SGS.move(2)
  25.         sleep(1)
  26.     end
  27.     return 0
  28. end
  29.  
  30. local function extract_potion()
  31.     local ret = p_sto.getItemDetail(1)
  32.     if(ret == nil or ret < 4) then
  33.         print("not enough bottom size "..ret)
  34.         return nil
  35.     end
  36.     p_sto.pushItems(s_deployer,1,1,4)
  37.     p_SGS.move(10)
  38.     sleep(1)
  39.     return 0
  40. end
  41.  
  42. local function mainloop()
  43.     local ret = true
  44.     while true do
  45.         ret = lz_brew()
  46.         if ret == nil then
  47.             break
  48.         end
  49.         sleep(8)
  50.         ret = extract_potion()
  51.         if ret == nil then
  52.             break
  53.         end
  54.         sleep(1)
  55.     end
  56. end
  57.  
  58.  
  59. mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement