use of net.minecraft.network.PacketListener in project pollen by MoonflowerTeam.
the class PollinatedFabricLoginChannel method processClient.
private CompletableFuture<@Nullable FriendlyByteBuf> processClient(Minecraft client, PacketListener listener, FriendlyByteBuf data, Consumer<GenericFutureListener<? extends Future<? super Void>>> listenerAdder) {
CompletableFuture<FriendlyByteBuf> future = new CompletableFuture<>();
NetworkRegistry.processMessage(this.deserialize(data, PollinatedPacketDirection.LOGIN_CLIENTBOUND), new PollinatedFabricLoginPacketContext(pkt -> {
try {
future.complete(this.serialize(pkt, PollinatedPacketDirection.LOGIN_SERVERBOUND));
} catch (Throwable t) {
t.printStackTrace();
future.completeExceptionally(t);
}
}, listener.getConnection(), __ -> {
}, PollinatedPacketDirection.LOGIN_CLIENTBOUND), this.clientMessageHandler.get().get());
return future;
}
Aggregations