Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x,y,z=1,1,0
- dir=0
- smeltables={
- "minecraft:iron_ore",
- "minecraft:gold_ore",
- "thermalfoundation:ore",
- "railcraft:ore_metal",
- "railcraft:ore_metal_poor"
- }
- barrels={
- "minecraft:cobblestone",
- "minecraft:stone",
- "minecraft:dirt",
- "minecraft:gravel"
- }
- furnaces=5
- function Forward()
- while not turtle.forward() do end
- if (dir%2)==0 then y=y-1+(dir%4)
- else x=x+2-(dir%4)
- end
- end
- function Up()
- while not turtle.up() do end
- z=z+1
- end
- function Down()
- while not turtle.down() do end
- z=z-1
- end
- function Right()
- turtle.turnRight()
- dir=(dir+1)%4
- end
- function Left()
- turtle.turnLeft()
- dir=(dir-1)%4
- end
- function CheckSmeltable(num)
- local data=turtle.getItemDetail(num)
- if data then
- for i=1,#smeltables do
- if data.name==smeltables[i] then return true end
- end
- end
- return false
- end
- function CheckBarrel(num)
- local data=turtle.getItemDetail(num)
- if data then
- for i=1,#barrels do
- if data.name==barrels[i] then return true end
- end
- end
- return false
- end
- function MoveToFurnace(list)
- if #list==0 then return end
- turtle.select(list[1])
- Right() Right() Forward() Left()
- local tries,dropped=0,0
- while dropped<#list do
- for n=1,#list do
- turtle.select(list[n])
- if turtle.dropDown() then dropped=dropped+1 end
- end
- if dropped==#list then break
- elseif tries<furnaces-1 then
- Forward()
- tries=tries+1
- else break
- end
- end
- Right() Right()
- for i=1,tries do Forward() end
- Right() Forward()
- end
- function MoveToChest(list)
- if #list==0 then return end
- Right() Forward()
- local tries,dropped=0,0
- while dropped<#list do
- for n=1,#list do
- turtle.select(list[n])
- if turtle.drop() then dropped=dropped+1 end
- end
- if dropped==#list then break
- else
- Up()
- tries=tries+1
- end
- end
- for i=1,tries do Down() end
- Right() Right() Forward() Right()
- end
- function MoveToBarrel(list)
- if #list==0 then return end
- Right() Forward() Left()
- local tries,dropped=0,0
- while dropped<#list do
- for n=1,#list do
- turtle.select(list[n])
- if turtle.drop() then dropped=dropped+1 end
- end
- if dropped==#list then break
- else
- Up()
- tries=tries+1
- end
- end
- for i=1,tries do Down() end
- Left() Forward() Right()
- end
- while true do
- while turtle.suckDown() do end
- local toChests,toSmelts,toBarrels={},{},{}
- for i=1,16 do
- turtle.select(i)
- if turtle.getItemCount(i)>0 then
- if CheckSmeltable(i) then table.insert(toSmelts,i)
- elseif CheckBarrel(i) then table.insert(toBarrels,i)
- else table.insert(toChests,i)
- end
- end
- end
- turtle.select(1)
- MoveToBarrel(toBarrels)
- MoveToChest(toChests)
- MoveToFurnace(toSmelts)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement