Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ###########################
- -- auto_craft
- -- version 0.2.1
- -- http://hevohevo.hatena.com/
- -- ###########################
- -- ###########################
- -- Turtle position (Side view)
- -- T: crafty turtle, M: chest for materials, P: chest for products
- -- M
- -- T
- -- P
- -- ###########################
- -- config
- MATERIAL_SLOT = 1
- PRODUCT_SLOT = 4
- -- ###########################
- -- functions
- function dropItems(begin_slot, end_slot)
- print('drop items: slots ',begin_slot,'-',end_slot)
- for i=begin_slot, end_slot do
- turtle.select(i)
- turtle.dropDown()
- end
- turtle.select(1)
- end
- function getMaterials()
- turtle.select(MATERIAL_SLOT)
- if turtle.getItemCount(MATERIAL_SLOT) ==0 and turtle.suckUp() then
- print(' Success: suckUp')
- return true
- else
- print(' Failed: suckUp')
- return false
- end
- end
- function craft1x1()
- -- repeat 1x1-craft while material > 0
- while turtle.getItemCount(MATERIAL_SLOT) >0 do
- if turtle.craft(0) == false then break end
- turtle.select(PRODUCT_SLOT)
- turtle.craft()
- turtle.dropDown()
- end
- end
- -- ###########################
- -- main
- dropItems(1,16)
- while getMaterials() do
- craft1x1()
- dropItems(1,4)
- end
- dropItems(1,16)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement