24 lines
880 B
Java
24 lines
880 B
Java
package tech.nevets.vplus.clientmixin;
|
|
|
|
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.init.ZoomInit;
|
|
import tech.nevets.vplus.misc.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(ZoomInit.isZooming()) {
|
|
callbackInfo.setReturnValue(VPZoom.zoomLevel);
|
|
}
|
|
ZoomInit.manageSmoothCamera();
|
|
}
|
|
}
|