The basics are:
Create an IExtendedReach interface that will allow you to identify when you can use extended reach, and provide a method to get the value of the reach.
Make your custom command/effect implement the IExtendedReach interface.
Create and register a custom IMessage packet for telling the server about a successful attack.
Handle the MouseEvent where you:
Check whether the mouse left button was clicked.
Check whether an IExtendedReach item is equipped.
Calculate a MovingObjectPosition with the reach of the item.
If the MovingObjectPosition returns an entity, send a custom packet to the server to call the attack method on that entity.
Heres a similar tuturial http://jabelarminecraft.blogspot.com/p/minecraft-modding-extending-reach-of.html