View difference between Paste ID: 6jgTgcRH and z0pkQzU0
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
6
        turtle.suck(16-turtle.getItemCount())
7
	end
8
end
9
10
function emptyInventory()
11
	for i=1,16 do
12
        turtle.select(i)
13
		item = turtle.getItemDetail()
14-
		if item and item.name == "ic2:itembatre" then
14+
		if item and item.name == "ic2:blockgenerator" then
15
        	dropped, message = turtle.drop()
16
17
			if not dropped then
18
				chestFull = true
19
				return
20
            else
21
                chestFull = false
22
			end
23
		end
24
    end
25
end
26
27-
function craftBattery()
27+
function craftGenerator()
28
    turtle.select(2)
29
	while turtle.getItemCount() < 16 do
30-
    
30+
        turtle.suckUp(16-turtle.getItemCount())
31-
	turtle.select(2)
31+
32
33-
       	turtle.suckUp(16-turtle.getItemCount())
33+
	turtle.turnLeft()
34
35
	fillSlot(6)
36-
    fillSlot(5)
36+
	
37-
	fillSlot(7)
37+
38-
    fillSlot(9)
38+
39-
	fillSlot(11)
39+
40
	fillSlot(10)
41
42
    turtle.craft()
43
44
	turtle.turnLeft()
45
46
	emptyInventory()
47
end
48
49
while true do
50
	while redstone.getInput("back") and not chestFull do
51
        emptyInventory()
52
		if not chestFull then
53
			craftGenerator()
54-
	while not chestFull do
54+
55
	end
56
	sleep(1)
57-
			craftBattery()
57+