local ingredients = { ['Water Bottle'] = colors.white, ['Nether Wart'] = colors.orange, ['Glowstone Dust'] = colors.magenta, ['Redstone'] = colors.lightBlue, ['Fermented Spider Eye'] = colors.yellow, ['Magma Cream'] = colors.lime, ['Sugar'] = colors.pink, ['Glistering Melon'] = colors.gray, ['Spider Eye'] = colors.cyan, ['Ghast Tear'] = colors.purple, ['Blaze Powder'] = colors.blue, ['Golden Carrot'] = colors.brown, ['Gunpowder'] = colors.green } local recipes = { ['Awkward Potion'] = { 'Water Bottle', 'Nether Wart' }, ['Thick Potion'] = { 'Water Bottle', 'Glowstone Dust' }, ['Speed Potion'] = { 'Awkward Potion', 'Sugar' } } local bottomHopperSide = 'bottom' local bottomHopperColor = colors.white local function valueInTable(t, v) for key, value in pairs(t) do if value == v then return true end end return false end local function isBasicIngredient(s) if ingredients[s] then return true else return false end end local function isRecipeFor(s) if recipes[s] then return true else return false end end local function getWaterBottles(n) for i = 1, n do rs.setBundledOutput('right', ingredients['Water Bottle']) sleep(0.2) rs.setBundledOutput('right', 0) sleep(0.2) end end local function brewPotion(potion, amount, isASub) local amount = amount or 3 rs.setBundledOutput(bottomHopperSide, bottomHopperColor) print('Crafting ' .. amount .. ' of potion "' .. potion .. '"') while amount > 0 do local potionCount = amount if amount > 3 then potionCount = 3 end if isRecipeFor(potion) then for i = 1, #recipes[potion] do local ingredient = recipes[potion][i] print(ingredient) if isBasicIngredient(ingredient) and ingredient ~= 'Water Bottle' then rs.setBundledOutput('right', ingredients[ingredient]) sleep(0.2) rs.setBundledOutput('right', 0) sleep(25) elseif ingredient == 'Water Bottle' then getWaterBottles(potionCount) else local status = brewPotion(ingredient, potionCount, true) if status and not isASub and i == #recipes[potion] then rs.setBundledOutput(bottomHopperSide, 0) end end end else return false end amount = amount - potionCount end return true end brewPotion('Speed Potion', 6)