--Croptia Supreme Pizza local ingredientsName = "quark:variant_chest_2" local utensilsName = "quark:variant_chest_1" local resultStorageName = "quark:variant_chest_4" local turtleName = "turtle_1" local crate = peripheral.wrap(ingredientsName) local utensils = peripheral.wrap(utensilsName) local resultStorage = peripheral.wrap(resultStorageName) local invSlot = 1 rednet.open("top") function craft() rednet.send(3, "craft", "Gordon Ramsitron") local msg repeat local sender, msg, prtc = rednet.receive("Gordon Ramsitron") until msg == "done" end function clean() rednet.send(3, "clean", "Gordon Ramsitron") local msg repeat local sender, msg, prtc = rednet.receive("Gordon Ramsitron") until msg == "done" for i=1,16,1 do returnUtensil(i) end end function get(itemName) local count = 0 for i = 1, crate.size(), 1 do count = count+1 local item = crate.getItemDetail(i) if item~= nil and item.name==itemName then if item.count > 1 then crate.pushItems(turtleName,i,1, invSlot) end break end end if invSlot ~= 3 and invSlot ~=7 and invSlot ~=9 then invSlot = invSlot + 1 else invSlot = invSlot + 2 end end function returnItem(slot) crate.pullItems(turtleName, slot) invSlot = 1 end function getUtensil(itemName) count = 0 for i = 1, utensils.size(), 1 do count = count+1 local item = utensils.getItemDetail(i) if item~= nil and item.name==itemName then utensils.pushItems(turtleName,i,1, invSlot) break end end if invSlot ~= 3 and invSlot ~=7 and invSlot ~=11 then invSlot = invSlot + 1 else invSlot = invSlot + 2 end end function returnUtensil(slot) utensils.pullItems(turtleName, slot) invSlot = 1 end function check(itemName) local first = true while true do count = 0 for i = 1, crate.size(), 1 do count = count+1 local item = crate.getItemDetail(i) if item~= nil and item.name==itemName and item.count>1 then return true end end if first then first = false print("Waiting for "..itemName.."...") end end end function checkCompound(itemName) for i = 1, crate.size(), 1 do local item = crate.getItemDetail(i) if item~= nil and item.name==itemName then if item.count>1 then return true end return false end end return false end function craftFlour() print("Crafting Flour...") check("croptopia:oat") get("croptopia:oat") check("croptopia:oat") get("croptopia:oat") craft() os.sleep(0.2) returnItem(1) end function craftDough() print("Crafting Dough...") if not checkCompound("croptopia:flour") then craftFlour() end check("croptopia:water_bottle") getUtensil("croptopia:cooking_pot") get("croptopia:flour") get("croptopia:water_bottle") craft() os.sleep(0.2) returnItem(2) returnUtensil(1) end function craftTofu() print("Crafting Tofu...") check("croptopia:soybean") check("croptopia:water_bottle") getUtensil("croptopia:cooking_pot") get("croptopia:water_bottle") get("croptopia:soybean") craft() os.sleep(0.2) returnItem(2) returnUtensil(1) end function craftCheese() print("Crafting Cheese...") check("croptopia:salt") check("croptopia:milk_bottle") getUtensil("croptopia:cooking_pot") get("croptopia:milk_bottle") get("croptopia:salt") os.sleep(0.2) craft() returnItem(2) returnUtensil(1) end function craftPizza() print("Crafting Pizza...") if not checkCompound("croptopia:dough") then craftDough() end if not checkCompound("croptopia:cheese") then craftCheese() end if not checkCompound("croptopia:tofu") then craftTofu() end check("farmersdelight:tomato") check("croptopia:bellpepper") check("croptopia:olive") getUtensil("croptopia:frying_pan") get("croptopia:dough") get("croptopia:cheese") get("croptopia:tofu") get("farmersdelight:tomato") get("croptopia:bellpepper") get("croptopia:olive") os.sleep(0.2) craft() returnItem(2) returnUtensil(1) print("Ding! Pizza Crafted!") end function work() local count = 0 for i = 1, crate.size(), 1 do count = count+1 local item = crate.getItemDetail(i) if item~= nil and item.name=="harvestcraft:meatfeastpizzaitem" then if item.count < 64 then craftMeatFeastPizza() end crate.pushItems("east",i,1) break end end end clean() while true do if crate.getItemDetail(11).count < 64 then craftPizza() crate.pushItems(resultStorageName, 11, crate.getItemDetail(11).count-1) end os.sleep(0.05) end