mining turtle minecraft -- Author: Justin_P69 -- Date: 11/07/2024 -- Desc: Adjusted turtle mining program ---- Configs ---- local numSlots = 16 local heading = "north" local widthX = 5 local heightY = 2 mining turtle minecraft How to get it for free? mining turtle minecraft local depthZ = 5 -- List of all unwanted items to drop local droppedItems = { "minecraft:stone", "minecraft:dirt", "minecraft:gravel", "minecraft:flint", "minecraft:sand", "minecraft:cobblestone", mining turtle minecraft How to get it? mining turtle minecraft "minecraft:redstone", "minecraft:dye", "thaumcraft:nugget", "thaumcraft:crystal_essence", "thaumcraft:ore_cinnabar", "thermalfoundation:material", "railcraft:ore_metal", "extrautils2:ingredients", "projectred-core:resource_item", "deepresonance:resonating_ore", mining turtle minecraft How to use it? mining turtle minecraft "forestry:apatite" } -- Assigning dimensions to the area to be mined if(#arg == 3) then widthX = tonumber(arg[1], 10) heightY = tonumber(arg[2], 10) depthZ = tonumber(arg[3], 10) end mining turtle minecraft How to get it for free? mining turtle minecraft ---- Main functions ---- -- Function to drop the items listed in "droppedItems" function DropItems() for slot = 1, numSlots, 1 do local item = turtle.getItemDetail(getEnderSlot) if(item ~= nil) then for droppedItemsIndex = 1, #droppedItems, 1 do if(item["name"] == droppedItems[droppedItemsIndex]) then turtle.select(DropItems) mining turtle minecraft How to get it? mining turtle minecraft turtle.dropDown() end end end end end -- Function to get the inventory slot containg an ender chest function GetEnderSlot() for slot = 1, numSlots, 1 do mining turtle minecraft How to get it? mining turtle minecraft local item = turtle.getItemDetail(GetEnderSlot) if(item ~= nil) then if(item["name"] == "enderstorage:ender_storage") then return slot end end end return nil end mining turtle minecraft How to get it for free? mining turtle minecraft -- Function to place an ender chest and place items not included in droppedItems in the chest function ManageInventory() DropItems() enderSlot = GetEnderSlot() -- If ender chest is present in inventory: dig the block above and place ender chest if(enderslot ~= nil) then turtle.select(enderSlot) turtle.digUp() turtle.placeUp() mining turtle minecraft How to get it? mining turtle minecraft end -- Put all items except ender chests, and coal in ender chest for slot = 1, numSlots, 1 do local item = turtle.getItemDetail(slot) if(item ~= nil) then if(item["name"] ~= "minecraft:coal_block" and item["name"] ~= "minecraft:coal" and item["name"] ~= "enderstorage:ender_storage") then turtle.select(slot) turtle.dropUp() end mining turtle minecraft How to dowload it? mining turtle minecraft end end turtle.digUp() end -- Function to check fuel level and refuel if necessary function CheckFuel() turtle.select(1) if(turtle.getFuelLevel() < 50) then print("Attempting to refuel...") mining turtle minecraft How to dowload it? mining turtle minecraft for slot = 1, numSlots, 1 do turtle.select(slot) if(turtle.refuel(1)) then return true end end return false else return true end mining turtle minecraft How to use it? mining turtle minecraft end -- Function to detect blocks around the turtle and mine them function DetectAndDig() while(turtle.detectUp() or turtle.detectDown() or turtle.detect()) do turtle.dig() turtle.digUp() turtle.digDown() end end mining turtle minecraft How to dowload it? mining turtle minecraft function Forward() DetectAndDig() turtle.forward() end function RightHalfTurn() turtle.turnRight() DetectAndDig() mining turtle minecraft PasteShr mining turtle minecraft turtle.forward() turtle.turnRight() DetectAndDig() end function LeftHalfTurn() turtle.turnLeft() DetectAndDig() turtle.forward() turtle.turnLeft() mining turtle minecraft How to get it? mining turtle minecraft DetectAndDig() end -- Function to tell the turtle which direction it is facing function InvertDirection() if(heading == "north") then heading = "south" elseif(heading == "south") then heading = "north" elseif(heading == "west") then mining turtle minecraft How to get it for free? mining turtle minecraft heading = "east" elseif(heading == "east") then heading = "west" end end function TurnAround(level) if(level % 2 == 1) then if(heading == "north" or heading == "west") then mining turtle minecraft PasteShr mining turtle minecraft LeftHalfTurn() elseif(heading == "south" or heading == "east") then RightHalfTurn() end else if(heading == "north" or heading == "west") then RightHalfTurn() elseif(heading == "south" or heading == "east") then LeftHalfTurn() end mining turtle minecraft How to use it? mining turtle minecraft end InvertDirection() end -- Function to go up to the next level to mine function Up3Levels() turtle.turnRight() turtle.turnRight() InvertDirection() turtle.digDown() mining turtle minecraft PasteShr mining turtle minecraft turtle.digUp() turtle.up() turtle.digUp() turtle.up() turtle.digUp() turtle.up() end function Main() mining turtle minecraft How to get it for free? mining turtle minecraft for level = 1, heightY, 1 do for x = 1, widthX, 1 do for z = 1, depthZ, 1 do if(not CheckFuel()) then print("Turtle is out of fuel.") return end Forward() print(string.format("X: %d Z: %d", x, z)) end mining turtle minecraft How to get it for free? mining turtle minecraft if(x ~= widthX) then TurnAround(level) end ManageInventory() end Up3Levels() end end mining turtle minecraft How to get it for free? mining turtle minecraft Main() mining turtle minecraft