Skip to content
This repository was archived by the owner on Oct 18, 2025. It is now read-only.
This repository was archived by the owner on Oct 18, 2025. It is now read-only.

piece of thought: redundant code cause LAN mode failing #71

@fakeboboliu

Description

@fakeboboliu

Many modpacks using this mod, and it causes LAN servers failed to be connected.

Looks like caused by following codes:

public static void joinServer(ClientPlayerNetworkEvent.LoggingIn event) {
if (event.getConnection().isMemoryConnection()) return;
SimpleLogin.logger.debug("Sending login packet to the server...");
NetworkLoader.INSTANCE.sendToServer(new MessageLogin(PasswordHolder.instance().password()));
}

It might be unnecessary for client sending password at the very beginning,
since server sends a request login message while logging in:

NetworkLoader.INSTANCE.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) event.getEntity()), new MessageRequestLogin());

And the client seems handles it correctly:

public static void handle(MessageRequestLogin message, Supplier<NetworkEvent.Context> ctx) {
ctx.get().enqueueWork(() -> {
NetworkLoader.INSTANCE.sendToServer(new MessageLogin(PasswordHolder.instance().password()));
});
ctx.get().setPacketHandled(true);
}

It should be safe to remove those redundant codes in ClientLoader.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions