Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- crop = "minecraft:wheat"
- seed = "minecraft:wheat_seeds"
- fertilizer = "Forestry:fertilizerCompound"
- function depoCrops()
- for i = 1,16 do
- if (turtle.getItemDetail(i)) then
- data = turtle.getItemDetail(i)
- if (data.name == crop) then
- turtle.select(i)
- turtle.drop()
- end
- end
- end
- end
- function organize()
- inventory = {}
- for i = 1,16 do
- if (turtle.getItemDetail(i) ~= nil) then
- data = turtle.getItemDetail(i)
- data["slot"] = i
- _match = false
- for key, value in pairs(inventory) do
- if (inventory[key].name == data.name) then
- _match = true
- turtle.select(i)
- turtle.transferTo(inventory[key].slot)
- end
- end
- if (_match == false) then
- table.insert(inventory,data)
- end
- end
- end
- for i = 1,16 do
- if (turtle.getItemDetail(i) == nil) then
- j = 16
- while j > i do
- if (turtle.getItemDetail(j)) then
- turtle.select(j)
- turtle.transferTo(i)
- break
- end
- j = j - 1
- end
- end
- end
- end
- function dropSeeds()
- _match = false
- for i = 1,16 do
- if (turtle.getItemDetail(i)) then
- data = turtle.getItemDetail(i)
- if (data.name == seed) then
- if (_match == false) then
- _match = true
- else
- turtle.select(i)
- turtle.dropDown()
- end
- end
- end
- end
- end
- function refill()
- turtle.select(2)
- for i = 1,3 do
- turtle.suckUp()
- end
- end
- function plant()
- for i = 1,16 do
- if (turtle.getItemDetail(i)) then
- data = turtle.getItemDetail(i)
- if (data.name == seed) then
- turtle.select(i)
- turtle.placeDown()
- break;
- end
- end
- end
- end
- function selectFertilizer()
- for i = 1,16 do
- if (turtle.getItemDetail(i)) then
- data = turtle.getItemDetail(i)
- if (data.name == fertilizer) then
- turtle.select(i)
- break;
- end
- end
- end
- end
- function impregnate()
- if (turtle.inspectDown()) then
- local succ,data = turtle.inspectDown()
- while (data.metadata ~= 7) do
- if (checkFert() == false) then
- refill()
- end
- selectFertilizer()
- turtle.placeDown()
- succ,data = turtle.inspectDown()
- end
- turtle.digDown()
- plant()
- end
- end
- function checkFull()
- _match = true
- for i = 1,16 do
- if (turtle.getItemCount(i) == 0) then
- _match = false
- end
- end
- return _match
- end
- function checkFert()
- _match = false
- for i = 1,16 do
- if (turtle.getItemDetail(i)) then
- data = turtle.getItemDetail(i)
- if (data.name == fertilizer) then
- _match = true
- end
- end
- end
- return _match
- end
- function cleanUp()
- organize()
- dropSeeds()
- depoCrops()
- end
- while true do
- if (checkFull()) then
- cleanUp()
- end
- impregnate()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement