Skip to content

Instantly share code, notes, and snippets.

@canassa
Last active December 27, 2016 21:07
Show Gist options
  • Save canassa/3d6426869cdf32ab6e8335ec1b9b46d0 to your computer and use it in GitHub Desktop.
Save canassa/3d6426869cdf32ab6e8335ec1b9b46d0 to your computer and use it in GitHub Desktop.
Automate Reinforced Stone creation using a ComputerCraft Turtle.
local POLLING = 2
local Sand = 'minecraft:sand'
local CFSpray = 'IC2:itemFoamSprayer'
local Scaffold = 'IC2:blockIronScaffold'
local Reinforced = 'IC2:blockAlloy'
local function SelectByName(name)
for i=1,16 do
local detail = turtle.getItemDetail(i)
if detail and detail.name == name then
turtle.select(i)
return true
end
end
return false
end
local function SelectByNameRobust(name)
while not SelectByName(name) do
print("Looking for ", name)
sleep(POLLING)
end
end
while true do
SelectByNameRobust(Scaffold)
turtle.place()
SelectByNameRobust(CFSpray)
if not turtle.place() then
-- Reload
turtle.dropDown()
sleep(10)
turtle.suckDown()
SelectByNameRobust(CFSpray)
turtle.place()
end
SelectByNameRobust(Sand)
turtle.dropUp(1)
while true do
local success, data = turtle.inspect()
if success and data.name == Reinforced then
break
end
sleep(1)
end
turtle.dig()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment