Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local version =
- 3.0
- -- Pri zmene programu je treba na radku 2 zmenit verzi, aby se program automaticky aktualizoval
- -- local code je treba zmenit dle potreby
- --Vize - plán:
- -- Těžba na více stran
- -- Pokládání anchorů a vkládání Ender pearl pro delší těžbu
- -- Využití všech slotů turtly a pokládání méně často Ender Chestky / méně často vyprazdňovat
- -- Enderchestku na druhé straně vyprazdňovat rychleji
- local code = "6sYzpt8X"
- --check version
- term.clear()
- term.setCursorPos(1,1)
- print("Program loading...")
- print("Current version: "..version)
- local updateSite= http.get("http://pastebin.com/raw.php?i="..code)
- updateSite.readLine()
- local newVersion = updateSite.readLine()
- if tonumber(newVersion) > version then
- print("Update required. Updating now...")
- local updateSite = http.get("http://pastebin.com/raw.php?i="..code)
- local siteFile = updateSite.readAll()
- local writeFile = fs.open(shell.getRunningProgram(),"w")
- writeFile.write(siteFile)
- writeFile.close()
- print("The program will now restart your computer.")
- sleep(1)
- os.reboot()
- end
- function start()
- -- start hlavního programu
- while true do
- -- cyklus pro kopani xxx dolu
- -- turtla bude kopat dolů a posílat itemy do EnderChest
- -- před startem je třeba provést ošetření/kontrolu, zda turtla nemá nad sebou Ender Chest, pokud ano, vcucni ji a dej do slotu 3
- -- kontrola je nutná kvůli odhlášení, či restartu serveru
- turtle.select(3)
- local success, data = turtle.inspectUp()
- if success then
- print("Block name: ", data.name)
- dataEnder = data.name
- print("Block metadata: ", data.metadata)
- if dataEnder == "EnderStorage:enderChest" then
- print("Nalezena Ender Chest")
- turtle.digUp()
- end
- end
- --provedeme prvotni refuel, aby Turtla mohla dělat posun
- turtle.select(1)
- turtle.refuel()
- print("Proveden refuel...")
- for a=1,120,1 do
- turtle.select(1)
- turtle.digDown()
- turtle.select(2)
- turtle.dig()
- turtle.down()
- --provedeme kontrolu, zda neni natezen Coal v sl. 1,2
- --pokud je natezen Coal, proved Refuel
- local data1 = turtle.getItemDetail()
- if data1 then
- print("Item name: ", data1.name)
- dataX1 = data1.name
- if dataX1 == "minecraft:coal" then
- print("Nalezen coal. Provedu refuel.")
- turtle.refuel()
- end
- print("Item damage value: ", data1.damage)
- print("Item count: ", data1.count)
- end
- local data2 = turtle.getItemDetail()
- turtle.select(2)
- if data2 then
- print("Item name: ", data2.name)
- dataX2 = data2.name
- if dataX2 == "minecraft:coal" then
- print("Nalezen coal. Provedu refuel.")
- turtle.refuel()
- end
- print("Item damage value: ", data2.damage)
- print("Item count: ", data2.count)
- end
- turtle.select(3)
- -- Enderchest musi byt umistena ve slotu 3
- --poloz Ender Chest a Slot 1,2 vyprazdni do Ender Chest
- turtle.placeUp()
- turtle.select(1)
- turtle.dropUp()
- turtle.select(2)
- turtle.dropUp()
- --vrat Ender Chest do slotu 3
- turtle.select(3)
- turtle.digUp()
- a=a+1
- print(a)
- end
- turtle.forward()
- --vyjedeme pro jistotu o 5 výše kvuli bedrocku
- turtle.up()
- turtle.up()
- turtle.up()
- turtle.up()
- turtle.up()
- --otocime Turtlu doprava a dig, a popojedeme dopredu,aby nejela nahoru naprazdno
- --turtle.turnRight()
- turtle.dig()
- turtle.forward()
- a=0
- print("Jedu nahoru")
- -- cyklus pro vraceni
- for a=1,115,1 do
- turtle.select(1)
- turtle.digUp()
- turtle.select(2)
- turtle.dig()
- --provedeme kontrolu, zda neni natezen Coal v sl. 1,2
- --pokud je natezen Coal, proved Refuel
- local data1b = turtle.getItemDetail()
- turtle.select(1)
- if data1b then
- print("Item name: ", data1b.name)
- dataX1b = data1b.name
- if dataX1b == "minecraft:coal" then
- print("Nalezen coal. Provedu refuel.")
- turtle.refuel()
- end
- print("Item damage value: ", data1b.damage)
- print("Item count: ", data1b.count)
- end
- local data2b = turtle.getItemDetail()
- turtle.select(2)
- if data2b then
- print("Item name: ", data2b.name)
- dataX2b = data2b.name
- if dataX2b == "minecraft:coal" then
- print("Nalezen coal. Provedu refuel.")
- turtle.refuel()
- end
- print("Item damage value: ", data2b.damage)
- print("Item count: ", data2b.count)
- end
- turtle.select(3)
- -- Enderchest musi byt umistena ve slotu 3
- --poloz Ender Chest a Slot 1,2 vyprazdni do Ender Chest
- turtle.placeUp()
- turtle.select(1)
- turtle.dropUp()
- turtle.select(2)
- turtle.dropUp()
- --vrat Ender Chest do slotu 3
- turtle.select(3)
- turtle.digUp()
- turtle.up()
- a=a+1
- print(a)
- end
- --opakujeme tezbu v dalsim sloupci
- turtle.dig()
- turtle.forward()
- turtle.dig()
- turtle.forward()
- end
- -- konec hlavního programu
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement