View difference between Paste ID: Zs7pruwa and Mri7yncN
SHOW: | | - or go back to the newest paste.
1-
--local chest = peripheral.wrap("bottom")
1+
local chest = peripheral.wrap("bottom")
2
local jarSide= "top"
3
local aspect = "herba"
4-
local tSlot = 10
4+
local tSlot = 1
5
local chestToTurtle = "up"
6
--local cableSide = "bottom"
7
8
function fullJarSlot()
9
  local as = chest.getAllStacks(false)
10-
    for slot = 1,16 do
10+
  for slot,content in pairs(as) do
11-
      local content = turtle.getItemDetail(slot)
11+
    if content.name == "BlockJarFilledItem" then
12-
      if content ~= nil then
12+
      return slot
13-
        if content.name == "Thaumcraft:BlockJarFilledItem" then
13+
14-
          print("full jar in slot"..slot)
14+
15-
          turtle.select(slot)
15+
  return 0
16-
          placed = turtle.placeUp()
16+
17-
          print("Full jar placed.")
17+
18-
          return placed
18+
19-
        end
19+
20
  while placed == false do
21
    turtle.select(tSlot)
22-
    sleep(8)
22+
    while turtle.getItemCount(tSlot) < 1 do
23
      local fjs= fullJarSlot()
24
      if fjs > 0 then
25
        chest.pushItemIntoSlot(chestToTurtle,fjs,1,tSlot)
26
      end
27
      sleep(2)
28
    end
29
    while not turtle.detectUp() do
30
      turtle.select(tSlot)
31
      placed=turtle.placeUp()
32
      sleep(4)
33
    end
34
    sleep(4)
35
  end
36
end
37
38
while true do
39
  for i = 1,16 do
40
    if turtle.getItemCount(i) > 0 then
41
      turtle.dropDown()
42
    end
43
  end
44
  if turtle.detectUp() then
45
    local level = peripheral.call(jarSide,"getAspectCount",aspect)
46
    if level == 0 then
47
      print("Jar is empty")
48
      turtle.select(tSlot)
49
      turtle.digUp()
50
      turtle.dropDown(1)
51
    else
52
      print("Jar not empty yet...")
53
      sleep(8)
54
    end
55
  else
56
    print("No jar detected")
57
    placeFullJar()
58
  end
59
60
end