Advertisement
DaikiKaminari

WitcheryCauldron

Jul 17th, 2020
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. --- CONFIG ---
  2. local delay = 20 -- int : minimum delay between 2 crafts
  3. local inputChestSide = "top" -- string : side where is the input chest
  4. local inputChest -- table : peripheral, input chest
  5. local outputChestSide = "up" -- string : side where is the output chest compared to input chest
  6. local redstoneSide = "front" -- string : side where redstoen should be input
  7. --local cauldronSide = "right" -- sting : side where the cauldron is
  8. local cauldron -- table : peripheral, cauldron
  9.  
  10. --- FUNCTIONS ---
  11. local function loadAPI()
  12. if not fs.exists("lib/inventory") then
  13. error("File not found : [lib/inventory]")
  14. end
  15. os.loadAPI("lib/inventory")
  16. end
  17.  
  18. local function init()
  19. inputChest = peripheral.wrap(inputChestSide)
  20. if inputChest == nil then
  21. error("No container found on side : [" .. inputChestSide .. "]")
  22. end
  23. cauldron = peripheral.find("witchery_cauldron")
  24. if cauldron == nil then
  25. error("No cauldron found.")
  26. end
  27. end
  28.  
  29. local function process()
  30. if inventory.containsItem(inputChest) and
  31. redstone.getInput(redstoneSide) and
  32. cauldron.getTankInfo()["contents"]["name"] == "water" then
  33. inventory.moveAllItems(inputChest, outputChestSide, 1)
  34. end
  35. end
  36.  
  37. --- MAIN ---
  38. local function main()
  39. loadAPI()
  40. init()
  41. while true do
  42. process()
  43. sleep(1)
  44. end
  45. end
  46.  
  47. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement