Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function select_fuel()
- local slot = 1
- local data = turtle.getItemDetail(slot)
- while slot <= 16 do
- if data and (data.name == "minecraft:lava_bucket" or data.name == "minecraft:coal" or data.name == "minecraft:planks" or data.name == "minecraft:log") then
- break
- end
- slot = slot + 1
- if slot <= 16 then
- turtle.select(slot)
- data = turtle.getItemDetail(slot)
- end
- end
- if (slot > 16) then
- print("Refuel me sempaiiiiii !")
- sleep(5)
- os.shutdown()
- end
- turtle.select(slot)
- end
- function check_fuel()
- if turtle.getFuelLevel() < 10 then
- select_fuel()
- if turtle.refuel(1) == false then
- print("Refuel me sempaiiiiii !")
- os.shutdown()
- end
- end
- end
- function select_seed()
- local slot = 1
- while slot <= 16 do
- local data = turtle.getItemDetail(slot)
- if data and data.name == "minecraft:wheat_seeds" then
- turtle.select(slot)
- return true
- end
- slot = slot + 1
- end
- return false
- end
- function ble_mature()
- local success, data = turtle.inspect()
- if success and data.name == "minecraft:wheat" and data.metadata == 7 then return true else return false end
- end
- function craft_bread()
- local slot = 1
- while slot <= 16 and turtle.getItemDetail(slot) do
- slot = slot + 1
- end
- if slot <= 16 then
- turtle.select(slot)
- turtle.craft()
- end
- turtle.select(1)
- end
- function put_product_in_chest()
- local slot = 1
- local flag = false
- while slot <= 16 do
- local data = turtle.getItemDetail(slot)
- if data and (data.name == "minecraft:bread" or (data.name == "minecraft:wheat_seeds" and flag == true)) then
- turtle.select(slot)
- turtle.drop()
- elseif data and data.name == "minecraft:wheat_seeds" then
- flag = true
- end
- slot = slot + 1
- end
- end
- while true do
- local x = 0
- while x < 6 do
- check_fuel()
- if ble_mature() then turtle.dig() end
- if select_seed() then turtle.place() end
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- x = x + 1
- end
- if ble_mature() then turtle.dig() end
- if select_seed() then turtle.place() end
- turtle.turnLeft()
- turtle.turnLeft()
- while x > 0 do
- check_fuel()
- if ble_mature() then turtle.dig() end
- if select_seed() then turtle.place() end
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- x = x - 1
- end
- check_fuel()
- turtle.forward()
- craft_bread()
- put_product_in_chest()
- craft_bread()
- put_product_in_chest()
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- sleep(400)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement