I have tried searching, but everything is outdated, and I cannot figure out how to get it to work.
I think this is as close as I got:
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn,
EnumHand hand) {
Vec3d vec3 = playerIn.getPositionEyes(1.0F);
Vec3d lookVec = playerIn.getLook(1.0F);
Vec3d addedVector = vec3.addVector(lookVec.xCoord * 50.0D, lookVec.yCoord * 50.0D, lookVec.zCoord * 50.0D);
RayTraceResult lookPos= new RayTraceResult(playerIn, lookVec);
int x =lookPos.getBlockPos().getX();
int y =lookPos.getBlockPos().getY();
int z =lookPos.getBlockPos().getX();
EntityLightningBolt lightning = new EntityLightningBolt(worldIn, x,y,z, false);
worldIn.addWeatherEffect(lightning);
return new ActionResult(EnumActionResult.PASS, itemStackIn);
}