@SideOnly is a directive made by Forge to ensure that the code actually only exists in Server or Client side. Anyway, according to source code this function is never called on server  because we do checks before and Java tries to get classes on the fly. Your solution works but the PacketPipeline now references your class specifically, which makes it less portable. Not a big issue though.