Last active
August 29, 2015 13:58
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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