mirror of
https://github.com/FabricMC/fabric.git
synced 2025-09-07 03:39:18 +00:00
fix login network addon not properly initialized (#3531)
(cherry picked from commit bf1eca5483
)
This commit is contained in:
@@ -18,7 +18,6 @@ package net.fabricmc.fabric.impl.networking.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import io.netty.util.concurrent.Future;
|
||||
@@ -67,11 +66,6 @@ public final class ClientLoginNetworkAddon extends AbstractNetworkAddon<ClientLo
|
||||
this.logger.debug("Handling inbound login response with id {} and channel with name {}", queryId, channelName);
|
||||
|
||||
if (this.firstResponse) {
|
||||
// Register global handlers
|
||||
for (Map.Entry<Identifier, ClientLoginNetworking.LoginQueryRequestHandler> entry : ClientNetworkingImpl.LOGIN.getHandlers().entrySet()) {
|
||||
ClientLoginNetworking.registerReceiver(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
ClientLoginConnectionEvents.QUERY_START.invoker().onLoginQueryStart(this.handler, this.client);
|
||||
this.firstResponse = false;
|
||||
}
|
||||
|
@@ -50,6 +50,8 @@ abstract class ClientLoginNetworkHandlerMixin implements NetworkHandlerExtension
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void initAddon(CallbackInfo ci) {
|
||||
this.addon = new ClientLoginNetworkAddon((ClientLoginNetworkHandler) (Object) this, this.client);
|
||||
// A bit of a hack but it allows the field above to be set in case someone registers handlers during INIT event which refers to said field
|
||||
this.addon.lateInit();
|
||||
}
|
||||
|
||||
@Inject(method = "onQueryRequest", at = @At(value = "INVOKE", target = "Ljava/util/function/Consumer;accept(Ljava/lang/Object;)V", remap = false, shift = At.Shift.AFTER), cancellable = true)
|
||||
|
@@ -80,11 +80,6 @@ public final class ServerLoginNetworkAddon extends AbstractNetworkAddon<ServerLo
|
||||
// Send the compression packet now so clients receive compressed login queries
|
||||
this.sendCompressionPacket();
|
||||
|
||||
// Register global receivers.
|
||||
for (Map.Entry<Identifier, ServerLoginNetworking.LoginQueryResponseHandler> entry : ServerNetworkingImpl.LOGIN.getHandlers().entrySet()) {
|
||||
ServerLoginNetworking.registerReceiver(this.handler, entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
ServerLoginConnectionEvents.QUERY_START.invoker().onLoginStart(this.handler, this.server, this, this.waits::add);
|
||||
this.firstQueryTick = false;
|
||||
}
|
||||
|
@@ -50,6 +50,8 @@ abstract class ServerLoginNetworkHandlerMixin implements NetworkHandlerExtension
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void initAddon(CallbackInfo ci) {
|
||||
this.addon = new ServerLoginNetworkAddon((ServerLoginNetworkHandler) (Object) this);
|
||||
// A bit of a hack but it allows the field above to be set in case someone registers handlers during INIT event which refers to said field
|
||||
this.addon.lateInit();
|
||||
}
|
||||
|
||||
@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerLoginNetworkHandler;tickVerify(Lcom/mojang/authlib/GameProfile;)V"))
|
||||
|
Reference in New Issue
Block a user