Skip to content

Instantly share code, notes, and snippets.

@MaPePeR
Last active August 29, 2015 13:58
Show Gist options
  • Save MaPePeR/10006516 to your computer and use it in GitHub Desktop.
Save MaPePeR/10006516 to your computer and use it in GitHub Desktop.
Computercraft Crafting Turtle Program to craft 2x2 Items like Broken/Crushed/Pulverized Ore
-- Chest Setup:
-- Top = Output Chest. Crafted Items Go here
-- Front = Buffer Chest. Turtle will store items there, that it can not yet craft.
-- Below = Input Chest. Put 2x2 Craftable Stuff there.
-- Assumes that One Stack of Input will yield less than one stack.
bufferCell = 13
craftingCell = 16
-- Drop any items not yet crafted down.
for k,i in pairs({1,2,5,6,bufferCell, (bufferCell + 1)}) do
turtle.select(i)
turtle.dropDown()
end
-- Drop Output Items up
for k,i in pairs({craftingCell}) do
turtle.select(i)
turtle.dropUp()
end
while true do
turtle.select(bufferCell)
turtle.dropDown()
if not turtle.suckDown() then
while turtle.suck() do
turtle.dropDown()
end
else
numberOf = turtle.getItemCount(bufferCell)
if numberOf >= 4 then
amount = numberOf / 4
turtle.transferTo(1,amount)
turtle.transferTo(2,amount)
turtle.transferTo(5,amount)
turtle.transferTo(6,amount)
turtle.drop()
turtle.select(craftingCell)
-- Should be empty!
turtle.craft()
turtle.dropUp()
else
turtle.suckDown()
turtle.drop()
turtle.select(bufferCell + 1)
turtle.dropDown()
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment