Skip to content

Commit

Permalink
Game will no longer pause if virtual mouse is enabled and controller …
Browse files Browse the repository at this point in the history
…is connected
  • Loading branch information
MrCrayfish committed Feb 10, 2021
1 parent fe5e5ca commit f5d4e9b
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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);
}
}
}

0 comments on commit f5d4e9b

Please sign in to comment.