You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To_Craft edited this page Jun 25, 2025
·
1 revision
This page describes how to use the 'ModernNetworking' of CraftedCore.
For Minecraft 1.20.5+, you need to additionally register the packets the server might receive (C2S):
ModernNetworking.registerType(packetId);{:.language-java .highlight}
{:.note}
Sides
Valid sides are S2C and C2S, where S2C describes Server-To-Client and C2S describes Client-To-Server.
Receiver
Code, that will be handled once the package is received.
classImplReceiverimplementsReceiver {
@Overridepublicvoidreceive(Contextcontext, CompoundTagdata) {
// read data from the data tag and handle itcontext.getPlayer(); // returns the player that either send or received the package, depending on:context.getEnv();
}
}
Registering Receiver
Must be run for every packet, no matter if it's C2S or S2C.