Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ae = peripheral.wrap("left")
- function getAEId(id, meta)
- return meta*32768 + id
- end
- potions = {
- ["regen"] = getAEId(373, 8193),
- ["fire resist"] = getAEId(373, 8195),
- ["strength"] = getAEId(373, 8201),
- ["swiftness"] = getAEId(373, 8194),
- }
- rightTriggers = {
- [colors.white] = "regen",
- [colors.orange] = "fire resist",
- [colors.magenta] = "swiftness",
- [colors.lightBlue] = "strength",
- }
- topTriggers = {}
- while true do
- color = redstone.getBundledInput("right")
- potion = rightTriggers[color]
- if potion == nil then
- color = redstone.getBundledInput("top")
- potion = topTriggers[color]
- end
- if not(potion == nil) then
- potionId = potions[potion]
- items = ae.listItems()
- if items[potionId] == nil then
- ae.craft(potionId, 1)
- count = 0
- repeat
- items = ae.listItems()
- count = items[potionId]
- sleep(1)
- until count >= 3
- end
- turtle.select(1)
- ae.retrieve(potionId, 3, 4)
- for n=1,3 do
- turtle.select(n)
- turtle.drop()
- end
- -- tell player potions are in the chest ready for use
- -- give potions a bit of time to travel from turtle to the output chest
- sleep(10)
- -- assuming you have a lamp or something hooked up to the black channel, blink it
- redstone.setBundledOutput("right", colors.black)
- sleep(2)
- redstone.setBundledOutput("right", 0)
- end
- sleep(0.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement