Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("left")
- function bucher(arbres)
- local ok = 0
- local leaves = 0
- turtle.turnLeft()
- forwarding()
- for j=1, arbres do
- for i=1,5 do
- while not turtle.forward() and not turtle.inspect() do
- os.sleep(0.5)
- end
- end
- turtle.turnLeft()
- while ok==0 do --boucle pour bucher l'arbre
- s, data = turtle.inspect()
- if data.name ~= "minecraft:log"
- then ok = 1
- else turtle.select(5)
- turtle.dig()
- rednet.send(27,"1", "bois")
- ls, ldata = turtle.inspectUp()
- turtle.digUp()
- while not turtle.up() and not ls do
- os.sleep(0.5)
- end
- end
- end
- ok = 0
- while ok==0 do --boucle de descente
- gs, gdata = turtle.inspectDown()
- if gdata.name == "chisel:stonebrick" then ok = 1
- else turtle.down() end
- end
- turtle.select(2)
- turtle.place()
- turtle.turnRight()
- end
- forwarding()
- --s, data = turtle.inspect()
- --while not turtle.forward() and not s do
- --os.sleep(0.5)
- --end
- end
- function chemin(moves)
- for i=1, moves do
- forwarding()
- --s, data = turtle.inspect()
- --while not turtle.forward() and not s do
- --os.sleep(0.5)
- --end
- end
- end
- function chest()
- for i=5, 16 do
- turtle.select(i)
- data = turtle.getItemDetail()
- if data then
- if data.name == "minecraft:log"
- then turtle.dropUp()
- else i=17 end
- end
- end
- turtle.select(2)
- turtle.suckUp()
- turtle.select(1)
- if turtle.getItemCount() < 34 then turtle.suck(34-turtle.getItemCount(1)) end
- turtle.turnRight()
- forwarding()
- --ps = turtle.inspect()
- --while not turtle.forward() and not ps do
- --os.sleep(0.5)
- --end
- turtle.turnLeft()
- chemin(5)
- end
- function forwarding()
- s = turtle.detect()
- while not turtle.forward() and not s do
- os.sleep(0.5)
- end
- end
- while true do
- local s, data = turtle.inspect()
- local bs, bdata = turtle.inspectDown()
- local fuel_lvl = turtle.getFuelLevel()
- if fuel_lvl <= 40
- then turtle.select(1)
- turtle.refuel(1) end
- rednet.send(27,fuel_lvl,"fuel")
- if data.name == "minecraft:glowstone" and bdata.name == "chisel:stonebrick"
- then bucher(4)
- end
- if data.name == "chisel:laboratory" and bdata.name == "chisel:stonebrick"
- then turtle.turnRight()
- forwarding()
- turtle.turnLeft()
- chemin(6)
- end
- if data.name == "minecraft:glowstone" and bdata.name == "chisel:laboratory"
- then bucher(2)
- end
- if data.name == "chisel:laboratory" and bdata.name == "minecraft:glowstone"
- then bucher(3)
- end
- if data.name == "minecraft:glowstone" and bdata.name == "chisel:glowstone"
- then bucher(1)
- end
- if data.name == "chisel:glowstone" and bdata.name == "chisel:glowstone"
- then turtle.turnLeft()
- chemin(9)
- end
- if data.name == "chisel:glowstone" and bdata.name == "chisel:laboratory"
- then turtle.turnLeft()
- chemin(14)
- end
- if data.name == "chisel:glowstone" and bdata.name == "minecraft:glowstone"
- then turtle.turnLeft()
- chemin(2)
- end
- if data.name == "minecraft:chest" and bdata.name == "chisel:stonebrick"
- then chest()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement