Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sensor = peripheral.wrap('right')
- local isMoving
- local isStart = true
- local isEnd
- --0.0, y=-3.0, z=1.0
- function init()
- while true do
- while not placeCobbleStone() do
- sleep(3)
- end
- checkFuel()
- moveToEgg()
- turtle.dig()
- returnToBase()
- transferEgg()
- sleep(5)
- end
- end
- function placeCobbleStone()
- if ( turtle.getItemCount(1) > 0 and turtle.getItemDetail(1).name == 'minecraft:cobblestone' ) then
- turtle.select(1)
- return turtle.place()
- else
- error("No Cobblestone")
- end
- end
- function transferEgg()
- if ( turtle.getItemCount(2) > 0 and turtle.getItemDetail(2).name == 'minecraft:dragon_egg' ) then
- turtle.select(2)
- turtle.dropDown()
- else
- error('what the $!@#, there is no egg?!')
- end
- end
- function checkFuel()
- if turtle.getFuelLevel() <= 5 then
- turtle.select(16)
- turtle.refuel(1)
- turtle.select(1)
- end
- end
- function moveToEgg()
- isMoving = true
- turtle.up()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- isMoving = false
- isStart = false
- isEnd = true
- end
- function returnToBase()
- isMoving = true
- turtle.back()
- turtle.back()
- turtle.back()
- turtle.down()
- isMoving = false
- isEnd = false
- isStart = true
- end
- init()
Advertisement
Add Comment
Please, Sign In to add comment