View difference between Paste ID: 9Xr6v57W and 6jgTgcRH
SHOW: | | - or go back to the newest paste.
1
chestFull = false
2
3
function fillSlot(slot)
4
    turtle.select(slot)
5-
	while turtle.getItemCount() < 16 do
5+
	while turtle.getItemCount() < 64 do
6-
        turtle.suck(16-turtle.getItemCount())
6+
        turtle.suck(64-turtle.getItemCount())
7
	end
8
end
9
10
function fillSlotFromUp(slot)
11
    turtle.select(slot)
12
	while turtle.getItemCount() < 64 do
13
        turtle.suckUp(64-turtle.getItemCount())
14
	end
15-
        	dropped, message = turtle.drop()
15+
16
17
function emptyInventory()
18
	for i=1,16 do
19
        turtle.select(i)
20
		item = turtle.getItemDetail()
21
		if item and item.name == "ic2:blockgenerator" then
22
        	dropped, message = turtle.dropDown()
23
24
			if not dropped then
25
				chestFull = true
26
				return
27-
function craftGenerator()
27+
28-
    turtle.select(2)
28+
29-
	while turtle.getItemCount() < 16 do
29+
30-
        turtle.suckUp(16-turtle.getItemCount())
30+
31
    end
32
end
33
34
function craftPanel()
35
	fillSlot(1)
36
	fillSlot(3)
37-
	turtle.turnRight()
37+
38-
	turtle.turnRight()
38+
39
	turtle.turnLeft()
40
41
	fillSlot(2)
42
	fillSlot(5)
43
	fillSlot(7)
44
45
	fillSlotFromUp(9)
46
	fillSlotFromUp(11)
47
48
	turtle.turnLeft()
49
	turtle.turnLeft()
50-
	while redstone.getInput("back") and not chestFull do
50+
51
	fillSlot(10)
52
53-
			craftGenerator()
53+
54
55
	turtle.turnLeft()
56
57
	emptyInventory()
58
end
59
60
while true do
61
	while not chestFull do
62
        emptyInventory()
63
		if not chestFull then
64
			craftPanel()
65
		end
66
	end
67
	sleep(1)
68
end