Class ToucanClientNetwork

java.lang.Object
com.jvn.toucanlib.fabric.network.ToucanClientNetwork

public final class ToucanClientNetwork extends Object
Fabric client-side play-networking helpers.
  • Method Summary

    Modifier and Type
    Method
    Description
    create(String modId)
    Creates a client networking wrapper.
    <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
    void
    playToClient(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,T> codec, net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking.PlayPayloadHandler<T> handler)
    Registers a clientbound play payload and global client receiver.
    <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
    void
    safePlayToClient(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,T> codec, String className, String methodName)
    Registers a clientbound payload that dispatches to a static client method by reflection.
    <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
    void
    safePlayToClientThreaded(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,T> codec, String className, String methodName)
    Registers a clientbound payload that dispatches to a static client method on the client task queue.
    static void
    sendToServer(net.minecraft.network.protocol.common.custom.CustomPacketPayload payload)
    Sends a payload to the connected server.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • create

      public static ToucanClientNetwork create(String modId)
      Creates a client networking wrapper.
    • playToClient

      public <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> void playToClient(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,T> codec, net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking.PlayPayloadHandler<T> handler)
      Registers a clientbound play payload and global client receiver.
    • safePlayToClient

      public <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> void safePlayToClient(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,T> codec, String className, String methodName)
      Registers a clientbound payload that dispatches to a static client method by reflection.
    • safePlayToClientThreaded

      public <T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload> void safePlayToClientThreaded(net.minecraft.network.protocol.common.custom.CustomPacketPayload.Type<T> type, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf,T> codec, String className, String methodName)
      Registers a clientbound payload that dispatches to a static client method on the client task queue.
    • sendToServer

      public static void sendToServer(net.minecraft.network.protocol.common.custom.CustomPacketPayload payload)
      Sends a payload to the connected server.