View difference between Paste ID: 8xRdB5Km and rgSxZ1YD
SHOW: | | - or go back to the newest paste.
1
Tier = 5
2
altar = peripheral.wrap("top")
3
chest = peripheral.wrap("bottom")
4
function getTotalCount(item)
5
  a=0
6
  for i,v in pairs(chest.getAllStacks()) do
7
    if v.display_name == item then
8
      a = a + v.qty
9
    end
10
  end
11
  return a
12
end
13
14
function getSlotWithItem(item)
15
  for i,v in pairs(chest.getAllStacks()) do
16
    if (v.display_name == item) then
17
      if (v.qty >0) then
18
      return i
19
      end
20
    end
21
  end
22
end
23
24
25
if altar.getStackInSlot(1)==nil then
26
  while true do
27
  sleep(6)
28
  altarcapacity = altar.getInfo().capacity
29
  if altar.getInfo().amount >= (altarcapacity-1000) then redstone.setOutput("front",true) else redstone.setOutput("front",false) end
30
  if redstone.getInput("back") == false then
31
  if altar.getStackInSlot(1)==nil then
32
    if getTotalCount("Blank Slate") < 48 then
33
      shell.run("BlankSlate")
34
    end
35
    if Tier >= 2 then if getTotalCount("Reinforced Slate") < 32 then
36
      shell.run("ReinforcedSlate")
37
    end end
38
    if Tier >= 3 then if getTotalCount("Imbued Slate") < 8 then
39
      shell.run("ImbuedSlate")
40
    end end
41
    if Tier >= 4 then if getTotalCount("Demonic Slate") < 4 then
42
      shell.run("DemonicSlate") 
43
    end end
44
    if Tier >= 5 then if getTotalCount("Ethereal Slate") < 2 then
45
      shell.run("EtherealSlate")
46
    end end end
47
  end
48
  end
49
else
50
altar.pushItem("DOWN",1,1,1)
51
chest.pullItem("UP",1,1)
52
end