Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local keep_running = true
- local block_exists = false
- local block_data_table = {}
- while keep_running do
- block_exists = false
- block_data_table = {}
- if turtle.inspectUp() and turtle.inspect() then
- block_exists, block_data_table = turtle.inspectUp()
- end
- if block_exists and block_data_table["state"]["powered"] then
- block_exists, block_data_table = turtle.inspect()
- -- Prints out something like this:
- -- {
- -- name = "minecraft:wheat",
- -- state = { age = 2, },
- -- }
- print(textutils.serialize(block_data_table))
- -- Prints "minecraft:wheat"
- print(block_data_table["name"])
- -- Prints 2
- print(textutils.serialize(block_data_table["state"]["age"]))
- -- If wheat is fully grown, break it
- if block_data_table["state"]["age"] == 7 then
- turtle.dig()
- end
- else
- print("No block in front of the turtle or lever above isn't on.")
- end
- sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment