Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- itemList={} --table of item locations, you'll want to edit this to fit your layout
- itemList[1]={glass=1 , sandstone2=2 , sandstone3=3 , sapling=4 , sapling2=5 , sapling3=6 , sapling4=7 , obsidian=8 }
- itemList[2]={flint=1 ,coal=2 ,reed=3 ,stick=4 ,cactus=5 ,glowstone=6 ,netherack=7 ,soulsand=8 }
- itemList[3]={saltpeter=1 ,sulfur=2 ,copper=3 ,tin=4 ,apatite=5 ,netherbrick=6 ,gold=7 ,grassblock=8 }
- itemList[4]={charcoal=1 ,emerald=2 ,stonebrick=3 ,mossystonebrick=4 ,crackedstonebrick=5 ,stone=6 ,mossycobble=7 ,woodenplanks=8 }
- itemList[5]={wood=1 ,iron=2 ,sand=3 ,gravel=4 ,sandstone=5 ,redstone=6 ,diamond=7 ,lapis=8 }
- itemList[6]={wood2=1 ,wood3=2 ,wood4=3 ,woodenplanks4=4 ,woodenplanks3=5 ,woodenplanks2=6 ,dirt=7 ,cobble=8 }
- Recipe={ --these are the recipes, add your own using this formula, where the number is slot number. If a slot should be empty, use "air"
- furnace = {
- [1] = "cobble" ,
- [2] = "cobble" ,
- [3] = "cobble" ,
- [5] = "cobble" ,
- [6] = "air" ,
- [7] = "cobble" ,
- [9] = "cobble" ,
- [10] = "cobble" ,
- [11] = "cobble"
- },
- diamond_pick = {
- [1] = "diamond" ,
- [2] = "diamond" ,
- [3] = "diamond" ,
- [5] = "air" ,
- [6] = "stick" ,
- [7] = "air" ,
- [9] = "air" ,
- [10] = "stick" ,
- [11] = "air"
- },
- piston = {
- [1] = "woodenplanks" ,
- [2] = "woodenplanks" ,
- [3] = "woodenplanks" ,
- [5] = "cobble" ,
- [6] = "iron" ,
- [7] = "cobble" ,
- [9] = "cobble" ,
- [10] = "redstone" ,
- [11] = "cobble"
- },
- chest = {
- [1] = "woodenplanks" ,
- [2] = "woodenplanks" ,
- [3] = "woodenplanks" ,
- [5] = "woodenplanks" ,
- [6] = "air" ,
- [7] = "woodenplanks" ,
- [9] = "woodenplanks" ,
- [10] = "woodenplanks" ,
- [11] = "woodenplanks"
- },
- iron_pick = { --no spaces!
- [1] = "iron" ,
- [2] = "iron" ,
- [3] = "iron" ,
- [5] = "air" ,
- [6] = "stick" ,
- [7] = "air" ,
- [9] = "air" ,
- [10] = "stick" ,
- [11] = "air"
- },
- stone_pick = {
- [1] = "cobble" ,
- [2] = "cobble" ,
- [3] = "cobble" ,
- [5] = "air" ,
- [6] = "stick" ,
- [7] = "air" ,
- [9] = "air" ,
- [10] = "stick" ,
- [11] = "air"
- },
- torch = {
- [1] = "air" ,
- [2] = "air" ,
- [3] = "air" ,
- [5] = "air" ,
- [6] = "coal" ,
- [7] = "air" ,
- [9] = "air" ,
- [10] = "stick" ,
- [11] = "air"
- }
- }
- local args={ ... } --gets and sets inputs
- local input=args[1]
- local amount=args[2] --might not use
- if amount==nil then --defaults to 1 if no number entered (you can change if you want)
- amount=1
- print("No amount given. Defaulting to "..amount)
- end
- local xpos=8 --sets default position
- local ypos=6
- turtle.forward() --gets in place
- turtle.forward()
- turtle.turnRight()
- function GoTo(items) --goes to items location
- if items~=nil then
- for i=1,6 do
- if itemList[i][items]~=nil then --sets x and y depending on the item inputted
- x=itemList[i][items]
- y=i
- end
- end
- if x==nil then x=xpos end --these make it so the turtle will stay put if it doesn't understand
- if y==nil then y=ypos end
- turtle.turnRight()
- while x>xpos do --these loops will get the turtle to the right location
- turtle.forward()
- xpos=xpos+1
- end
- while xpos>x do
- turtle.back()
- xpos=xpos-1
- end
- while ypos>y do
- turtle.up()
- ypos=ypos-1
- end
- while y>ypos do
- turtle.down()
- ypos=ypos+1
- end
- turtle.turnLeft()
- end
- end
- function Retrieve(x) --grabs the correct amount of items
- turtle.suck()
- if turtle.getItemCount(x)-amount <=0 then
- turtle.suck()
- end
- turtle.drop(turtle.getItemCount(x)-amount)
- end
- function Decode() --does the work
- for i=1,3 do --goes through each slot and grabs neccisary items
- if Recipe[input][i] ~="air" then
- turtle.select(i)
- GoTo(Recipe[input][i])
- Retrieve(i)
- end
- end
- for i=5,7 do
- if Recipe[input][i] ~="air" then
- turtle.select(i)
- GoTo(Recipe[input][i])
- Retrieve(i)
- end
- end
- for i=9,11 do
- if Recipe[input][i] ~="air" then
- turtle.select(i)
- GoTo(Recipe[input][i])
- Retrieve(i)
- end
- end
- end
- Decode()
- turtle.craft()
- GoTo("cobble") --goes back to beginning and drops left
- turtle.turnLeft()
- turtle.back()
- turtle.back()
- turtle.turnLeft()
- turtle.drop()
- turtle.turnRight()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement