Interface ClientLoginContext
- All Superinterfaces:
ClientContext,ListenerContext
@Environment(CLIENT) public interface ClientLoginContext extends ClientContext
ClientNetworking.getLoginReceiver(), in which a
login
query request packest is received.
Compared to other type of packet reception context, the client login query packet
reception is expected to respond after receiving a packet. Use respond methods
to send a response; if none of the respond methods are called immediately within
ChannelHandler.receive(io.github.fablabsmc.fablabs.api.networking.v1.ListenerContext, PacketByteBuf),
a "not understood" response will be sent to the server. If a response cannot be calculated
immediately, use respond(CompletableFuture) or respond(CompletableFuture, GenericFutureListener),
which can send the response when the CompletableFuture is completed.
- See Also:
ClientNetworking.getLoginReceiver()
-
Method Summary
Modifier and Type Method Description net.minecraft.client.network.ClientLoginNetworkHandlergetListener()Returns the packet listener that received this packet.voidrespond(CompletableFuture<? extends net.minecraft.network.PacketByteBuf> future)Schedule to send a response to the server when thefutureis completed.voidrespond(CompletableFuture<? extends net.minecraft.network.PacketByteBuf> future, GenericFutureListener<? extends Future<? super Void>> callback)Schedule to send a response to the server when thefutureis completed.voidrespond(net.minecraft.network.PacketByteBuf buf)Sends a response to the server.voidrespond(net.minecraft.network.PacketByteBuf buf, GenericFutureListener<? extends Future<? super Void>> callback)Sends a response to the server.Methods inherited from interface io.github.fablabsmc.fablabs.api.networking.v1.client.ClientContext
getEngine
-
Method Details
-
getListener
net.minecraft.client.network.ClientLoginNetworkHandler getListener()Returns the packet listener that received this packet.The packet listener offers access to the connection.
In a client login context, the network handler is always a
ClientLoginNetworkHandler.- Specified by:
getListenerin interfaceListenerContext- Returns:
- the packet listener
-
respond
void respond(net.minecraft.network.PacketByteBuf buf)Sends a response to the server.The
responsemay benullto indicate a "not understood" query response.- Parameters:
buf- the content of the response, may benull
-
respond
void respond(net.minecraft.network.PacketByteBuf buf, GenericFutureListener<? extends Future<? super Void>> callback)Sends a response to the server.The
responsemay benullto indicate a "not understood" query response.- Parameters:
buf- the content of the response, may benullcallback- a callback when the response is sent, may benull
-
respond
Schedule to send a response to the server when thefutureis completed.If the future completed with
nullresult, a "not understood" query response is sent to the server.If the future completed exceptionally, a "not understood" query response is sent to the server.
- Parameters:
future- the future that calculates the response
-
respond
void respond(CompletableFuture<? extends net.minecraft.network.PacketByteBuf> future, GenericFutureListener<? extends Future<? super Void>> callback)Schedule to send a response to the server when thefutureis completed.If the future completed with
nullresult, a "not understood" query response is sent to the server.If the future completed exceptionally, a "not understood" query response is sent to the server.
- Parameters:
future- the future that calculates the responsecallback- a callback when the response is sent, may benull
-