Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local wait = sleep -- My Dumbass way of typing wait instead of sleep
- local turtX = 0 -- Positioning and movement Variables
- local turtY = 0
- local turtZ = 0
- local facing = 0
- local hasDugRight = false
- local hasDugLeft = false
- local emptyWasteBlocks = false
- local fullSlots = 0 -- Inventory Variables
- local totalDug = 0 -- Misc Variables
- local fuels = {
- -- Blocks and items that a turtle can use for fuel
- "minecraft:charcoal",
- "minecraft:coal",
- "minecraft:coal_block",
- "minecraft:oak_log",
- "minecraft:oak_planks",
- "minecraft:oak_slab",
- "minecraft:oak_stairs",
- "minecraft:oak_fence",
- "minecraft:oak_pressure_plate",
- "minecraft:chest",
- "minecraft:crafting_table",
- "minecraft:oak_trapdoor"
- }
- local gravityBlocks = {
- -- List of blocks effected by gravity
- "minecraft:sand",
- "minecraft:red_sand",
- "minecraft:gravel"
- }
- local wasteBlocks = {
- -- List of blocks that you might not want to collect
- "minecraft:gravel",
- "minecraft:dirt",
- "minecraft:cobblestone",
- "minecraft:netherrack",
- "minecraft:granite",
- "minecraft:andesite",
- "minecraft:diorite"
- }
- local function isPositive(a)
- if a >= 0 then
- return true
- else
- return false
- end
- end
- local function dig()
- turtle.dig()
- totalDug = totalDug + 1
- end
- local function digUp()
- turtle.digUp()
- totalDug = totalDug + 1
- end
- local function digDown()
- turtle.digDown()
- totalDug = totalDug + 1
- end
- local function checkFull()
- fullSlots = 0
- local search = 0
- for search = 16, 1, -1 do
- turtle.select(search)
- if turtle.getItemCount() > 0 then
- if turtle.getItemDetail().name == fuels then
- if turtle.getFuelLevel() <= getFuelLimit() - 64 then
- turtle.refuel()
- end
- end
- end
- if turtle.getItemCount() > 0 then
- fullSlots = fullSlots + 1
- end
- end
- if fullSlots == 16 then
- empty()
- end
- end
- local function turnRight()
- turtle.turnRight()
- if facing == 0 then
- facing = 1
- elseif facing == 1 then
- facing = 2
- elseif facing == 2 then
- facing = 3
- elseif facing == 3 then
- facing = 0
- end
- end
- local function turnLeft()
- trutle.turnLeft()
- if facing == 0 then
- facing = 3
- elseif facing == 1 then
- facing = 0
- elseif facing == 2 then
- facing = 1
- elseif facing == 3 then
- facing = 2
- end
- end
- local function forward()
- turtle.forward()
- if facing == 0 then
- turtX = turtX + 1
- elseif facing == 1 then
- turtZ = turtZ + 1
- elseif facing == 2 then
- turtX = turtX - 1
- elseif facing == 3 then
- turtZ = turtZ - 1
- end
- end
- local function backward()
- turtle.backward()
- if facing == 0 then
- turtX = turtX - 1
- elseif facing == 1 then
- turtZ = turtZ - 1
- elseif facing == 2 then
- turtX = turtX + 1
- elseif facing == 3 then
- turtZ = turtZ + 1
- end
- end
- local function up()
- turtle.up()
- local turtY = turtY + 1
- end
- local function down()
- turtle.down()
- local turtY = turtY - 1
- end
- local function checkForGravityBlocks()
- local has_block, name = turtle.inspect()
- for i = 1, 10 do
- if has_block then
- if name.name == gravityBlocks then
- dig()
- wait(0.25)
- end
- end
- end
- end
- local function adjustY()
- if isPositive(roomY) then
- up()
- for i = 1, 2 do
- if turtle.detectUp() then
- digUp()
- up()
- else
- up()
- end
- end
- else
- down()
- for i = 1, 2 do
- if turtle.detectDown() then
- digDown()
- down()
- else
- down()
- end
- end
- end
- end
- local function digRight()
- hasDugLeft = false
- hasDugRight = true
- turnRight()
- dig()
- checkForGravityBlocks()
- for i = 1, roomX do
- dig()
- checkForGravityBlocks()
- end
- end
- local function digLeft()
- end
- print("What are the room dimensions? X(forward) Y(up or down) Z(sideways)")
- print('If down put "-" before the number')
- print("X: ")
- local roomX = toNumber(read())
- print("Y: ")
- local roomY = toNumber(read())
- Print("Z: ")
- local roomZ = toNumber(read())
- term.clear()
- term.setCursorPos(1, 1)
- print('Remove waste blocks? "y" or "n"')
- print(wasteBlocks)
- term.clear()
- term.setCursorPos(1, 1)
- local result = read()
- if result == "y" then
- emptyWasteBlocks = true
- elseif result == "n" then
- emptyWasteBlocks = false
- end
- while true do
- end
Add Comment
Please, Sign In to add comment