fix(turtle-utils): waitForMatureCrop
This commit is contained in:
parent
1e9536b089
commit
88d8fae296
@ -37,7 +37,7 @@ turtleUtils.waitForMatureCrop = function(inspectFn, sleepTime)
|
||||
inspectFn = inspectFn or turtle.inspect
|
||||
|
||||
return waitFor(function()
|
||||
return turtleUtils.isMatureCrop(inspectFn)
|
||||
return turtleUtils.getMatureCrop(inspectFn)
|
||||
end, sleepTime)
|
||||
end
|
||||
|
||||
@ -125,13 +125,18 @@ turtleUtils.getFuelPercentage = function()
|
||||
return (turtle.getFuelLevel() / turtle.getFuelLimit()) * 100
|
||||
end
|
||||
|
||||
turtleUtils.isMatureCrop = function(inspectFn)
|
||||
turtleUtils.getMatureCrop = function(inspectFn)
|
||||
inspectFn = inspectFn or turtle.inspect
|
||||
|
||||
return function()
|
||||
local isBlock, block = inspectFn()
|
||||
local blockStateAge = block and block.state and block.state.age
|
||||
return blockStateAge == 7
|
||||
|
||||
if blockStateAge == 7 then
|
||||
return block.name
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user