Package com.jvn.toucanlib.fabric.network
Class ToucanClientNetwork
java.lang.Object
com.jvn.toucanlib.fabric.network.ToucanClientNetwork
Fabric client-side play-networking helpers.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ToucanClientNetworkCreates a client networking wrapper.<T extends net.minecraft.network.protocol.common.custom.CustomPacketPayload>
voidplayToClient(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>
voidsafePlayToClient(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>
voidsafePlayToClientThreaded(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 voidsendToServer(net.minecraft.network.protocol.common.custom.CustomPacketPayload payload) Sends a payload to the connected server.
-
Method Details
-
create
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.
-