Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- chickenslot = 15
- chicken1 = 9
- chicken2 = 10
- seedslot = 14
- chickens = 0
- maintenanceround = 0
- breeddir = 'u' -- dirctions include ('u','d','f')
- seeddir = 'd' -- dirctions include ('u','d','f')
- trashdir = 'f' -- dirctions include ('u','d','f')
- breederpd = 'w' -- the direction that you palced the breeder. only used if wrapping breeder to the front.
- breedbox = 'roost:breeder'
- trashbox = 'cyclicmagic:trash'
- seedbox = 'yabba:item_barrel'
- function seedaction(action)
- if action == 'place' then
- if seeddir == 'd' then
- turtle.placeDown()
- elseif seeddir == 'f' then
- turtle.place()
- elseif seeddir == 'u' then
- turtle.placeUp()
- end
- elseif action == 'break' then
- if seeddir == 'd' then
- turtle.digDown()
- elseif seeddir == 'f' then
- turtle.dig()
- elseif seeddir == 'u' then
- turtle.digUp()
- end
- elseif action == 'pull' then
- if seeddir == 'd' then
- if not turtle.suckDown() then
- print("Out of seeds")
- error()
- end
- elseif seeddir == 'f' then
- if not turtle.suck() then
- print("Out of seeds")
- error()
- end
- elseif seeddir == 'u' then
- if not turtle.suckUp() then
- print("Out of seeds")
- error()
- end
- end
- elseif action == 'push' then
- if seeddir == 'd' then
- turtle.dropDown()
- elseif seeddir == 'f' then
- turtle.drop()
- elseif seeddir == 'u' then
- turtle.dropUp()
- end
- elseif action == 'setup' then
- if seeddir ~= 'd' and seeddir ~= 'f' and seeddir ~= 'u' then
- print("seeddir is set incorrectly.")
- error()
- else
- if seeddir == 'd' then
- stupid, seedcheck = turtle.inspectDown()
- elseif seeddir == 'f' then
- stupid, seedcheck = turtle.inspect()
- else
- stupid, seedcheck = turtle.inspectUp()
- end
- if seedcheck ~= nil then
- if seedcheck.name ~= seedbox then
- seedboxthere = false
- else
- seedboxthere = true
- end
- else
- print("error with seedcheck")
- end
- end
- else
- print('error function seedaction(action), action was unknown')
- error()
- end
- end
- function breedaction(action,fromslot,cap,toslot)
- if action == 'place' then
- if breeddir == 'd' then
- turtle.placeDown()
- breeder = peripheral.wrap("down")
- fromname = 'up'
- elseif breeddir == 'f' then
- turtle.place()
- breeder = peripheral.wrap("front")
- if breederpd == 'w' then
- fromname = 'east'
- elseif breederpd == 'e' then
- fromname = 'west'
- elseif breederpd == 's' then
- fromname = 'north'
- elseif breederpd == 'n' then
- fromname = 'south'
- else
- print("breederpd or breeddir is not set correctly in the config")
- error()
- end
- elseif breeddir == 'u' then
- turtle.placeUp()
- breeder = peripheral.wrap("top")
- fromname = 'down'
- end
- elseif action == 'break' then
- if breeddir == 'd' then
- turtle.digDown()
- elseif breeddir == 'f' then
- turtle.dig()
- elseif breeddir == 'u' then
- turtle.digUp()
- end
- elseif action == 'pull' then
- breeder.pushItems(fromname,fromslot,cap,toslot)
- elseif action == 'push' then
- breeder.pullItems(fromname,fromslot,cap,toslot)
- elseif action == 'setup' then
- if breeddir ~= 'd' and breeddir ~= 'f' and breeddir ~= 'u' then
- print("breeddir is set incorrectly.")
- error()
- else
- if breeddir == 'd' then
- stupid, breedcheck = turtle.inspectDown()
- elseif breeddir == 'f' then
- stupid, breedcheck = turtle.inspect()
- else
- stupid, breedcheck = turtle.inspectUp()
- end
- if breedcheck.name ~= breedbox then
- breedboxthere = false
- else
- if breeddir == 'u' then
- breeder = peripheral.wrap("top")
- fromname = 'down'
- elseif breeddir == 'f' then
- breeder = peripheral.wrap("front")
- if breederpd == 'w' then
- fromname = 'east'
- elseif breederpd == 'e' then
- fromname = 'west'
- elseif breederpd == 's' then
- fromname = 'north'
- elseif breederpd == 'n' then
- fromname = 'south'
- else
- print("breederpd or breeddir is not set correctly in the config")
- error()
- end
- elseif breeddir == 'd' then
- breeder = peripheral.wrap("down")
- fromname = 'up'
- end
- breedboxthere = true
- end
- end
- else
- print('error function breedaction(action), action was unknown')
- error()
- end
- do return end
- end
- function trashaction(action)
- if action == 'place' then
- if trashdir == 'd' then
- turtle.placeDown()
- elseif trashdir == 'f' then
- turtle.place()
- elseif trashdir == 'u' then
- turtle.placeUp()
- end
- elseif action == 'break' then
- if trashdir == 'd' then
- turtle.digDown()
- elseif trashdir == 'f' then
- turtle.dig()
- elseif trashdir == 'u' then
- turtle.digUp()
- end
- elseif action == 'push' then
- if trashdir == 'd' then
- turtle.dropDown()
- elseif trashdir == 'f' then
- turtle.drop()
- elseif trashdir == 'u' then
- turtle.dropUp()
- end
- elseif action == 'setup' then
- if trashdir ~= 'd' and trashdir ~= 'f' and trashdir ~= 'u' then
- print("trashdir is set incorrectly.")
- error()
- else
- if trashdir == 'd' then
- stupid, trashcheck = turtle.inspectDown()
- elseif trashdir == 'f' then
- stupid, trashcheck = turtle.inspect()
- else
- stupid, trashcheck = turtle.Up()
- end
- if trashcheck ~= nil then
- if trashcheck.name == trashbox then
- trashboxthere = true
- end
- end
- end
- else
- print('error function trashaction(action), action was unknown')
- error()
- end
- end
- function getseeds()
- turtle.select(seedslot)
- seedaction("pull")
- end
- function fillseeds()
- if breeddir == 'd' then
- breeder.pullItems('up',seedslot,64,3)
- elseif breeddir == 'f' then
- breeder.pullItems(fromname,seedslot,64,3)
- elseif breeddir == 'u' then
- breeder.pullItems('down',seedslot,64,3)
- else
- print("please fix the breeder location in the config")
- error()
- end
- turtle.select(seedslot)
- seedaction("push")
- do return end
- end
- function program()
- turtle.select(chickenslot)
- if maintenanceround < 16 then
- while not turtle.suckUp() do
- term.clear()
- term.setCursorPos(1,1)
- print("I'm waiting for chickens")
- sleep(1)
- end
- count()
- else
- if breeder.getItemMeta(6) ~= nil then
- while breeder.getItemMeta(6).count < 16 do
- term.clear()
- term.setCursorPos(1,1)
- print("I'm waiting for the 10 10 10 chickens to finish breeding")
- sleep(1)
- end
- print("Finished Breeding")
- error()
- else
- sleep(1)
- getseeds()
- fillseeds()
- program()
- end
- end
- do return end
- end
- function count()
- if chickens == 0 then
- turtle.transferTo(chicken1)
- chickens = chickens + 1
- print("I got one")
- elseif chickens == 1 then
- print("I have 2 chickens")
- turtle.transferTo(chicken2)
- chickens = 0
- reset()
- end
- program()
- end
- function reset()
- if maintenance == true then
- if maintenanceround < 16 then
- breedaction('push',chicken1,16,1)
- breedaction('push',chicken2,16,2)
- getseeds()
- fillseeds()
- end
- maintenanceround = maintenanceround + 1
- else
- breedaction('pull',1,16,1)
- breedaction('pull',2,16,2)
- turtle.select(1)
- trashaction('push')
- turtle.select(2)
- trashaction('push')
- breedaction('push',chicken1,16,1)
- breedaction('push',chicken2,16,2)
- chicken1stats = breeder.getItemMeta(1).roost
- chicken2stats = breeder.getItemMeta(2).roost
- if chicken1stats.gain == 10 and chicken2stats.gain == 10 and chicken1stats.growth == 10 and chicken2stats.growth == 10 and chicken1stats.strength == 10 and chicken2stats.strength == 10 then
- print("Im now breeding 2 tens")
- maintenance = true
- maintenanceround = 1
- else
- print("chicken 1 gain |" .. chicken1stats.gain)
- print("chicken 1 growth |" .. chicken1stats.growth)
- print("chicken 1 strength |" .. chicken1stats.strength)
- print("chicken 2 gain |" .. chicken2stats.gain)
- print("chicken 2 growth |" .. chicken2stats.growth)
- print("chicken 2 strength |" .. chicken2stats.strength)
- end
- getseeds()
- fillseeds()
- end
- end
- function start()
- chickcount = 0
- trashboxthere = false
- seedboxthere = false
- trashactionthere = false
- breedaction('setup')
- seedaction('setup')
- trashaction('setup')
- nostart = false
- for c=1,16 do
- if nostart == false then
- turtle.select(c)
- if turtle.getItemDetail(c) ~= nil then
- sloti = turtle.getItemDetail(c)
- if sloti.name == 'roost:chicken' then
- if chickcount == 0 then
- oslot1 = c
- chickcount = chickcount + 1
- elseif chickcount == 1 then
- oslot2 = c
- chickcount = chickcount + 1
- elseif chickcount >1 then
- print("there are too many chickens in the inventory")
- error()
- end
- elseif sloti.name == 'minecraft:wheat_seeds' then
- if seedboxthere == true then
- seedaction('push')
- else
- foundseedbox = false
- for k=1,16 do
- if turtle.getItemDetail(k) ~= nil then
- seedboxfinder = turtle.getItemDetail(k)
- if seedboxfinder.name == seedbox then
- seedaction('place')
- foundseedbox = true
- end
- end
- end
- if foundseedbox == false then
- print("could not find " .. seedbox)
- error()
- end
- end
- elseif sloti.name == breedbox then
- if breedboxthere == false then
- breedaction('place')
- breedboxthere = true
- else
- turtle.turnRight()
- turtle.turnRight()
- turtle.drop()
- turtle.turnRight()
- turtle.turnRight()
- end
- elseif sloti.name == trashbox then
- if trashboxthere == false then
- trashaction('place')
- trashboxthere = true
- else
- print(trashboxthere)
- turtle.turnRight()
- turtle.turnRight()
- turtle.drop()
- turtle.turnRight()
- turtle.turnRight()
- end
- elseif sloti.name == seedbox then
- if seedboxthere == false then
- seedaction('place')
- seedboxthere = true
- else
- turtle.turnRight()
- turtle.turnRight()
- turtle.drop()
- turtle.turnRight()
- turtle.turnRight()
- end
- else
- turtle.turnRight()
- turtle.turnRight()
- turtle.drop()
- turtle.turnRight()
- turtle.turnRight()
- end
- end
- end
- end
- if chickcount < 2 then
- enoughchickens = false
- if oslot1 ~= nil then
- if turtle.getItemCount(oslot1) > 1 then
- enoughchickens = true
- turtle.select(oslot1)
- if turtle.getItemCount(oslot1) % 2 == 0 then
- if oslot1 == 16 then
- turtle.transferTo((oslot1-1),(turtle.getItemCount(oslot1)/2))
- oslot2 = oslot1-1
- else
- turtle.transferTo((oslot1+1),(turtle.getItemCount(oslot1)/2))
- oslot2 = oslot1+1
- end
- else
- if oslot1 == 16 then
- turtle.transferTo((oslot1-1),((turtle.getItemCount(oslot1)-1)/2))
- oslot2 = oslot1-1
- else
- turtle.transferTo((oslot1+1),((turtle.getItemCount(oslot1)-1)/2))
- oslot2 = oslot1+1
- end
- end
- end
- end
- if enoughchickens == false then
- more = false
- if breeder.getItemMeta(1) ~= nil then
- if breeder.getItemMeta(1).name == "roost:chicken" then
- for i=1,16 do
- turtle.select(i)
- if turtle.getItemDetail() == nil then
- breedaction('pull',1,16,i)
- more = true
- end
- end
- end
- end
- if breeder.getItemMeta(2) ~= nil then
- if breeder.getItemMeta(2).name == "roost:chicken" then
- for i=1,16 do
- turtle.select(i)
- if turtle.getItemDetail() == nil then
- breedaction('pull',2,16,i)
- more = true
- end
- end
- end
- end
- if more == false then
- print("couldn't find enough chickens")
- error()
- else
- start()
- end
- end
- end
- turtle.select(oslot1)
- turtle.transferTo(chicken1)
- turtle.select(oslot2)
- turtle.transferTo(chicken2)
- turtle.select(oslot1)
- turtle.transferTo(chicken1)
- if trashboxthere ~= true or seedboxthere ~= true or breedboxthere ~= true then
- if trashboxthere ~= true then
- print("Trashbox is missing")
- end
- if seedboxthere ~= true then
- print("Seedbox is missing")
- end
- if breedboxthere ~= true then
- print("Breedbox is missing")
- end
- error()
- end
- breedaction("push",chicken1,16,1)
- breedaction("push",chicken2,16,2)
- getseeds()
- fillseeds()
- program()
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment