In the past, when I needed a zoom function for my mod, I've either added a method in EntityRenderer to set cameraZoom or I've simply made cameraZoom public. However, modifying this class creates incompatibilities with several mods (including Optifine) and is generally very clunky. If anyone knows a way to zoom in the camera without having to modify EntityRenderer or any other vanilla classes, please share it. My current code is simply copied and pasted from EntityRenderer, and has no effect on the camera.
EDIT: Shortly after making this thread, I did a search and found another thread (ironically, also posted by me; I must have unfollowed it before the answer was posted) with the answer. For anyone else with the same problem use this code:
Class c = EntityRenderer.class;
Object o = Minecraft.getMinecraft().entityRenderer;
ReflectionHelper.setPrivateValue(c, o, 5, 34);
5 is the value I want to set it to (in this case, 5x zoom), and 34 is the field number for cameraZoom.
I'm using Forge, but if you're using ModLoader just replace "ReflectionHelper" with "ModLoader" and you should be fine.