java.lang.Object
net.ixdarklord.coolcatcore.api.network.Network

public final class Network extends Object
Play-phase payloads between client and server.

Register every payload while the mod initialises, on both sides: a dedicated server still needs to know the payloads it sends. On Forge they all travel through CoolCatLib's channel, told apart by their type's id; on Fabric each type's id is its own channel.

A record payload can skip its StreamCodec: pass the record class and each component is encoded with the codec PayloadCodecs has for its type.


 public record PingPayload(BlockPos pos, List<String> tags, Optional<Component> note) implements CustomPacketPayload {
     public static final Type<PingPayload> TYPE = new Type<>(new ResourceLocation("mymod", "ping"));

     public Type<PingPayload> type() { return TYPE; }
 }

 Network.registerServerbound(PingPayload.class, (payload, context) -> ...);