1
0
forked from Clones/Controlify

fix player look being fps dependant and super slow

This commit is contained in:
isXander
2023-02-12 13:18:11 +00:00
parent 234f382cc3
commit 153e3e5102
2 changed files with 6 additions and 7 deletions

View File

@ -55,13 +55,14 @@ public class InGameInputHandler {
if (minecraft.mouseHandler.isMouseGrabbed() && minecraft.isWindowActive()) { if (minecraft.mouseHandler.isMouseGrabbed() && minecraft.isWindowActive()) {
lookInputX = axes.rightStickX() * Math.abs(axes.rightStickX()) * controller.config().horizontalLookSensitivity; lookInputX = axes.rightStickX() * Math.abs(axes.rightStickX()) * controller.config().horizontalLookSensitivity;
lookInputY = axes.rightStickY() * Math.abs(axes.rightStickY()) * controller.config().verticalLookSensitivity; lookInputY = axes.rightStickY() * Math.abs(axes.rightStickY()) * controller.config().verticalLookSensitivity;
} else {
lookInputX = lookInputY = 0;
} }
processPlayerLook(1f);
} }
public void processPlayerLook(float deltaTime) { public void processPlayerLook(float deltaTime) {
if (minecraft.player != null) if (minecraft.player != null) {
minecraft.player.turn(lookInputX * 15f * deltaTime, lookInputY * 15f * deltaTime); minecraft.player.turn(lookInputX * 50f * deltaTime, lookInputY * 50f * deltaTime);
}
} }
} }

View File

@ -23,8 +23,6 @@ public abstract class MinecraftMixin {
@Shadow public abstract float getDeltaFrameTime(); @Shadow public abstract float getDeltaFrameTime();
@Shadow public abstract float getFrameTime();
@Shadow public abstract ToastComponent getToasts(); @Shadow public abstract ToastComponent getToasts();
@Inject(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/KeyboardHandler;setup(J)V", shift = At.Shift.AFTER)) @Inject(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/KeyboardHandler;setup(J)V", shift = At.Shift.AFTER))
@ -34,7 +32,7 @@ public abstract class MinecraftMixin {
@Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MouseHandler;turnPlayer()V")) @Inject(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MouseHandler;turnPlayer()V"))
private void doPlayerLook(boolean tick, CallbackInfo ci) { private void doPlayerLook(boolean tick, CallbackInfo ci) {
Controlify.instance().inGameInputHandler().processPlayerLook(getFrameTime()); Controlify.instance().inGameInputHandler().processPlayerLook(getDeltaFrameTime());
} }
@Inject(method = "<init>", at = @At("TAIL")) @Inject(method = "<init>", at = @At("TAIL"))