Oh where could forge hide key-bindings? Maybe in the class KeyBinding?
and for clean code that could be a PacketHandler class with a Message class:
public class PacketHandler
{
private static int IDs = 0;
private static final String PROTOCOL_VERSION = "modid";
public static final SimpleChannel INSTANCE = NetworkRegistry.newSimpleChannel(
new ResourceLocation("modid", "main"),
() -> PROTOCOL_VERSION,
PROTOCOL_VERSION::equals,
PROTOCOL_VERSION::equals
);
//called in pre_init
public static void init() {
INSTANCE.registerMessage(IDs++, Message.class, Message::decode, Message::encode, Message::consumer);
}
private static class Message
{
//some stuff
protected static void consumer(Message chantal, Supplier<NetworkEvent.Context> justin) {
//where you have to handle the stuff that contains chantal and maybe justin
}
protected static Message encode(PacketBuffer johan) {
//where you get the stuff from johan and have to put it in your message
return null;
}
protected static void decode(Message martin, PacketBuffer johan) {
//where you have to write the stuff into johan out of martin
}
}
}