forked from Clones/Controlify
compound binds, complete vanilla compat, better vmouse screen handling, controller uuid, beta notice screen, configurable movement keys, vmouse shift key, icon, optimize controller save/load
This commit is contained in:
@ -25,25 +25,23 @@ public class ControllerPlayerMovement extends Input {
|
||||
return;
|
||||
}
|
||||
|
||||
var axes = controller.state().axes();
|
||||
var bindings = controller.bindings();
|
||||
|
||||
this.up = axes.leftStickY() < 0;
|
||||
this.down = axes.leftStickY() > 0;
|
||||
this.left = axes.leftStickX() < 0;
|
||||
this.right = axes.leftStickX() > 0;
|
||||
this.leftImpulse = -axes.leftStickX();
|
||||
this.forwardImpulse = -axes.leftStickY();
|
||||
this.forwardImpulse = bindings.WALK_FORWARD.state() - bindings.WALK_BACKWARD.state();
|
||||
this.leftImpulse = bindings.WALK_LEFT.state() - bindings.WALK_RIGHT.state();
|
||||
|
||||
// .1 to prevent using boat turning absolute hell with left/right left/right
|
||||
this.up = bindings.WALK_FORWARD.state() > 0.1;
|
||||
this.down = bindings.WALK_BACKWARD.state() > 0.1;
|
||||
this.left = bindings.WALK_LEFT.state() > 0.1;
|
||||
this.right = bindings.WALK_RIGHT.state() > 0.1;
|
||||
|
||||
if (slowDown) {
|
||||
this.leftImpulse *= f;
|
||||
this.forwardImpulse *= f;
|
||||
}
|
||||
|
||||
var bindings = controller.bindings();
|
||||
|
||||
this.jumping = bindings.JUMP.held();
|
||||
if (bindings.SNEAK.justPressed()) {
|
||||
this.shiftKeyDown = !this.shiftKeyDown;
|
||||
}
|
||||
this.shiftKeyDown = bindings.SNEAK.held();
|
||||
}
|
||||
}
|
||||
|
@ -34,17 +34,20 @@ public class InGameInputHandler {
|
||||
}
|
||||
|
||||
public void inputTick() {
|
||||
var axes = controller.state().axes();
|
||||
if (minecraft.mouseHandler.isMouseGrabbed() && minecraft.isWindowActive()) {
|
||||
accumulatedDX += axes.rightStickX();
|
||||
accumulatedDY += axes.rightStickY();
|
||||
}
|
||||
handlePlayerLookInput();
|
||||
handleKeybinds();
|
||||
}
|
||||
|
||||
processPlayerLook();
|
||||
protected void handleKeybinds() {
|
||||
if (Minecraft.getInstance().screen != null && !Minecraft.getInstance().screen.passEvents)
|
||||
return;
|
||||
|
||||
if (controller.bindings().PAUSE.justPressed()) {
|
||||
minecraft.pauseGame(false);
|
||||
}
|
||||
if (controller.bindings().TOGGLE_DEBUG_MENU.justPressed()) {
|
||||
minecraft.options.renderDebug = !minecraft.options.renderDebug;
|
||||
}
|
||||
if (minecraft.player != null) {
|
||||
if (controller.bindings().NEXT_SLOT.justPressed()) {
|
||||
minecraft.player.getInventory().swapPaint(-1);
|
||||
@ -55,6 +58,16 @@ public class InGameInputHandler {
|
||||
}
|
||||
}
|
||||
|
||||
protected void handlePlayerLookInput() {
|
||||
var axes = controller.state().axes();
|
||||
if (minecraft.mouseHandler.isMouseGrabbed() && minecraft.isWindowActive()) {
|
||||
accumulatedDX += axes.rightStickX();
|
||||
accumulatedDY += axes.rightStickY();
|
||||
}
|
||||
|
||||
processPlayerLook();
|
||||
}
|
||||
|
||||
public void processPlayerLook() {
|
||||
var time = Blaze3D.getTime();
|
||||
var delta = time - deltaTime;
|
||||
|
Reference in New Issue
Block a user