Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- CONFIG ---
- local delay = 20 -- int : minimum delay between 2 crafts
- local inputChestSide = "top" -- string : side where is the input chest
- local inputChest -- table : peripheral, input chest
- local outputChestSide = "up" -- string : side where is the output chest compared to input chest
- local redstoneSide = "front" -- string : side where redstoen should be input
- --local cauldronSide = "right" -- sting : side where the cauldron is
- local cauldron -- table : peripheral, cauldron
- --- FUNCTIONS ---
- local function loadAPI()
- if not fs.exists("lib/inventory") then
- error("File not found : [lib/inventory]")
- end
- os.loadAPI("lib/inventory")
- end
- local function init()
- inputChest = peripheral.wrap(inputChestSide)
- if inputChest == nil then
- error("No container found on side : [" .. inputChestSide .. "]")
- end
- cauldron = peripheral.find("witchery_cauldron")
- if cauldron == nil then
- error("No cauldron found.")
- end
- end
- local function process()
- if inventory.containsItem(inputChest) and
- redstone.getInput(redstoneSide) and
- cauldron.getTankInfo()["contents"]["name"] == "water" then
- inventory.moveAllItems(inputChest, outputChestSide, 1)
- end
- end
- --- MAIN ---
- local function main()
- loadAPI()
- init()
- while true do
- process()
- sleep(1)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement