mcNows
Nows Loader 0.10.0 / Minecraft 26.2

Network Channels

Declare Nows network channels and register packet handlers through the networking integration.

Some APIs may still change or behave unevenly because they do not have enough real-world use cases and test coverage yet.

Network Channels

integrations/network exposes a small networking surface over Minecraft’s existing Netty stack without importing version-specific Minecraft packet classes.

Declare channels in metadata, then use NowsNetworking from the runtime context:

mod id="my_mod" name="My Mod" version="1.0.0" minecraft="26.2" {
    runtime {
        network-channel "my_mod:main"
        clientbound-channel "my_mod:sync"
        serverbound-channel "my_mod:action"
        entrypoint "com.example.MyMod"
    }
}

The runtime registration step reads network-channel, network, clientbound-channel and serverbound-channel declarations. A plain network-channel is bidirectional by default.

NowsNetworking networking = NowsNetworking.service(context);
networking.registerChannel("my_mod:main");
networking.registerHandler("my_mod:main", NetworkDirection.CLIENTBOUND, (packet, payload) -> {
    int bytes = payload.size();
    ByteBuf buffer = payload.buffer();
});

Payloads are backed by Netty ByteBuf. Nows expects Minecraft launcher/runtime libraries to provide Netty and does not bundle a second copy.

Sending goes through NetworkTransport, which is installed by version-specific code. Until a concrete transport is present, canSend(...) and send(...) return false.

byte[] payload = new byte[] { 1, 2, 3 };
if (networking.canSend("my_mod:action", NetworkDirection.SERVERBOUND)) {
    networking.send("my_mod:action", NetworkDirection.SERVERBOUND, payload);
}

NetworkDirection also validates side usage. A client runtime can receive CLIENTBOUND packets and send SERVERBOUND packets. A server runtime is the opposite. If a packet is received on the wrong side, Nows throws an error instead of silently dispatching it.

Handler Shape

Handlers receive a NetworkPacketContext and a NetworkPayload.

API Use
payload.size() inspect readable byte count
payload.buffer() work with the backing Netty ByteBuf
NetworkPayload.of(byte[]) create an owned payload from bytes
NetworkPayload.of(ByteBuf) create a copied payload from a buffer
NetworkPayload.wrap(ByteBuf) wrap an existing receive buffer

Keep protocol validation in the mod. Nows only owns channel registration, side checks and transport dispatch.