mirror of
https://github.com/FabricMC/fabric.git
synced 2025-03-27 23:29:58 -04:00
fix login network addon not properly initialized (#3531)
This commit is contained in:
parent
e572f21602
commit
bf1eca5483
4 changed files with 4 additions and 11 deletions
fabric-networking-api-v1/src
client/java/net/fabricmc/fabric
impl/networking/client
mixin/networking/client
main/java/net/fabricmc/fabric
impl/networking/server
mixin/networking
|
@ -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"))
|
||||
|
|
Loading…
Add table
Reference in a new issue