Improve Optifine compatibility.  Fixes #377.