Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Ancient Debris Strip Mining Turtle Script
- local targetY = 14 -- Starting Y level (reference point)
- local miningLength = 50 -- Blocks to mine forward
- local chestSlot = 1 -- Slot for chest interaction
- local netherrackSlot = 2 -- Slot to keep netherrack
- -- Function to check and maintain 64 netherrack
- local function maintainNetherrack()
- turtle.select(netherrackSlot)
- local count = turtle.getItemCount(netherrackSlot)
- if count < 64 then
- print("Need more netherrack: "..count.."/64")
- return false
- end
- return true
- end
- -- Function to handle lava blocking
- local function checkAndBlockLava()
- if turtle.detect() then
- local success, block = turtle.inspect()
- if block and block.name == "minecraft:lava" then
- turtle.select(netherrackSlot)
- turtle.place()
- return true
- end
- end
- return false
- end
- -- Function to refuel from chest and deposit
- local function refuelFromChest()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(chestSlot)
- -- Suck coal and refuel
- while turtle.getFuelLevel() < 1000 do
- turtle.suck()
- for i = 1, 16 do
- turtle.select(i)
- if turtle.refuel(1) then
- break
- end
- end
- end
- -- Deposit ancient debris
- for i = 1, 16 do
- turtle.select(i)
- local item = turtle.getItemDetail()
- if item and item.name == "minecraft:ancient_debris" then
- turtle.drop()
- end
- end
- turtle.select(chestSlot)
- turtle.turnRight()
- turtle.turnRight()
- end
- -- Function to move to specific Y level
- local function moveToY(target)
- -- Since turtles don't track Y, we'll assume starting at 14
- -- and adjust relative to that
- local currentY = 14 -- Assuming start at Y=14
- while currentY ~= target do
- if currentY > target then
- turtle.digDown()
- turtle.down()
- currentY = currentY - 1
- elseif currentY < target then
- turtle.digUp()
- turtle.up()
- currentY = currentY + 1
- end
- end
- end
- -- Main mining function for one row
- local function mineRow()
- for y = 12, 16 do
- moveToY(y)
- for i = 1, miningLength do
- checkAndBlockLava()
- turtle.dig()
- turtle.forward()
- checkAndBlockLava()
- if not maintainNetherrack() then
- -- Return to Y=14 before exiting
- moveToY(14)
- return false
- end
- end
- -- Return to start of row after each Y level
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1, miningLength do
- turtle.forward()
- end
- turtle.turnRight()
- turtle.turnRight()
- end
- moveToY(14) -- Return to starting Y level
- return true
- end
- -- Main program
- print("Starting Ancient Debris Strip Mining...")
- print("Place chest with coal BEHIND turtle at Y=14")
- print("Ensure slot 2 has 64+ netherrack")
- print("Turtle must start at Y=14 facing mining direction")
- -- Initial setup
- turtle.select(netherrackSlot)
- if not maintainNetherrack() then
- print("Please put 64+ netherrack in slot 2")
- return
- end
- local rowCount = 0
- while true do
- if mineRow() then
- -- Return to start position
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1, miningLength do
- turtle.forward()
- end
- refuelFromChest()
- -- Move to next adjacent row
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- rowCount = rowCount + 1
- if rowCount >= 10 then -- Adjust this for number of rows desired
- print("Completed "..rowCount.." rows")
- break
- end
- else
- print("Returning due to low netherrack")
- turtle.turnLeft()
- turtle.turnLeft()
- for i = 1, miningLength do
- turtle.forward()
- end
- refuelFromChest()
- break
- end
- end
- print("Mining complete!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement