Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Chicken Breeder 101010
- Author - u/MistbornKnives
- breeds a full stack of perfect chickens.
- --]]
- OPTIONS = {'top', 'bottom', 'front'}
- -- configure block location here:
- local BREEDER_SIDE = 'top'
- local DUMP_SIDE = 'bottom'
- local STORAGE_SIDE = 'front'
- local arg = { ... }
- for _,v in pairs(OPTIONS) do
- if arg[1] == v then BREEDER_SIDE = v end
- if arg[2] == v then DUMP_SIDE = v end
- if arg[3] == v then STORAGE_SIDE = v end
- end
- local function main()
- init()
- local seeds_used = 0
- repeat
- if BREEDER.getItemDetail(3) == nil then
- print('Waiting for seeds')
- while BREEDER.getItemDetail(3) == nil do
- select_seeds()
- DROP()
- sleep()
- end
- end
- turtle.select(1)
- -- wait for new chicken
- while not SUCK() do sleep() end
- reset()
- seeds_used = seeds_used + 1
- print(seeds_used)
- local slot_one = BREEDER.getItemDetail(1).count
- local slot_two = BREEDER.getItemDetail(2).count
- until slot_one + slot_two >= 16
- DIG()
- print('chickens finished')
- end
- function init()
- turtle.select(1)
- while SUCK() do end
- STORAGE = peripheral.wrap(STORAGE_SIDE)
- reset()
- reset()
- BREEDER = peripheral.wrap(BREEDER_SIDE)
- end
- function reset()
- turtle.select(1)
- DIG()
- select_item('chickens:breeder')
- while not PLACE() do sleep() end
- select_seeds()
- DROP()
- select_item('chickens:chicken_item')
- DROP(math.ceil(turtle.getItemDetail().count / 2))
- drop_in_slot_2()
- while select_item('chickens:chicken_item') do
- DROP()
- DUMP()
- end
- end
- function drop_in_slot_2()
- if not DETECT() then
- print('Waiting for storage device on side: ' .. STORAGE_SIDE)
- repeat sleep() until DETECT()
- STORAGE = peripheral.wrap(STORAGE_SIDE)
- print('Resuming')
- end
- DETECT()
- STORE()
- STORAGE.pushItems(BREEDER_SIDE, 1, 16, 2)
- end
- function select_item(name)
- for i = 1, 16, 1 do
- if turtle.getItemDetail(i) then
- if turtle.getItemDetail(i).name == name then
- turtle.select(i)
- return i
- end
- end
- end
- return false
- end
- function select_seeds()
- select_item('minecraft:wheat_seeds')
- select_item('minecraft:pumpkin_seeds')
- select_item('minecraft:melon_seeds')
- select_item('minecraft:beetroot_seeds')
- select_item('immersiveengineering:seed')
- select_item('farmersdelight:cabbage_seeds')
- select_item('farmersdelight:tomato_seeds')
- select_item('supplementaries:flax_seeds')
- select_item('farmersdelight:rice')
- select_item('ars_nouveau:magebloom_crop')
- end
- function sleep()
- os.sleep(0.05)
- end
- -- assign directional turtle functions
- if BREEDER_SIDE == 'top' then
- DROP = turtle.dropUp
- PLACE = turtle.placeUp
- DIG = turtle.digUp
- SUCK = turtle.suckUp
- elseif BREEDER_SIDE == 'bottom' then
- DROP = turtle.dropDown
- PLACE = turtle.placeDown
- DIG = turtle.digDown
- SUCK = turtle.suckDown
- else
- DROP = turtle.drop
- PLACE = turtle.place
- DIG = turtle.dig
- SUCK = turtle.suck
- end
- if DUMP_SIDE == 'top' then
- DUMP = turtle.dropUp
- elseif DUMP_SIDE == 'bottom' then
- DUMP = turtle.dropDown
- else DUMP = turtle.drop
- end
- if STORAGE_SIDE == 'top' then
- STORE = turtle.dropUp
- DETECT = turtle.detectUp
- elseif STORAGE_SIDE == 'bottom' then
- STORE = turtle.dropDown
- DETECT = turtle.detectDown
- else
- STORE = turtle.drop
- DETECT = turtle.detect
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment