package de.winniepat.citrus.mixins;

import de.winniepat.citrus.managers.ZoomManager;
import net.minecraft.client.render.*;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(GameRenderer.class)
public class GameRendererMixin {
    @Inject(method = "getFov", at = @At("RETURN"), cancellable = true)
    private void onGetFov(Camera camera, float tickDelta, boolean changingFov, CallbackInfoReturnable<Double> info) {
        if (ZoomManager.isZooming()) {
            double originalFov = info.getReturnValue();
            info.setReturnValue(originalFov / ZoomManager.getZoomMultiplier());
        }
    }
}