Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if fs.exists("event")==false then shell.run("pastebin get UKPy4iiE event") end
- if os.loadAPI("event") == false then error("Failed to load event API") end
- if fs.exists("utils") == false then shell.run("pastebin get dyvydHtK utils") end
- if os.loadAPI("utils") == false then error("Failed to load utils API") end
- if fs.exists("data") == false then shell.run("pastebin get LnvzL7ur data") end
- if os.loadAPI("data") == false then error("Failed to load data API") end
- if fs.exists("button") == false then shell.run("pastebin get UmerzDUF button") end
- if os.loadAPI("button") == false then error("Failed to load button API") end
- local monitor
- local ultraButton
- local quickButton
- function attachMonitor()
- monitor = peripheral.wrap("top")
- button.setMonitor(monitor)
- end
- function ultra()
- local discard = "pixelmon:item.Blue_Apricorn"
- getItems(discard)
- turtle.down()
- turtle.down()
- end
- function quick()
- local discard = "pixelmon:item.Black_Apricorn"
- getItems(discard)
- turtle.down()
- turtle.down()
- turtle.turnRight()
- turtle.turnRight()
- end
- function getItems(discard)
- turtle.turnRight()
- turtle.turnRight()
- for i=1,16 do
- turtle.suck()
- end
- turtle.turnRight()
- turtle.turnRight()
- convertCapricorn(discard)
- local count = fillFurnaces(discard)
- fuelFurnaces(count)
- emptyFurnaces()
- attachMonitor()
- button.drawAllButtons()
- end
- function convertCapricorn(target)
- turtle.down()
- turtle.down()
- for i=1,16 do
- local detail = turtle.getItemDetail(i)
- if detail ~= nil and detail.name == target then
- turtle.select(i)
- for i=1,turtle.getItemCount(i) do
- turtle.place()
- turtle.dig()
- end
- end
- end
- end
- function fillFurnaces(discard)
- local itemCount = 0
- for b=1,4 do
- turtle.back()
- for i=1,16 do
- local detail = turtle.getItemDetail(i)
- if detail ~= nil and detail.name ~= discard and detail.name ~= "minecraft:log" then
- turtle.select(i)
- itemCount = itemCount + math.ceil(turtle.getItemCount(i)/1.5)
- turtle.dropDown(22)
- break
- end
- end
- end
- for i=1,4 do
- turtle.forward()
- end
- return itemCount
- end
- function fuelFurnaces(count)
- turtle.down()
- turtle.down()
- for i=1,16 do
- local detail = turtle.getItemDetail(i)
- if detail ~= nil and detail.name == "minecraft:log" then
- turtle.select(i)
- turtle.transferTo(6)
- end
- end
- turtle.select(1)
- turtle.craft()
- for b=1,4 do
- turtle.back()
- for i=1,16 do
- local detail = turtle.getItemDetail(i)
- if detail ~= nil and detail.name == "minecraft:planks" then
- turtle.select(i)
- turtle.dropUp(count)
- break
- end
- end
- end
- turtle.turnRight()
- turtle.turnRight()
- for i=1,16 do
- if turtle.getItemCount(i)>0 then
- turtle.select(i)
- turtle.drop()
- break
- end
- end
- sleep(22*10)
- end
- function emptyFurnaces()
- turtle.suckUp()
- for i=1,3 do
- turtle.back()
- turtle.suckUp()
- end
- for i=1,3 do
- turtle.forward()
- end
- turtle.turnRight()
- for i=1,16 do
- if turtle.getItemCount(i)>0 then
- turtle.select(i)
- turtle.drop()
- end
- end
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.up()
- turtle.up()
- turtle.up()
- turtle.up()
- end
- function clicked(button)
- if button == ultraButton then
- ultra()
- elseif button == quickButton then
- quick()
- end
- end
- function init()
- attachMonitor()
- ultraButton = button.addButton(0,0,1.1,0.5,"Ultra ball",false,true)
- quickButton = button.addButton(0,0.5,1.1,0.5,"Quick ball",false,true)
- event.addHandler("onButtonClick",clicked)
- while true do
- event.handleCCEvents()
- end
- end
- init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement