Merge pull request #62 from saturnclientmc/zoom-and-freelok-animation

Zoom and freelok animations
This commit is contained in:
Kr4ight
2026-03-26 23:57:35 +01:00
committed by GitHub
8 changed files with 14 additions and 10 deletions
+1 -1
Submodule common updated: 53dfa37b64...d73895ac7c
@@ -26,7 +26,7 @@ public abstract class CameraMixin {
@Inject(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;setRotation(FF)V", ordinal = 1, shift = At.Shift.AFTER))
public void lockRotation(BlockView focusedBlock, Entity cameraEntity, boolean isThirdPerson, boolean isFrontFacing,
float tickDelta, CallbackInfo ci) {
if (FreelookMod.isFreeLooking && cameraEntity instanceof ClientPlayerEntity) {
if (FreelookMod.isFreeLooking() && cameraEntity instanceof ClientPlayerEntity) {
CameraOverriddenEntity cameraOverriddenEntity = (CameraOverriddenEntity) cameraEntity;
if (firstTime && SaturnClient.client.player != null) {
@@ -38,7 +38,7 @@ public abstract class CameraMixin {
cameraOverriddenEntity.freelook$getCameraPitch());
}
if (!FreelookMod.isFreeLooking && cameraEntity instanceof ClientPlayerEntity) {
if (!FreelookMod.isFreeLooking() && cameraEntity instanceof ClientPlayerEntity) {
firstTime = true;
}
}
@@ -24,7 +24,7 @@ public class EntityMixin implements CameraOverriddenEntity {
public void changeCameraLookDirection(double xDelta, double yDelta, CallbackInfo ci) {
// noinspection ConstantValue// IntelliJ is incorrect here, this code block is
// reachable
if (FreelookMod.isFreeLooking && (Object) this instanceof ClientPlayerEntity) {
if (FreelookMod.isFreeLooking() && (Object) this instanceof ClientPlayerEntity) {
double pitchDelta = (yDelta * 0.15);
double yawDelta = (xDelta * 0.15);
@@ -2,6 +2,7 @@ package org.saturnclient.impl.features.mixins.render;
import net.minecraft.client.render.GameRenderer;
import org.saturnclient.mod.mods.FreelookMod;
import org.saturnclient.mod.mods.ZoomMod;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -32,6 +33,9 @@ public class GameRendererMixin {
if (ZoomMod.shouldZoom()) {
float zoomedFov = cir.getReturnValue() / ZoomMod.getZoomLevel();
cir.setReturnValue(zoomedFov);
} else if (FreelookMod.shouldZoomOut()) {
float zoomedFov = cir.getReturnValue() / FreelookMod.getZoomLevel();
cir.setReturnValue(zoomedFov);
}
}
}
@@ -26,7 +26,7 @@ public abstract class CameraMixin {
@Inject(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;setRotation(FF)V", ordinal = 1, shift = At.Shift.AFTER))
public void lockRotation(BlockView focusedBlock, Entity cameraEntity, boolean isThirdPerson, boolean isFrontFacing,
float tickDelta, CallbackInfo ci) {
if (FreelookMod.isFreeLooking && cameraEntity instanceof ClientPlayerEntity) {
if (FreelookMod.isFreeLooking() && cameraEntity instanceof ClientPlayerEntity) {
CameraOverriddenEntity cameraOverriddenEntity = (CameraOverriddenEntity) cameraEntity;
if (firstTime && SaturnClient.client.player != null) {
@@ -38,7 +38,7 @@ public abstract class CameraMixin {
cameraOverriddenEntity.freelook$getCameraPitch());
}
if (!FreelookMod.isFreeLooking && cameraEntity instanceof ClientPlayerEntity) {
if (!FreelookMod.isFreeLooking() && cameraEntity instanceof ClientPlayerEntity) {
firstTime = true;
}
}
@@ -24,7 +24,7 @@ public class EntityMixin implements CameraOverriddenEntity {
public void changeCameraLookDirection(double xDelta, double yDelta, CallbackInfo ci) {
// noinspection ConstantValue// IntelliJ is incorrect here, this code block is
// reachable
if (FreelookMod.isFreeLooking && (Object) this instanceof ClientPlayerEntity) {
if (FreelookMod.isFreeLooking() && (Object) this instanceof ClientPlayerEntity) {
double pitchDelta = (yDelta * 0.15);
double yawDelta = (xDelta * 0.15);
@@ -26,7 +26,7 @@ public abstract class CameraMixin {
@Inject(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;setRotation(FF)V", ordinal = 1, shift = At.Shift.AFTER))
public void lockRotation(BlockView focusedBlock, Entity cameraEntity, boolean isThirdPerson, boolean isFrontFacing,
float tickDelta, CallbackInfo ci) {
if (FreelookMod.isFreeLooking && cameraEntity instanceof ClientPlayerEntity) {
if (FreelookMod.isFreeLooking() && cameraEntity instanceof ClientPlayerEntity) {
CameraOverriddenEntity cameraOverriddenEntity = (CameraOverriddenEntity) cameraEntity;
if (firstTime && SaturnClient.client.player != null) {
@@ -38,7 +38,7 @@ public abstract class CameraMixin {
cameraOverriddenEntity.freelook$getCameraPitch());
}
if (!FreelookMod.isFreeLooking && cameraEntity instanceof ClientPlayerEntity) {
if (!FreelookMod.isFreeLooking() && cameraEntity instanceof ClientPlayerEntity) {
firstTime = true;
}
}
@@ -24,7 +24,7 @@ public class EntityMixin implements CameraOverriddenEntity {
public void changeCameraLookDirection(double xDelta, double yDelta, CallbackInfo ci) {
// noinspection ConstantValue// IntelliJ is incorrect here, this code block is
// reachable
if (FreelookMod.isFreeLooking && (Object) this instanceof ClientPlayerEntity) {
if (FreelookMod.isFreeLooking() && (Object) this instanceof ClientPlayerEntity) {
double pitchDelta = (yDelta * 0.15);
double yawDelta = (xDelta * 0.15);