Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Digite o X")
- x = tonumber(read())
- print("Digite o Y")
- y = tonumber(read())
- print("Digite o Z")
- z = tonumber(read())
- function turnRight()
- turtle.turnRight()
- turtle.dig()
- blockDetect()
- turtle.forward()
- turtle.turnRight()
- end
- function turnLeft()
- turtle.turnLeft()
- turtle.dig()
- blockDetect()
- turtle.forward()
- turtle.turnLeft()
- end
- function turtleDig()
- for i=1,x-1,1 do
- turtle.dig()
- blockDetect()
- turtle.forward()
- putFloor(chao)
- end
- end
- function useTorch()
- turtle.turnRight()
- turtle.turnRight()
- turtle.place()
- turtle.turnRight()
- turtle.turnRight()
- end
- function checkTorch()
- print("Deseja utilizar tochas?")
- print("Se sim-1")
- print("Se nao-0")
- j = tonumber(read())
- if j ~= 0 then
- while turtle.getItemDetail(15) == nil or turtle.getItemDetail(15).name ~= "minecraft:torch" do
- print("Coloca tochas na slot 15")
- read()
- end
- useTorch()
- end
- end
- function goBack()
- if y%2==0 then
- turtle.turnRight()
- else
- for i=1,x,1 do
- turtle.back()
- blockDetect()
- end
- turtle.turnLeft()
- end
- for i=1,y-1,1 do
- turtle.forward()
- end
- end
- function prepareNewLayer(k)
- if k~=z then
- turtle.turnRight()
- turtle.digDown()
- turtle.down()
- end
- end
- function stepsPerLayer()
- steps = x * y + 1
- steps = steps + y-1
- if y%2~=0 then
- steps = steps + x-1
- end
- return steps
- end
- function blockDetect()
- while turtle.detect() == true do
- turtle.dig()
- end
- end
- function refuel()
- turtle.select(16)
- turtle.refuel(math.ceil(math.ceil((stepsPerLayer() * z + 2) / 80)))
- end
- function printFuelNeeded()
- print("E necessario no total " .. math.ceil((stepsPerLayer() * z + 2) / 80) .. " carvoes")
- end
- function requireFuel()
- while turtle.getItemDetail(16) == nil or turtle.getItemDetail(16).name ~= "minecraft:coal" do
- print("Coloca carvao na slot 16")
- print("Ja esta?")
- read()
- end
- while turtle.getItemDetail(16).count < math.ceil((stepsPerLayer() * z + 2) / 80) do
- print("Falta " .. math.ceil((stepsPerLayer() * z + 2) / 80) - turtle.getItemDetail(16).count .. " carvoes" )
- read()
- end
- print("otimo!")
- end
- function createFloor()
- print("Deseja ter chao limpo?")
- print("Se sim-1")
- print("Se nao-0")
- chao = tonumber(read())
- if chao ~= 0 then
- while turtle.getItemDetail(14) == nil or turtle.getItemDetail(14).name ~= "minecraft:water_bucket" do
- print("Coloca um balde de agua na slot 14")
- read()
- end
- while turtle.getItemDetail(13) == nil or turtle.getItemDetail(13).name ~= "minecraft:cobblestone" do
- print("Coloca cobblestone na slot 13")
- read()
- end
- end
- end
- function putFloor(chao)
- if chao ~= 0 then
- if turtle.detectDown() ~= true then
- turtle.back()
- turtle.select(14)
- turtle.place()
- turtle.place()
- turtle.forward()
- turtle.select(13)
- turtle.placeDown()
- end
- end
- end
- function main()
- for k=1,z,1 do
- for j=1,y,1 do
- turtleDig()
- if j~=y then
- if j%2~=0 then
- turnRight()
- else
- turnLeft()
- end
- end
- end
- goBack()
- prepareNewLayer(k)
- end
- end
- createFloor()
- printFuelNeeded()
- requireFuel()
- refuel()
- turtle.dig()
- turtle.forward()
- turtle.dig()
- turtle.forward()
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement