25 lines
903 B
Java
25 lines
903 B
Java
package tech.nevets.vplus.client.mixin;
|
|
|
|
import net.fabricmc.api.EnvType;
|
|
import net.fabricmc.api.Environment;
|
|
import net.minecraft.client.render.GameRenderer;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.injection.At;
|
|
import org.spongepowered.asm.mixin.injection.Inject;
|
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
import tech.nevets.vplus.client.VPZoom;
|
|
|
|
@Environment(EnvType.CLIENT)
|
|
@Mixin(GameRenderer.class)
|
|
public class ZoomMixin {
|
|
@Inject(method = "getFov(Lnet/minecraft/client/render/Camera;FZ)D", at = @At("RETURN"), cancellable = true)
|
|
public void getZoomLevel(CallbackInfoReturnable<Double> callbackInfo) {
|
|
if (VPZoom.isZooming()) {
|
|
double fov = callbackInfo.getReturnValue();
|
|
callbackInfo.setReturnValue(fov * VPZoom.zoomLevel);
|
|
}
|
|
|
|
VPZoom.manageSmoothCamera();
|
|
}
|
|
}
|