forked from Clones/Controlify
fix player look being fps dependant and super slow
This commit is contained in:
@ -55,13 +55,14 @@ public class InGameInputHandler {
|
||||
if (minecraft.mouseHandler.isMouseGrabbed() && minecraft.isWindowActive()) {
|
||||
lookInputX = axes.rightStickX() * Math.abs(axes.rightStickX()) * controller.config().horizontalLookSensitivity;
|
||||
lookInputY = axes.rightStickY() * Math.abs(axes.rightStickY()) * controller.config().verticalLookSensitivity;
|
||||
} else {
|
||||
lookInputX = lookInputY = 0;
|
||||
}
|
||||
|
||||
processPlayerLook(1f);
|
||||
}
|
||||
|
||||
public void processPlayerLook(float deltaTime) {
|
||||
if (minecraft.player != null)
|
||||
minecraft.player.turn(lookInputX * 15f * deltaTime, lookInputY * 15f * deltaTime);
|
||||
if (minecraft.player != null) {
|
||||
minecraft.player.turn(lookInputX * 50f * deltaTime, lookInputY * 50f * deltaTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,6 @@ public abstract class MinecraftMixin {
|
||||
|
||||
@Shadow public abstract float getDeltaFrameTime();
|
||||
|
||||
@Shadow public abstract float getFrameTime();
|
||||
|
||||
@Shadow public abstract ToastComponent getToasts();
|
||||
|
||||
@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"))
|
||||
private void doPlayerLook(boolean tick, CallbackInfo ci) {
|
||||
Controlify.instance().inGameInputHandler().processPlayerLook(getFrameTime());
|
||||
Controlify.instance().inGameInputHandler().processPlayerLook(getDeltaFrameTime());
|
||||
}
|
||||
|
||||
@Inject(method = "<init>", at = @At("TAIL"))
|
||||
|
Reference in New Issue
Block a user