Monday, November 18, 2013

Minecraft
ComputerCraft/Feed The Beast Code
FLAT LAND / 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 code is a code that I did not make myself, but I thought it was useful and very efficient. This program clears out a flat area for you. All you have to do is type (name of program) (length) (width). You should also put coal in the 16th slot


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

function tfuel(amount)
if turtle.getFuelLevel() < 5 then
turtle.select(16)
turtle.refuel(amount)
turtle.select(1)

  end
end

function upuntil()
local upc = 0
for u = 1, 5 do
repeat
tfuel(1)
turtle.digUp()
if turtle.up() == true then
upc = upc + 1
end
sleep(0.25)
until turtle.detectUp() == false
end
for dc = 1, upc do
tfuel(1)
turtle.down()
  end
end

function turnAround()
turtle.turnRight()
turtle.turnRight()
end

for i = 1, width do
for j = 1, todo do

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

else

turtle.forward()
upuntil()
  end
end

turnAround()

for j = 1, todo do
tfuel(1)
turtle.forward()
end
turtle.turnLeft()
if turtle.detect() == true then
repeat
turtle.dig()
sleep(0.5)
until turtle.detect() == false
end
turtle.forward()
turtle.turnLeft()

end

No comments:

Post a Comment