Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- version = "0.1"
- --Var section--
- fuelLevel = 0
- fuelNeeded = 26
- other_crops = {
- "minecraft:wheat",
- "minecraft:potato",
- "minecraft:carrot",
- "minecraft:beetroot"
- }
- ---------------
- function turn()
- if chest_pos == "left" then
- turtle.turnRight()
- elseif chest_pos == "right" then
- turtle.turnLeft()
- end
- end
- function turn2()
- if chest_pos == "left" then
- turtle.turnLeft()
- elseif chest_pos == "right" then
- turtle.turnRight()
- end
- end
- function pumpkin_melon()
- turtle.up()
- turtle.forward()
- local bool, crop = turtle.inspectDown()
- for i = 1, 5 do
- if bool == true then
- if crop.name == "minecraft:melon" or "minecraft:pumpkin" then
- turtle.digDown()
- end
- end
- turtle.forward()
- end
- turn()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turn()
- for i = 1, 6 do
- if bool == true then
- if crop.name == "minecraft:melon" or "minecraft:pumpkin" then
- turtle.digDown()
- end
- end
- turtle.forward()
- end
- turn()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turn()
- turtle.forward()
- turtle.forward()
- turn2()
- --drop off melon or pumpkins--
- for k = 1, 16 do
- local item = turtle.getItemDetail(k)
- if item then
- if item.name == "minecraft:melon" or "minecraft:pumpkin" then
- turtle.select(k)
- turtle.drop()
- end
- end
- end
- turn2()
- turtle.forward()
- turtle.forward()
- turtle.down()
- turn2()
- turn2()
- end
- function other_crop()
- turtle.up()
- turtle.forward()
- local bool, crop = turtle.inspectDown()
- for i = 1, 5 do
- if bool == true then
- for i = 1, #other_crops do
- if crop.name == other_crops[i] and crop.metadata == 7 then
- turtle.digDown()
- end
- end
- end
- turtle.forward()
- end
- turn()
- turtle.forward()
- turn()
- for i = 1, 6 do
- if crop then
- for i = 1, #other_crops do
- if crop.name == other_crops[i] and crop.metadata == 7 then
- other_crop()
- end
- end
- end
- turtle.forward()
- end
- turn2()
- turtle.forward()
- --reached middle of farm
- turtle.forward()
- turn2()
- for i = 1, 5 do
- if crop then
- for i = 1, #other_crops do
- if crop.name == other_crops[i] and crop.metadata == 7 then
- other_crop()
- end
- end
- end
- turtle.forward()
- end
- turn()
- turtle.forward()
- turn()
- for i = 1, 6 do
- if crop then
- for i = 1, #other_crops do
- if crop.name == other_crops[i] and crop.metadata == 7 then
- other_crop()
- end
- end
- end
- turtle.forward()
- end
- turn()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turtle.forward()
- turn()
- turtle.forward()
- turtle.forward()
- turn2()
- --drop off crop--
- for k = 1, 16 do
- local item = turtle.getItemDetail(k)
- if item then
- for i = 1, #other_crops do
- if item.name == other_crops[i] then
- turtle.select(k)
- turtle.drop()
- end
- end
- end
- end
- turn2()
- turtle.forward()
- turtle.forward()
- turtle.down()
- turn2()
- turn2()
- end
- --------------------end functions----------------------
- -------------------CHEST CHECK!!!-----------------------------
- turtle.turnLeft()
- bool, block = turtle.inspect()
- if block.name == "minecraft:chest" then
- chest_pos = "left"
- else
- chest_pos = "right"
- print("Chest is not to the left. Assuming it's to the right.")
- end
- turtle.turnRight()
- --^^^^^^^^^^^^^^^^^CHEST CHECK!!!^^^^^^^^^^^^^^^^^^^^^^^^^^^^--
- while true do
- local bool, crop = turtle.inspect()
- if bool == true then
- if crop.name == "minecraft:pumpkin" or "minecraft:melon_block" then
- pumpkin_melon()
- else
- for i = 1, #other_crops do
- if crop.name == other_crops[i] and crop.metadata == 7 then
- other_crop()
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement