SHOW:
|
|
- or go back to the newest paste.
1 | ae = peripheral.wrap("left") | |
2 | ||
3 | function getAEId(id, meta) | |
4 | return meta*32768 + id | |
5 | end | |
6 | ||
7 | potions = { | |
8 | ["regen"] = getAEId(373, 8193), | |
9 | ["fire resist"] = getAEId(373, 8195), | |
10 | ["strength"] = getAEId(373, 8201), | |
11 | ["swiftness"] = getAEId(373, 8194), | |
12 | } | |
13 | ||
14 | rightTriggers = { | |
15 | [colors.white] = "regen", | |
16 | [colors.orange] = "fire resist", | |
17 | [colors.magenta] = "swiftness", | |
18 | [colors.lightBlue] = "strength", | |
19 | } | |
20 | ||
21 | topTriggers = {} | |
22 | ||
23 | while true do | |
24 | ||
25 | color = redstone.getBundledInput("right") | |
26 | potion = rightTriggers[color] | |
27 | if potion == nil then | |
28 | color = redstone.getBundledInput("top") | |
29 | potion = topTriggers[color] | |
30 | end | |
31 | ||
32 | if not(potion == nil) then | |
33 | potionId = potions[potion] | |
34 | items = ae.listItems() | |
35 | if items[potionId] == nil then | |
36 | ae.craft(potionId, 1) | |
37 | count = 0 | |
38 | ||
39 | repeat | |
40 | items = ae.listItems() | |
41 | count = items[potionId] | |
42 | sleep(1) | |
43 | until count >= 3 | |
44 | end | |
45 | ||
46 | turtle.select(1) | |
47 | ||
48 | ae.retrieve(potionId, 3, 4) | |
49 | ||
50 | for n=1,3 do | |
51 | turtle.select(n) | |
52 | turtle.drop() | |
53 | end | |
54 | ||
55 | -- tell player potions are in the chest ready for use | |
56 | -- give potions a bit of time to travel from turtle to the output chest | |
57 | sleep(10) | |
58 | -- assuming you have a lamp or something hooked up to the black channel, blink it | |
59 | redstone.setBundledOutput("right", colors.black) | |
60 | sleep(2) | |
61 | redstone.setBundledOutput("right", 0) | |
62 | end | |
63 | sleep(0.1) | |
64 | end |