View difference between Paste ID: 14QnANCr and 20UbwkLM
SHOW: | | - or go back to the newest paste.
1
-- Peripherals
2
3-
chest = peripheral.wrap("back")
3+
chest = peripheral.wrap("bottom")
4
5
-- Functions
6
7
function Condense()
8
	return chest.condenseItems()
9
end
10
11
function Condenser(x)
12-
	return chest.pushItem("south",x)
12+
	return chest.pushItem("east",x)
13
end
14
15-
function Disenchanter(x)
15+
16-
	return chest.pushItem("up",x)
16+
17
	if (item["name"]=="enchanted_book") then return true else return false end
18
end
19
20
function maxSlots()
21-
	if (type(item["ench"])=="table") then return true else return false end
21+
22
end
23
24
function isNotDamaged(x)
25
	item=chest.getStackInSlot(x)
26
	if(item["dmg"]==0) then return true else return false end
27
end
28
29
while true do
30
	Condense()
31
	for count=1, maxSlots(), 1 do
32
		item=chest.getStackInSlot(count)
33
		if(type(item)=='table') then
34
			if (isNotDamaged(count)) then
35
				print ("Item #"..count.." is NOT damaged")
36
				if (isEnchanted(count)) then 
37
						print ("Item #"..count.." is Enchanted") 
38-
			if (isNotDamaged(count) or item["name"]=='skull') then
38+
39
						Condenser(count)
40
				end
41
			else
42-
						Disenchanter(count)
42+
43
			end
44
		end
45
	end
46
	sleep(5)
47
end