Advertisement
CelticCoder

turtleFarm

Aug 13th, 2024 (edited)
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. -- Define an array with plant names and their final growth stages
  2. local plants = {
  3.     ["minecraft:wheat"] = 7,
  4.     ["minecraft:carrots"] = 7,
  5.     ["minecraft:potatoes"] = 7,
  6.     ["minecraft:beetroots"] = 3,
  7.     ["minecraft:nether_wart"] = 3,
  8.     ["minecraft:cocoa"] = 2,
  9.     ["minecraft:pumpkin_stem"] = 7,
  10.     ["minecraft:melon_stem"] = 7,
  11.     -- Add more plants if needed
  12. }
  13.  
  14. -- Function to check if the plant is fully grown
  15. local function isFullyGrown(plantName, growthStage)
  16.     -- Look up the plant in the array
  17.     finalStage = plants[plantName]
  18.     if finalStage then
  19.         return growthStage == finalStage
  20.     else
  21.         return false
  22.     end
  23. end
  24.  
  25. while true do
  26.     -- Main program
  27.     success, data = turtle.inspectDown()
  28.    
  29.     if success then
  30.         plantName = data.name
  31.         growthStage = data.state.age
  32.    
  33.         if isFullyGrown(plantName, growthStage) then
  34.             length = 16
  35.             width = 16
  36.             simpleQuarry.quarry(width, length, 1)
  37.         end
  38.     end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement