Working freelook
This commit is contained in:
+1
-1
Submodule common updated: 53dfa37b64...7eb8b6a120
+2
-2
@@ -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))
|
@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,
|
public void lockRotation(BlockView focusedBlock, Entity cameraEntity, boolean isThirdPerson, boolean isFrontFacing,
|
||||||
float tickDelta, CallbackInfo ci) {
|
float tickDelta, CallbackInfo ci) {
|
||||||
if (FreelookMod.isFreeLooking && cameraEntity instanceof ClientPlayerEntity) {
|
if (FreelookMod.isFreeLooking() && cameraEntity instanceof ClientPlayerEntity) {
|
||||||
CameraOverriddenEntity cameraOverriddenEntity = (CameraOverriddenEntity) cameraEntity;
|
CameraOverriddenEntity cameraOverriddenEntity = (CameraOverriddenEntity) cameraEntity;
|
||||||
|
|
||||||
if (firstTime && SaturnClient.client.player != null) {
|
if (firstTime && SaturnClient.client.player != null) {
|
||||||
@@ -38,7 +38,7 @@ public abstract class CameraMixin {
|
|||||||
cameraOverriddenEntity.freelook$getCameraPitch());
|
cameraOverriddenEntity.freelook$getCameraPitch());
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!FreelookMod.isFreeLooking && cameraEntity instanceof ClientPlayerEntity) {
|
if (!FreelookMod.isFreeLooking() && cameraEntity instanceof ClientPlayerEntity) {
|
||||||
firstTime = true;
|
firstTime = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ public class EntityMixin implements CameraOverriddenEntity {
|
|||||||
public void changeCameraLookDirection(double xDelta, double yDelta, CallbackInfo ci) {
|
public void changeCameraLookDirection(double xDelta, double yDelta, CallbackInfo ci) {
|
||||||
// noinspection ConstantValue// IntelliJ is incorrect here, this code block is
|
// noinspection ConstantValue// IntelliJ is incorrect here, this code block is
|
||||||
// reachable
|
// reachable
|
||||||
if (FreelookMod.isFreeLooking && (Object) this instanceof ClientPlayerEntity) {
|
if (FreelookMod.isFreeLooking() && (Object) this instanceof ClientPlayerEntity) {
|
||||||
double pitchDelta = (yDelta * 0.15);
|
double pitchDelta = (yDelta * 0.15);
|
||||||
double yawDelta = (xDelta * 0.15);
|
double yawDelta = (xDelta * 0.15);
|
||||||
|
|
||||||
|
|||||||
+4
@@ -2,6 +2,7 @@ package org.saturnclient.impl.features.mixins.render;
|
|||||||
|
|
||||||
import net.minecraft.client.render.GameRenderer;
|
import net.minecraft.client.render.GameRenderer;
|
||||||
|
|
||||||
|
import org.saturnclient.mod.mods.FreelookMod;
|
||||||
import org.saturnclient.mod.mods.ZoomMod;
|
import org.saturnclient.mod.mods.ZoomMod;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -32,6 +33,9 @@ public class GameRendererMixin {
|
|||||||
if (ZoomMod.shouldZoom()) {
|
if (ZoomMod.shouldZoom()) {
|
||||||
float zoomedFov = cir.getReturnValue() / ZoomMod.getZoomLevel();
|
float zoomedFov = cir.getReturnValue() / ZoomMod.getZoomLevel();
|
||||||
cir.setReturnValue(zoomedFov);
|
cir.setReturnValue(zoomedFov);
|
||||||
|
} else if (FreelookMod.shouldZoomOut()) {
|
||||||
|
float zoomedFov = cir.getReturnValue() / FreelookMod.getZoomLevel();
|
||||||
|
cir.setReturnValue(zoomedFov);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -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))
|
@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,
|
public void lockRotation(BlockView focusedBlock, Entity cameraEntity, boolean isThirdPerson, boolean isFrontFacing,
|
||||||
float tickDelta, CallbackInfo ci) {
|
float tickDelta, CallbackInfo ci) {
|
||||||
if (FreelookMod.isFreeLooking && cameraEntity instanceof ClientPlayerEntity) {
|
if (FreelookMod.isFreeLooking() && cameraEntity instanceof ClientPlayerEntity) {
|
||||||
CameraOverriddenEntity cameraOverriddenEntity = (CameraOverriddenEntity) cameraEntity;
|
CameraOverriddenEntity cameraOverriddenEntity = (CameraOverriddenEntity) cameraEntity;
|
||||||
|
|
||||||
if (firstTime && SaturnClient.client.player != null) {
|
if (firstTime && SaturnClient.client.player != null) {
|
||||||
@@ -38,7 +38,7 @@ public abstract class CameraMixin {
|
|||||||
cameraOverriddenEntity.freelook$getCameraPitch());
|
cameraOverriddenEntity.freelook$getCameraPitch());
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!FreelookMod.isFreeLooking && cameraEntity instanceof ClientPlayerEntity) {
|
if (!FreelookMod.isFreeLooking() && cameraEntity instanceof ClientPlayerEntity) {
|
||||||
firstTime = true;
|
firstTime = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ public class EntityMixin implements CameraOverriddenEntity {
|
|||||||
public void changeCameraLookDirection(double xDelta, double yDelta, CallbackInfo ci) {
|
public void changeCameraLookDirection(double xDelta, double yDelta, CallbackInfo ci) {
|
||||||
// noinspection ConstantValue// IntelliJ is incorrect here, this code block is
|
// noinspection ConstantValue// IntelliJ is incorrect here, this code block is
|
||||||
// reachable
|
// reachable
|
||||||
if (FreelookMod.isFreeLooking && (Object) this instanceof ClientPlayerEntity) {
|
if (FreelookMod.isFreeLooking() && (Object) this instanceof ClientPlayerEntity) {
|
||||||
double pitchDelta = (yDelta * 0.15);
|
double pitchDelta = (yDelta * 0.15);
|
||||||
double yawDelta = (xDelta * 0.15);
|
double yawDelta = (xDelta * 0.15);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -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))
|
@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,
|
public void lockRotation(BlockView focusedBlock, Entity cameraEntity, boolean isThirdPerson, boolean isFrontFacing,
|
||||||
float tickDelta, CallbackInfo ci) {
|
float tickDelta, CallbackInfo ci) {
|
||||||
if (FreelookMod.isFreeLooking && cameraEntity instanceof ClientPlayerEntity) {
|
if (FreelookMod.isFreeLooking() && cameraEntity instanceof ClientPlayerEntity) {
|
||||||
CameraOverriddenEntity cameraOverriddenEntity = (CameraOverriddenEntity) cameraEntity;
|
CameraOverriddenEntity cameraOverriddenEntity = (CameraOverriddenEntity) cameraEntity;
|
||||||
|
|
||||||
if (firstTime && SaturnClient.client.player != null) {
|
if (firstTime && SaturnClient.client.player != null) {
|
||||||
@@ -38,7 +38,7 @@ public abstract class CameraMixin {
|
|||||||
cameraOverriddenEntity.freelook$getCameraPitch());
|
cameraOverriddenEntity.freelook$getCameraPitch());
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!FreelookMod.isFreeLooking && cameraEntity instanceof ClientPlayerEntity) {
|
if (!FreelookMod.isFreeLooking() && cameraEntity instanceof ClientPlayerEntity) {
|
||||||
firstTime = true;
|
firstTime = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ public class EntityMixin implements CameraOverriddenEntity {
|
|||||||
public void changeCameraLookDirection(double xDelta, double yDelta, CallbackInfo ci) {
|
public void changeCameraLookDirection(double xDelta, double yDelta, CallbackInfo ci) {
|
||||||
// noinspection ConstantValue// IntelliJ is incorrect here, this code block is
|
// noinspection ConstantValue// IntelliJ is incorrect here, this code block is
|
||||||
// reachable
|
// reachable
|
||||||
if (FreelookMod.isFreeLooking && (Object) this instanceof ClientPlayerEntity) {
|
if (FreelookMod.isFreeLooking() && (Object) this instanceof ClientPlayerEntity) {
|
||||||
double pitchDelta = (yDelta * 0.15);
|
double pitchDelta = (yDelta * 0.15);
|
||||||
double yawDelta = (xDelta * 0.15);
|
double yawDelta = (xDelta * 0.15);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user