View difference between Paste ID: fVnVVN8D and VvDBLVNz
SHOW: | | - or go back to the newest paste.
1
Tier = 1
2
Blank = 32
3
Reinforced = 16
4
Imbued = 8
5
Demonic = 4
6
Ethereal = 2
7
8
--Turtle must be below the Altar Block
9
10
--Inventory must be below the Turtle
11
--|Chest, Interface, etc|
12
13
--Redstone input on the rear toggles
14
--automation
15
16
--Outputs redstone on the front 1000LP
17
--below max for Well of Suffering
18
19
20
altar = peripheral.wrap("top")
21
chest = peripheral.wrap("bottom")
22
23
function getTotalCount(item)
24
	a=0
25
	for i=1, chest.getInventorySize() do
26
		if chest.getStackInSlot(i) ~= nil then
27
			if (chest.getStackInSlot(i).display_name == item) then
28
				a = a + chest.getStackInSlot(i).qty
29
			end
30
		end
31
	end
32
	return a
33
end
34
35
function getSlotWithItem(item)
36
	for i=1, chest.getInventorySize() do
37
		if chest.getStackInSlot(i) ~= nil then
38
			if (chest.getStackInSlot(i).display_name == item) then
39
				if (chest.getStackInSlot(i).qty >0) then
40
					return i
41
				end
42
			end
43
		end
44
	end
45
end
46
47
48
function createSlate(initem, outitem, lifeamount)
49
50
	if altar.getInfo().contents.amount >= lifeamount then
51
		print(altar.getInfo().contents.amount)
52
		chest.pushItem("UP",getSlotWithItem(initem),1,1)
53
		altar.pullItem("DOWN",1,1,1)
54
	while not(altar.getStackInSlot(1).display_name==outitem) do 
55
		sleep(.2)
56
	end
57
		altar.pushItem("DOWN",1,1,1)
58
		chest.pullItem("UP",1,1)
59
	end
60
end
61
62
63
if altar.getStackInSlot(1)==nil then
64
	while true do
65
	sleep(1)
66
	if altar.getInfo().contents.amount >= (altar.getInfo().capacity-1000) then redstone.setOutput("front",true) else redstone.setOutput("front",false) end
67
	if redstone.getInput("back") == false then
68
		if altar.getStackInSlot(1)==nil then
69
			if getTotalCount("Blank Slate") < Blank then
70
				createSlate("Stone", "Blank Slate", 1000)
71
			elseif getTotalCount("Reinforced Slate") < Reinforced then if Tier > 1 then
72
				createSlate("Blank Slate", "Reinforced Slate", 2000)
73
			end
74
			elseif getTotalCount("Imbued Slate") < Imbued then if Tier > 2 then
75
				createSlate("Reinforced Slate", "Imbued Slate", 5000)
76
			end
77
			elseif getTotalCount("Demonic Slate") < Demonic then if Tier > 3 then
78
				createSlate("Imbued Slate", "Demonic Slate", 15000)
79
			end
80
			elseif getTotalCount("Ethereal Slate") < Ethereal then if Tier > 4 then
81
				createSlate("Demonic Slate", "Ethereal Slate", 30000)
82
			end
83
				else do sleep(8) end
84
			end
85
		end
86
	end
87
	end
88
else
89
altar.pushItem("DOWN",1,1,1)
90
chest.pullItem("UP",1,1)
91
end