1
0
forked from Clones/Controlify

🐛 Fix some issue when hotplugging controllers in-game

This commit is contained in:
isXander
2023-07-25 20:59:26 +01:00
parent c708c818a6
commit 8c29f6c6a3
2 changed files with 4 additions and 5 deletions

View File

@ -480,11 +480,8 @@ public class Controlify implements ControlifyApi {
}
this.inGameInputHandler = new InGameInputHandler(controller);
if (minecraft.player != null) {
this.inGameButtonGuide = new InGameButtonGuide(controller, minecraft.player);
}
ControllerPlayerMovement.updatePlayerInput(minecraft.player);
setInputMode(controller.config().mixedInput ? InputMode.MIXED : InputMode.CONTROLLER);
if (!controller.config().deadzonesCalibrated)
calibrationQueue.add(controller);
@ -537,6 +534,8 @@ public class Controlify implements ControlifyApi {
if (this.currentInputMode.isController())
getCurrentController().ifPresent(Controller::clearState);
ControllerPlayerMovement.updatePlayerInput(minecraft.player);
ControlifyEvents.INPUT_MODE_CHANGED.invoker().onInputModeChanged(currentInputMode);
return true;

View File

@ -75,7 +75,7 @@ public class ControllerPlayerMovement extends Input {
if (player == null)
return;
if (Controlify.instance().getCurrentController().isPresent()) {
if (Controlify.instance().getCurrentController().isPresent() && Controlify.instance().currentInputMode().isController()) {
player.input = new DualInput(
new KeyboardInput(Minecraft.getInstance().options),
new ControllerPlayerMovement(Controlify.instance().getCurrentController().get(), player)