TheRockettek

startup

Jan 3rd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. local function surface()
  2. while turtle.detect() do
  3. turtle.up()
  4. end
  5. end
  6.  
  7. local function getBelowName()
  8. present,tile = turtle.inspectDown()
  9. if present then
  10. return tile.name
  11. end
  12. end
  13.  
  14. local function getBelowNameRaw()
  15. name = getBelowName()
  16. return string.sub(name,string.find(name,":")+1,#name)
  17. end
  18.  
  19. local function getItemSlotName(id)
  20. turtle.select(id)
  21. slot = turtle.getItemDetail()
  22. return slot.name
  23. end
  24.  
  25. deniedblocks = {"minecraft:dirt","minecraft:cobblestone","minecraft:stone"}
  26.  
  27. print("Starting...")
  28.  
  29. while true do
  30. surface()
  31. turtle.forward()
  32. while getBelowNameRaw() ~= "bedrock" do
  33. blockbelow = getBelowName()
  34. if blockbelow == "minecraft:lava" or blockbelow == "minecraft:flowing_lava" then
  35. turtle.select(1)
  36. turtle.place()
  37. turtle.refuel()
  38. print("Refueled. Fuel level now " .. turtle.getFuelLevel())
  39. else
  40. turtle.digDown()
  41. end
  42. for i=1,16,1 do
  43. if turtle.getItemCount(i) > 0 then
  44. slotname = getItemSlotName(i)
  45. for j=1,#deniedblocks,1 do
  46. if slotname == deniedblocks[j] then
  47. print("Slot " .. i .. " has denied block (" .. slotname .. "). Ejecting...")
  48. turtle.dropUp()
  49. end
  50. end
  51. end
  52. end
  53. turtle.down()
  54. end
  55. print("Layer done!")
  56. end
Add Comment
Please, Sign In to add comment