diff --git a/README.md b/README.md index c704356..7c47626 100644 --- a/README.md +++ b/README.md @@ -20,25 +20,25 @@ The container build can be a bit slow the first time, be warned. If you're in a There are two ways to do this: -- Java edition of Minecraft. This has a nice desktop icon, but it means the code needs to be upgraded every time a new client is released. The libraries do not have much backwards compatibility between releases. -- The client in the Forge Minecraft library. This ensures compatibility with the server. You may need to set `online-mode` to false on the server. To launch it, run +The best way to connect a client us to use the client in the Forge Minecraft library. This ensures compatibility with the server. To launch it, run ``` cd modded-minecraft ./gradlew runClient ``` -In either case, start a multiplayer game, and connect to `localhost:25565`. +Start a multiplayer game, and connect to `localhost:25565`. -You will need to configure the client to allow you to `alt-tab` away from the client without it pausing and bringing up +### Using the 'official' launcher and the Java edition of Minecraft + +You can also use the normal Minecraft launcher, but only if the client and server versions exactly match. +Using the official client will allow you may need to set `online-mode` to true on the server, and get rid of a warning. + +If using the official client, which will be un-modded, you will need to configure the client to allow you to `alt-tab` away from the client without it pausing and bringing up a menu. Edit `options.txt` in your [minecraft folder](https://gaming.stackexchange.com/questions/15664/can-i-alt-tab-out-of-minecraft-without-the-game-auto-pausing) , and change `pauseOnLostFocus` to `false`. -``` -pauseOnLostFocus:false -``` - ### Build the extension ```bash diff --git a/modded-minecraft/src/main/java/com/example/examplemod/ExampleMod.java b/modded-minecraft/src/main/java/com/example/examplemod/ExampleMod.java index b2f7d3e..6dffbbe 100644 --- a/modded-minecraft/src/main/java/com/example/examplemod/ExampleMod.java +++ b/modded-minecraft/src/main/java/com/example/examplemod/ExampleMod.java @@ -2,6 +2,7 @@ import com.mojang.logging.LogUtils; +import net.minecraft.client.Minecraft; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Player; import net.minecraftforge.common.MinecraftForge; @@ -40,6 +41,9 @@ public ExampleMod() { // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); + + // Keep the game running when tabbing away + Minecraft.getInstance().options.pauseOnLostFocus = false; } private void setup(final FMLCommonSetupEvent event) {