#is it possible to make client join the server on minecraft start? like quickplay thingy?

22 messages · Page 1 of 1 (latest)

rocky trout
#

is it possible to make client join the server on minecraft start? like quickplay thingy?

gusty kestrel
#

through a mod?

rocky trout
gusty kestrel
#

yes but why?

#

quickplay is already available

rocky trout
#

im developing a mod and i want to develop something similar so i need to learn the basics, basically

gusty kestrel
#

look at how quickplay works then

rocky trout
#

cant i do like in mod, client.connect etc?

gusty kestrel
#

quickplay works with a program argument

rocky trout
#

thats what chat gpt gives me but its not working

`import net.fabricmc.api.ModInitializer;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayNetworkHandler;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.packet.s2c.play.ConnectedToServerS2CPacket;
import net.minecraft.network.packet.s2c.play.DisconnectS2CPacket;

public class AutoConnectMod implements ModInitializer {

private static final String SERVER_ADDRESS = "yourserver.example.com";
private static final int SERVER_PORT = 25565; // Değiştirin

@Override
public void onInitialize() {
    // Mod başlatıldığında sunucuya bağlanma işlemi yapılacak.
    MinecraftClient client = MinecraftClient.getInstance();
    client.execute(() -> {
        ClientPlayNetworkHandler networkHandler = client.getNetworkHandler();
        if (networkHandler != null) {
            ClientConnection connection = new ClientConnection();
            networkHandler.connect(SERVER_ADDRESS, SERVER_PORT);
        }
    });
}

}
`

gusty kestrel
#

i'm not reading llm code concern

#

see how the game connects to servers from the multiplayer screen

#

then use that

rocky trout
#

i mean i just want to explain what i need

#

im beginner thats why im here

prisma thorn
#

what they're trying to say is that you may want to read the vanilla code as they do not know every detail of how the game works

gusty kestrel
#

i gave you the best answer i have. look at how minecraft already does it

rocky trout
#

how can i look or read that code

gray crypt
rocky trout
#

im trying to learn

gray crypt