-- =======================
-- 9x9 QUARRY WITH ATM10 ORE FILTERING & AUTO FUEL
-- =======================
-- =======================
-- CONFIGURATION
-- =======================
local targetY = -35 -- change to your desired lowest layer
-- Trash list
local trash = {
["minecraft:cobblestone"] = true,
["minecraft:dirt"] = true,
["minecraft:gravel"] = true,
["minecraft:sand"] = true,
["minecraft:netherrack"] = true
}
-- Valuable ores (vanilla + ATM10)
local valuables = {
["minecraft:diamond"] = true,
["minecraft:iron_ore"] = true,
["minecraft:gold_ore"] = true,
["minecraft:coal"] = true,
["minecraft:redstone"] = true,
["minecraft:lapis_lazuli"] = true,
["minecraft:emerald"] = true,
["alltheores:allthemodium_ore"] = true,
["alltheores:vibranium_ore"] = true,
["alltheores:unobtainium_ore"] = true,
["alltheores:aluminum_ore"] = true,
["alltheores:antimony_ore"] = true,
["alltheores:arcane_crystal_ore"] = true,
["alltheores:black_quartz_ore"] = true,
["alltheores:copper_ore"] = true,
["alltheores:lead_ore"] = true,
["alltheores:nickel_ore"] = true,
["alltheores:osmium_ore"] = true,
["alltheores:platinum_ore"] = true,
["alltheores:peridot_ore"] = true,
["alltheores:prosperity_ore"] = true,
["alltheores:runic_ore"] = true,
["alltheores:ruby_ore"] = true,
["alltheores:sapphire_ore"] = true,
["alltheores:silver_ore"] = true,
["alltheores:tin_ore"] = true,
["alltheores:tungsten_ore"] = true,
["alltheores:uranium_ore"] = true,
["alltheores:uraninite_ore"] = true,
["alltheores:zinc_ore"] = true,
["alltheores:xychorium_blue_ore"] = true,
["alltheores:xychorium_dark_ore"] = true,
["alltheores:xychorium_green_ore"] = true,
["alltheores:xychorium_light_ore"] = true,
["alltheores:xychorium_red_ore"] = true,
}
-- =======================
-- GPS STARTING Y
-- =======================
local function getCurrentY()
local x, y, z = gps.locate(5)
if y then
return y
else
error("GPS not found. Make sure a GPS network is set up!")
end
end
local currentY = getCurrentY()
print("Starting Y detected via GPS: " .. currentY)
-- =======================
-- SAFE MOVEMENT FUNCTIONS
-- =======================
local function forward()
while not turtle.forward() do
turtle.dig()
sleep(0.1)
end
end
local function down()
while not turtle.down() do
turtle.digDown()
sleep(0.1)
end
end
local function refuelIfNeeded()
if turtle.getFuelLevel() == 0 then
for slot = 1, 16 do
local detail = turtle.getItemDetail(slot)
if detail and (detail.name == "minecraft:coal" or detail.name == "minecraft:charcoal") then
turtle.select(slot)
turtle.refuel()
if turtle.getFuelLevel() > 0 then
print("Refueled using coal/charcoal from slot " .. slot)
return
end
end
end
error("Out of fuel and no coal/charcoal in inventory!")
end
end
-- =======================
-- INVENTORY CHECKS
-- =======================
local function isValuable(slot)
local detail = turtle.getItemDetail(slot)
return detail and valuables[detail.name]
end
local function isTrash(slot)
local detail = turtle.getItemDetail(slot)
return detail and trash[detail.name]
end
local function isInventoryFull()
for slot = 1, 16 do
if turtle.getItemCount(slot) == 0 then return false end
end
return true
end
local function dropTrash()
for slot = 1, 16 do
if isTrash(slot) then
turtle.select(slot)
turtle.drop()
end
end
end
local function storeValuables()
turtle.turnLeft()
turtle.turnLeft() -- face chest behind start
for slot = 1, 16 do
if isValuable(slot) then
turtle.select(slot)
turtle.drop()
end
end
turtle.turnLeft()
turtle.turnLeft() -- face original mining direction
end
-- =======================
-- MINE 9x9 LAYER
-- =======================
local function mine9x9()
local turnRight = true
for row = 1, 9 do
for col = 1, 8 do
refuelIfNeeded()
turtle.dig()
forward()
end
if row < 9 then
if turnRight then
turtle.turnRight()
turtle.dig()
forward()
turtle.turnRight()
else
turtle.turnLeft()
turtle.dig()
forward()
turtle.turnLeft()
end
turnRight = not turnRight
end
end
-- Return to starting corner
turtle.turnLeft()
turtle.turnLeft()
for i = 1, 8 do forward() end
turtle.turnRight()
for i = 1, 8 do forward() end
turtle.turnRight()
end
-- =======================
-- MAIN LOOP
-- =======================
while currentY > targetY do
mine9x9()
print("Layer mined at Y = " .. currentY)
dropTrash() -- auto discard trash
if isInventoryFull() then
print("Inventory full — storing valuables in chest behind start.")
storeValuables()
end
if currentY == targetY then
print("Reached target Y. Stopping.")
break
end
down()
currentY = currentY - 1
end
-- Final deposit of any remaining valuables
storeValuables()
print("Finished at Y = " .. currentY)