Tuesday, November 19, 2013

Minecraft
ComputerCraft/Feed The Beast Code Tunel 2
THAT CANINDIAN

ComputerCraft is a mod for Minecraft that allows you to program computers called turtles to do work for you. Feed The Beast is a mod pack for Minecraft that has the ComputerCraft mod in it.

This program is kind of like the tunnel program except this one will refuel and place torches. Just place torches in slot 16, and place coal in slot 15. All you have to do is type (program) (length).

local tArgs = {...}
local todo = tonumber(tArgs[1])

function tfuel(amount)
if turtle.getFuelLevel() < 5 then

turtle.select(15)
turtle.refuel(amount)
turtle.select(1)
  end
end

function torch()
turtle.select(16)turtle.turnRight()
turtle.turnRight()
turtle.place()
turtle.select(1)
turtle.turnRight()
turtle.turnRight()
end

local t = 4

for i = 1, todo do

if turtle.detect() == true then
repeat
turtle.dig()
sleep(0.5)
until turtle.detect() == false
tfuel(1)
turtle.forward()

else

tfuel(1)
turtle.forward()
end

if turtle.detectDown() == false then
turtle.select(1)
turtle.placeDown()

end

if turtle.detectUp() == true then
repeat
turtle.digUp()
sleep(0.5)
until turtle.detectUp() == false
tfuel(1)
turtle.up()

else

tfuel(1)
turtle.up()
end

turtle.turnLeft()
if turtle.detect() == true then
turtle.dig()
turtle.turnRight()
turtle.turnRight()

else

turtle.turnRight()
turtle.turnRight()
end

if turtle.detect() == true then
turtle.dig()
tfuel(1)
turtle.down()

else

tfuel(1)
turtle.down()
end

if turtle.detect() == true then
repeat
turtle.dig()
sleep(0.5)
until turtle.detect() == false
turtle.turnLeft()
turtle.turnLeft()

else

turtle.turnLeft()
turtle.turnLeft()
end

if turtle.detect() == true then
repeat
turtle.dig()
sleep(0.5)
until turtle.detect() == false
turtle.turnRight()

else

turtle.turnRight()
end

t = t + 1

if t == 10 then
torch()
t = 0
  end
end

No comments:

Post a Comment