Package codechicken.lib.packet
Interface ICustomPacketHandler.ILoginPacketHandler
- All Superinterfaces:
ICustomPacketHandler
- All Known Implementing Classes:
LoginPacketHandler
- Enclosing interface:
- ICustomPacketHandler
-
Nested Class Summary
Nested classes/interfaces inherited from interface codechicken.lib.packet.ICustomPacketHandler
ICustomPacketHandler.IClientPacketHandler, ICustomPacketHandler.ILoginPacketHandler, ICustomPacketHandler.IServerPacketHandler -
Method Summary
Modifier and TypeMethodDescriptionvoidgatherLoginPackets(BiConsumer<String, Supplier<PacketCustom>> consumer) Called on the server to gather all login packets to be sent to the client.voidhandleLoginPacket(PacketCustom packet, net.minecraft.client.Minecraft mc, net.minecraft.network.protocol.login.ClientLoginPacketListener handler, net.minecraftforge.network.NetworkEvent.Context context) Called on the client to handle a login packet provided throughgatherLoginPackets(java.util.function.BiConsumer<java.lang.String, java.util.function.Supplier<codechicken.lib.packet.PacketCustom>>).
-
Method Details
-
gatherLoginPackets
Called on the server to gather all login packets to be sent to the client. Unlike usual PacketCustom operation, Login packets are handled differently in FML, and require an acknowledgement response to be sent. Login packets must be sent using, this.- Parameters:
consumer- The consumer to accept any packets to be sent, The first generic parameter being a descriptive name for the packet used in FML logging, the second generic being a supplier used to generate the packet. Supplier is used for cleaner scope variable name hiding.
-
handleLoginPacket
void handleLoginPacket(PacketCustom packet, net.minecraft.client.Minecraft mc, net.minecraft.network.protocol.login.ClientLoginPacketListener handler, net.minecraftforge.network.NetworkEvent.Context context) Called on the client to handle a login packet provided throughgatherLoginPackets(java.util.function.BiConsumer<java.lang.String, java.util.function.Supplier<codechicken.lib.packet.PacketCustom>>). This method unlike the other handlers, does not sync to the main thread for processing, instead it is fired on the network thread, this is to allow mods to choose if the packet is important in the handshake cycle and must be handled before anything else can continue. If the data isn't critical to the handshake process, feel free to useNetworkEvent.Context.enqueueWork(Runnable)to throw things on the main thread.- Parameters:
packet- The packet to handle.mc- The Minecraft instance.handler- Vanilla's NetHandler.context- The network context.
-