Advertisement
Codetemple

OreGenFromLava.lua v6

Jul 8th, 2020
1,144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.84 KB | None | 0 0
  1. #09/07/2020 Basic program to turn stone into ore. Need PLENTY of power for the AR as well)
  2. print("I operate a Mines Lens on an Atomic Reconstructor ")
  3. print("Put a chest above me that I can place ores into, and ")
  4. print(" a chest below me, with plenty of stone in, ")
  5. print(" which I will help myself to!!")
  6. print("I output a resstone pulse on my right side to operate the Atomic thing")
  7. print("Press e to exit")
  8. local box = peripheral.wrap("down")
  9. continue = true
  10. while continue do
  11.     turtle.select(8) -- using second half of inventory
  12.     local success, data = turtle.inspect()
  13.     if success then
  14.         print("success")
  15.         if data.name == "minecraft:stone" then
  16.             print("stone")
  17.             redstone.setOutput("back", true)
  18.             sleep(0.2)
  19.             redstone.setOutput("back", false)
  20.             sleep(0.5) --give time a chance!
  21.         elseif data.name == "minecraft:water"           then print("water")
  22.         elseif data.name == "minecraft:flowing_water"   then print("flowing_water")
  23.         elseif data.name == "minecraft:lava"            then print("lava")
  24.         elseif data.name == "minecraft:flowing_lav"     then print("flowing_lava")  
  25.         else
  26.             print("about to dig in not water or lava")
  27.             while true do turtle.dig() ; turtle.suck() end
  28.         end
  29.         sleep(2) --give stone a chance to form
  30.         print("sleep(2) ..give stone a chance to form")
  31.     end
  32.     -- if full clear inventory
  33.     turtle.select(16)
  34.     if turtle.getItemCount()>0 then
  35.         print("Items in slot 16, deciding to clear")
  36.         for i = 3,16 do -- clear slots 3 to 16
  37.           turtle.select(i)
  38.           turtle.dropUp()
  39.         end  
  40.     end
  41.     turtle.select(8) -- using second half of inventory
  42.     local event, key = os.pullEvent( "key" ) -- limit os.pullEvent to the 'key' event
  43.     if key == keys.e then -- if the key pressed was 'e'
  44.         print( "You pressed [E]. Exiting program..." )
  45.         continue = false
  46.     end
  47. end
  48. print("continue = false, so  ending")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement