Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var_sleepTimer = .5
- function getBlockName()
- local success,data = turtle.inspect()
- return data.name
- end
- -- function detectSapling()
- -- local success,data = turtle.inspect()
- -- return data.tags["minecraft:saplings"]
- -- end
- function chopWood()
- local loop = true
- while loop do
- if getBlockName() == "myrtrees:rubberwood_log" or getBlockName() == "myrtrees:filled_rubberwood_log" then
- turtle.dig()
- turtle.digUp()
- turtle.up()
- else
- loop = false
- end
- end
- end
- -- MAIN CODE --
- -- Turtle Detect
- while true do
- local success,data = turtle.inspectDown()
- -- if turtle detects a white concrete block below, then turtle moves forward
- if data.name == "minecraft:white_concrete" then
- turtle.forward()
- -- if turtle detects a blue concrete block below, then turtle turns right and attempts chopWood(), turn left and move foward
- elseif data.name == "minecraft:blue_concrete" then
- turtle.turnRight()
- print("Detecting Block...")
- if getBlockName() == "myrtrees:rubberwood_log" or getBlockName() == "myrtrees:filled_rubberwood_log" then
- print("Wood Detected!")
- chopWood()
- end
- print("No Wood Detected")
- print("Going Down!")
- while turtle.inspectDown() == false do
- turtle.down()
- end
- turtle.turnLeft()
- turtle.forward()
- -- if turtle detects a yellow concrete block below, then turtle turns right and moves forward
- elseif data.name == "minecraft:yellow_concrete" then
- turtle.turnRight()
- turtle.forward()
- elseif data.name == "minecraft:red_concrete" then
- turtle.turnRight()
- sleep(600)
- turtle.forward()
- else
- print("Error!")
- end
- sleep(var_sleepTimer)
- term.clear()
- term.setCursorPos(1,1)
- print("Current Fuel: ", turtle.getFuelLevel())
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement