summaryrefslogtreecommitdiff
path: root/cactus.lua
blob: 09abc0e585964c94ab61e0c6836eeed47c6cb318 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
local function ensure_equipped(item)
	local cur = peripheral.getType"left"
	if cur == item then return true end
	for i = 1,16 do
		local det = turtle.getItemDetail(i)
		if det and det.name == item then
			turtle.select(i)
			return turtle.equipLeft()
		end
	end
	return false, "couldn't find "..item
end

ensure_equipped "minecraft:dirt"