Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --KdMine by Kd8lvt--
- --Made for Lokbatch, and personal use--
- --Type 'copyright' as the length to see an abbreviated version of the Mozilla Public License.--
- function dump()
- for i = 1,16 do
- itemid = turtle.getItemDetal(i)
- if itemid == "minecraft:cobblestone" then
- turtle.select(i)
- turtle.drop()
- elseif itemid == "minecraft:netherrack" then
- turtle.select(i)
- turtle.drop()
- else
- --Do nothing, we want to keep this item!
- end
- end
- turtle.select(1)
- end
- function dig(direction)
- if direction == "up" then
- turtle.digUp()
- elseif direction == "down" then
- turtle.digDown()
- else
- turtle.dig()
- end
- end
- function turn(direction, times)
- if times then
- while times > 0 do
- if direction == "left" then
- turtle.turnLeft()
- elseif direction == "right" then
- turtle.turnRight()
- end
- times = times - 1
- end
- else
- if direction == "left" then
- turtle.turnLeft()
- elseif direction == "right" then
- turtle.turnRight()
- end
- end
- end
- function mine(length)
- turn("left",2)
- dump()
- turn("left",2)
- dig()
- turtle.forward()
- dig("up")
- turtle.up()
- if lastTorch then
- if length == lastTorch - 4 then
- torch()
- end
- else
- torch()
- lastTorch = length
- end
- dig("up")
- turn("left")
- dig()
- turtle.forward()
- turn("right",2)
- dig("up")
- dig("down")
- turtle.forward()
- dig()
- turtle.forward()
- dig("up")
- dig("down")
- turn("left",2)
- turtle.forward()
- turtle.down()
- turn("right")
- end
- function checkFuel()
- local fuel = turtle.getFuelLevel()
- if fuel < 50 then
- for i = 1,16 do
- itemid, count = turtle.getItemDetail(i)
- if itemid == "minecraft:coal" then
- turtle.select(i)
- if count > 31 then
- turtle.refuel(count/2)
- end
- elseif itemid == "minecraft:charcoal" then
- turtle.select(i)
- if count > 31 then
- turtle.refuel(count/2)
- end
- elseif itemid == "minecraft:lava_bucket" then
- turtle.select(i)
- turtle.refuel()
- elseif i == 16 and turtle.getFuelLevel == fuel then
- error("I ran out of fuel! Please refuel me :( I can take Coal, Charcoal, or Lava.")
- end
- end
- end
- end
- function torch()
- for i = 1,16 do
- itemid = turtle.getItemDetail(i)
- if itemid == "minecraft:torch" then
- turtle.select(i)
- turtle.placeDown()
- end
- end
- end
- function main()
- textutils.slowPrint("How far to mine? [Or, type 'license' to see the license]")
- input = io.read()
- if input == "license" then
- print("This work is protected under the Mozilla Public License 2.0. here is an abbreviated version: ")
- print("If you edit and re-publish this work, you MUST: ")
- print(" 1. Disclose your source (Make it open-source)")
- print(" 2. License and copyright notice (Just don't change this part and you'll be fine)")
- print("You are NOT allowed to do these things: ")
- print(" 1. Hold kd8lvt liable for any damages done to your game / computer (It shouldn't anyways)")
- print(" 2. Use a trademark (This does NOT grant you any rights in the trademarks or other rights of contributors.)")
- print("You ARE allowed to do these things: ")
- print(" 1. Use this for commercial purposes (I'd prefer if you didn't though, Ad.fly is ok.)")
- print(" 2. Redistribute")
- print(" 3. Modify")
- print(" 4. Use Patents")
- print(" 5. Use and modify without distributing (no liability to kd8lvt)")
- print(" 6. Sublicense (I don't have one)")
- error("Displayed Abbreviated Mozilla Public License 2.0")
- else
- if tonumber(input) ~= nil then
- length = tonumber(input)
- while length > 0 do
- mine(length)
- length = length - 1
- end
- else
- error("You must input a number, or 'license'")
- end
- end
- end
- while true do
- main()
- end
Add Comment
Please, Sign In to add comment