maruohon / multishot

Multishot Minecraft mod for automatically taking screenshots (for timelapses etc)
http://minecraft.curseforge.com/projects/multishot
GNU Lesser General Public License v3.0
6 stars 1 forks source link

Zoom feature doesn't work with free-cam mode #4

Closed magneticflux- closed 7 years ago

magneticflux- commented 7 years ago

The zoom level is applied all the time, instead of only when a screenshot is being taken.

Version: 1.12.0-3.2.1 Forge Version: 1.12-14.21.1.2420

magneticflux- commented 7 years ago

Additionally, the reverse occurs: When sprinting, the timelapse FOV grows and shrinks suddenly.

magneticflux- commented 7 years ago

@maruohon You can use the EntityViewRenderEvent.FOVModifier event handler to intercept FOVs and adjust them based on if the entity is your free cam entity. At least, that's what it looks like after hunting through some rendering methods. I'm not sure if there's any catch, but it's a start.

EDIT: Making "Zoom" a straight FOV value would probably work better overall, since the freecam and player cam could be just set directly.

magneticflux- commented 7 years ago

I got bored; here's a quick fix to get you started:

    @SubscribeEvent
    @SideOnly(Side.CLIENT)
    public void onFOVModifier(EntityViewRenderEvent.FOVModifier event) {
        if (event.getEntity() == cameraEntity) {
            event.setFOV(Minecraft.getMinecraft().gameSettings.fovSetting);
        }
    }

Just paste that inside the RenderEventHandler class. It sets the freecam's FOV to the user's setting, but it can be re-purposed for your own FOV setting easily.

maruohon commented 7 years ago

I uploaded a new release, let me know if it still has issues. I forgot to test the sprinting case, but at least both the first person and the free camera modes now work with the "Zoom" feature otherwise.

Edit: Okay so sprinting, speed potions etc. still seem to mess with the free camera FOV, but you can avoid that by setting the Zoom value to something other than OFF, for example 0.1x. I'll fix that for the next release as well.