Fix for MC-13206

It's a bit ugly, but it works perfectly. If someone wants to rewrite it to look better, feel free.
Sphax BDCraft 256x goes up from 2 fps to 50 fps using this fix.

The issue on Mojang's bug tracker: https://mojang.atlassian.net/browse/MC-13206