From f5d4e9b9bf5b9c49cba7f142600d1e8dbbf75f6b Mon Sep 17 00:00:00 2001 From: MrCrayfish Date: Thu, 11 Feb 2021 02:01:44 +1030 Subject: [PATCH] Game will no longer pause if virtual mouse is enabled and controller is connected --- .../controllable/mixin/client/GameRendererMixin.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/mrcrayfish/controllable/mixin/client/GameRendererMixin.java b/src/main/java/com/mrcrayfish/controllable/mixin/client/GameRendererMixin.java index 2dc8d2bb..505d390c 100644 --- a/src/main/java/com/mrcrayfish/controllable/mixin/client/GameRendererMixin.java +++ b/src/main/java/com/mrcrayfish/controllable/mixin/client/GameRendererMixin.java @@ -8,6 +8,7 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArgs; +import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.invoke.arg.Args; /** @@ -32,4 +33,13 @@ private void drawScreen(Args args) args.set(3, mouseY); } } + + @Redirect(method = "updateCameraAndRender", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;displayInGameMenu(Z)V")) + private void onPause(Minecraft minecraft, boolean pauseOnly) + { + if(Controllable.getController() == null || !Config.CLIENT.options.virtualMouse.get()) + { + minecraft.displayInGameMenu(false); + } + } }