@wolfie This is an optifine issue. Unfortunately I do not know how to solve it besides removing optifine completely.
Delete it from these two locations and restart:
.minecraft/libraries/EMC/(mc version) .minecraft/libraries/me/deftware/EMC-F-v2/latest-(mc version)