Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
-- Mine Area based on current turtle position -- Usage: mineArea_XYZ
local args = {...} local width = tonumber(args[1]) or 5 local length = tonumber(args[2]) or 5 local depth = tonumber(args[3]) or 3 -- Track turtle position and facing local facing = 0 -- 0=North, 1=East, 2=South, 3=West -- Function to turn left local function turnLeft() turtle.turnLeft() facing = (facing - 1) % 4 end -- Function to turn right local function turnRight() turtle.turnRight() facing = (facing + 1) % 4 end -- Function to move forward with digging local function digForward() while turtle.detect() do turtle.dig() os.sleep(0.5) end turtle.forward() end -- Function to mine a single layer local function mineLayer() for z = 1, length do for x = 1, width - 1 do digForward() end -- Move to next row if not at the end if z < length then if z % 2 == 1 then turnRight() digForward() turnRight() else turnLeft() digForward() turnLeft() end end end end -- Function to return to start position of layer local function returnToStart() if length % 2 == 0 then turnRight() turnRight() for i = 1, width - 1 do turtle.forward() end turnLeft() else turnRight() end for i = 1, length - 1 do turtle.forward() end turnRight() end -- Main mining routine print("Mining area: " .. width .. "x" .. length .. "x" .. depth) for currentDepth = 1, depth do print("Mining layer " .. currentDepth .. " of " .. depth) -- Mine current layer mineLayer() -- Return to start position returnToStart() -- Go down if not finished if currentDepth < depth then while turtle.detectDown() do turtle.digDown() os.sleep(0.5) end turtle.down() end end -- Return to surface print("Returning to surface...") for i = 1, depth - 1 do turtle.up() end print("Mining complete!")
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)