Well first all, so you can get an idea of my credibility, i'm new here, and new to modding ( or even coding in java ). I do have a lot of experience in other coding languages though, so I'm just going to through out my opinion.
You probably already know this, but you problem is most likely here
In playing minecraft, i've also seen that in creative, mobs don't even acknowledge you, unlike survival. So what if, in survival, the ray is starting in you, and ending in you. Sort of, detecting you as the collision point. Try start the line off in front the the player, like at a blocks distance.