Like DC said, you need the version of OptiFine you're using to match the version of Minecraft. So if you wanted to use it on Famcraft, you'd need Optifine 1.12.2 installed. However, if you also wanted OptiFine for 1.8.9, you need to separately download OptiFine 1.8.9, if that makes sense.