As for the link you gave, the only thing i can find is RIGHT_CLICK_AIR, RIGHT_CLICK_BLOCK, LEFT_CLICK_BLOCK, i need LEFT_CLICK_AIR, which doesn't exist.
Next, the tick handler, if i want ti to check keys, it needs to be client side, but entity spawning is server side (correct?). Also, how do I only let it check if i click if I'm not in the menu or looking in my inventory or containers or stuff like that?