forked from Clones/Controlify
🐛 Fix some issue when hotplugging controllers in-game
This commit is contained in:
@ -480,11 +480,8 @@ public class Controlify implements ControlifyApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.inGameInputHandler = new InGameInputHandler(controller);
|
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)
|
if (!controller.config().deadzonesCalibrated)
|
||||||
calibrationQueue.add(controller);
|
calibrationQueue.add(controller);
|
||||||
@ -537,6 +534,8 @@ public class Controlify implements ControlifyApi {
|
|||||||
if (this.currentInputMode.isController())
|
if (this.currentInputMode.isController())
|
||||||
getCurrentController().ifPresent(Controller::clearState);
|
getCurrentController().ifPresent(Controller::clearState);
|
||||||
|
|
||||||
|
ControllerPlayerMovement.updatePlayerInput(minecraft.player);
|
||||||
|
|
||||||
ControlifyEvents.INPUT_MODE_CHANGED.invoker().onInputModeChanged(currentInputMode);
|
ControlifyEvents.INPUT_MODE_CHANGED.invoker().onInputModeChanged(currentInputMode);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -75,7 +75,7 @@ public class ControllerPlayerMovement extends Input {
|
|||||||
if (player == null)
|
if (player == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Controlify.instance().getCurrentController().isPresent()) {
|
if (Controlify.instance().getCurrentController().isPresent() && Controlify.instance().currentInputMode().isController()) {
|
||||||
player.input = new DualInput(
|
player.input = new DualInput(
|
||||||
new KeyboardInput(Minecraft.getInstance().options),
|
new KeyboardInput(Minecraft.getInstance().options),
|
||||||
new ControllerPlayerMovement(Controlify.instance().getCurrentController().get(), player)
|
new ControllerPlayerMovement(Controlify.instance().getCurrentController().get(), player)
|
||||||
|
Reference in New Issue
Block a user