Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Press CTRL+T to stop")
- local turtle_inventory_slot = 1
- while true do --Always loop
- local result, message = turtle.suckDown(1) --Try to pull in item from chest below
- local item_count, item_name = turtle.getItemDetail(turtle_inventory_slot) --Get count and name of selected turtle inventory item
- if item_count <= 0 then --Turtle no longer has inventory in selected spot select next spot
- if turtle_inventory_slot > 16 then --End of turtle inventory reached stop NEED TO MAKE THIS BETTER
- print("Reached end of turtle inventory, stopping.")
- return
- end
- if turtle_inventory_slot <= 16 then
- turtle.select(turtle_inventory_slot)
- local item_count, item_name = turtle.getItemDetail(turtle_inventory_slot)
- while item_name ~= "minecraft:netherrack" then
- turtle.dropUp()
- turtle_inventory_slot = turtle_inventory_slot + 1
- if turtle_inventory_slot <= 16 then
- return
- end
- turtle.select(turtle_inventory_slot)
- local item_count, item_name = turtle.getItemDetail(turtle_inventory_slot)
- end
- end
- --Check if item is correct to drop
- if item_name ~= "minecraft:netherrack" then
- turtle.dropUp() --Drop the incorrect item so the vacuum chest grabs it
- turtle_inventory_slot = turtle_inventory_slot + 1
- if turtle_inventory_slot >= 17 then --End of turtle inventory reached stop NEED TO MAKE THIS BETTER
- print("Reached end of turtle inventory, stopping.")
- return
- end
- turtle.select(turtle_inventory_slot)
- end
- local block_present, info = turtle.inspect()
- --print(block_present)
- if block_present then
- --print("Found block, mining!")
- if info.name ~= "minecraft:netherrack" then
- turtle.dig()
- end
- end
- if block_present == false then
- --print("No block found, placing block.")
- turtle.place(0)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment