Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Define the trash items
- local trashItems = {
- "minecraft:dirt",
- "minecraft:cobblestone",
- "minecraft:diorite"
- }
- -- Function to check if an item is trash
- local function isTrash(item)
- for _, trash in ipairs(trashItems) do
- if item == trash then
- return true
- end
- end
- return false
- end
- -- Function to check if the inventory is full
- local function isInventoryFull()
- for slot = 1, 16 do
- if turtle.getItemCount(slot) == 0 then
- return false
- end
- end
- return true
- end
- -- Function to ensure the block in front is cleared before moving forward
- local function ensureClearAhead()
- while turtle.detect() do
- turtle.dig()
- sleep(0.5) -- Small delay to allow any falling blocks to settle
- end
- end
- -- Function to dig straight down in one column
- local function digColumn(depth)
- for d = 1, depth do
- -- Dig down and move down
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.down()
- -- Avoid bedrock
- local success, data = turtle.inspectDown()
- if success and data.name == "minecraft:bedrock" then
- return false
- end
- end
- return true
- end
- -- Function to return to the top of the column
- local function returnToTop(depth)
- for i = 1, depth do
- turtle.up()
- end
- end
- -- Function to dig a quarry straight down
- local function quarry(width, length, depth)
- local x, z = 0, 0 -- Track position within the quarry
- for l = 1, length do
- for w = 1, width do
- local continue = digColumn(depth)
- if not continue then
- return
- end
- returnToTop(depth)
- -- Move to the next position
- if w < width then
- ensureClearAhead() -- Ensure the next column is clear
- turtle.forward()
- x = x + 1
- end
- end
- -- Move to the next row
- if l < length then
- if l % 2 == 1 then
- turtle.turnRight()
- ensureClearAhead() -- Ensure the next column is clear
- turtle.forward()
- turtle.turnRight()
- z = z + 1
- else
- turtle.turnLeft()
- ensureClearAhead() -- Ensure the next column is clear
- turtle.forward()
- turtle.turnLeft()
- z = z + 1
- end
- end
- end
- end
- -- Get quarry dimensions from the user
- print("Enter quarry width:")
- local width = tonumber(read())
- print("Enter quarry length:")
- local length = tonumber(read())
- print("Enter quarry depth:")
- local depth = tonumber(read())
- -- Run the quarry function with user-provided dimensions
- quarry(width, length, depth)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement