Advertisement
TechManDylan

Create Casing Maker

Jul 14th, 2023 (edited)
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. -- Check for minecraft:stripped_oak_log in turtle inventory
  2. function checkInventoryForLogs()
  3. for slot = 1, 16 do
  4. local item = turtle.getItemDetail(slot)
  5. if item and item.name == "minecraft:stripped_oak_log" then
  6. return slot
  7. end
  8. end
  9. return nil
  10. end
  11.  
  12. -- Place a stripped oak log in front of the turtle
  13. function placeLog()
  14. local slot = checkInventoryForLogs()
  15. if slot then
  16. turtle.select(slot)
  17. turtle.place()
  18. sleep(0.1)
  19. end
  20. end
  21.  
  22. -- Check if the block in front of the turtle is create:andesite_casing and break it
  23. function checkAndBreakBlock()
  24. local success, block = turtle.inspect()
  25. if success and block.name == "create:andesite_casing" then
  26. turtle.dig()
  27. end
  28. end
  29.  
  30. -- Main loop
  31. while true do
  32. placeLog()
  33. checkAndBreakBlock()
  34. sleep(0.1)
  35. end
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement