1.12 updates
This commit is contained in:
38
apps/farm.lua
Normal file
38
apps/farm.lua
Normal file
@@ -0,0 +1,38 @@
|
||||
_G.requireInjector(_ENV)
|
||||
|
||||
local Point = require('point')
|
||||
local Util = require('util')
|
||||
|
||||
local scanner = device['plethora:scanner']
|
||||
|
||||
local function scan()
|
||||
local blocks = scanner.scan()
|
||||
Util.filterInplace(blocks, function(v)
|
||||
return v.name == 'minecraft:wheat' and
|
||||
scanner.getBlockMeta(v.x, v.y, v.z).metadata == 7
|
||||
end)
|
||||
|
||||
return blocks
|
||||
end
|
||||
|
||||
local function harvest(blocks)
|
||||
Point.eachClosest(turtle.point, blocks, function(b)
|
||||
Util.print(b)
|
||||
turtle.goto(Point.above(b))
|
||||
turtle.digDown()
|
||||
turtle.placeDown('minecraft:wheat_seeds')
|
||||
end)
|
||||
end
|
||||
|
||||
turtle.reset()
|
||||
local directions = { [5] = 2, [3] = 3, [4] = 0, [2] = 1, }
|
||||
turtle.placeUp('minecraft:chest')
|
||||
local _, bi = turtle.inspectUp()
|
||||
turtle.digUp()
|
||||
turtle.point.heading = directions[bi.metadata]
|
||||
|
||||
while true do
|
||||
local blocks = scan()
|
||||
harvest(blocks)
|
||||
os.sleep(10)
|
||||
end
|
||||
@@ -43,7 +43,7 @@ local page = UI.Page {
|
||||
info = UI.Window {
|
||||
x = 2, ex = -2, y = 2, ey = 5,
|
||||
button = UI.Button {
|
||||
ex = -1, y = 2, width = 9,
|
||||
ex = -1, y = 3, width = 9,
|
||||
text = 'Enable',
|
||||
event = 'grid_select',
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,3 @@
|
||||
_G.requireInjector(_ENV)
|
||||
local Home = require('turtle.home')
|
||||
turtle.run(Home.go)
|
||||
|
||||
Reference in New Issue
Block a user