Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SLOT_COUNT = 16
- function getItemIndex(itemName)
- for slot = 1, SLOT_COUNT, 1 do
- local item = turtle.getItemDetail(slot)
- if (item ~= nil) then
- if(item["name"] ==itemName) then
- return slot
- end
- end
- end
- end
- function getPreferred(low, high)
- local wheatCount = turtle.getItemCount(getItemIndex("minecraft:wheat"))
- if wheatCount < low and turtle.suckUp() == false then
- return false
- end
- if wheatCount < high and turtle.suckUp() == true then
- return false
- end
- if wheatCount > low and turtle.suckUp() == false then
- return true
- end
- if wheatCount <= high then
- return true
- end
- end
- function bakeBread()
- while true do
- local wheatIndex = getItemIndex("minecraft:wheat")
- local breadIndex = getItemIndex("minecraft:bread")
- if wheatIndex == nil then
- repeat
- turtle.suckUp()
- until getPreferred(3, 64)
- end
- wheatIndexGlobal = turtle.getItemCount(wheatIndex)
- for i = 1, 3, 1 do
- local selectIndex = 4 + i
- turtle.select(wheatIndex)
- turtle.transferTo(selectIndex, 21)
- end
- if wheatIndex ~= nil then
- repeat
- turtle.select(wheatIndex)
- turtle.dropUp()
- until wheatIndex == nil
- end
- turtle.craft()
- if breadIndex ~= nil then
- turtle.select(breadIndex)
- turtle.dropUp()
- end
- end
- end
- while true do
- bakeBread()
- end
Add Comment
Please, Sign In to add comment