I have tried several different things in order to try to get where the player is looking at such as player.getLookAngle() (which now I realize doesn't have anything to do with that) and a few other methods that I can't remember right now, but the only thing I've found that works is getPlayerPOVHitResult, and that only works in children of the Item class.
Currently, I'm trying to get an entity to spawn where the player is looking at 100 blocks in the air, and I have an item mostly set up to do so, but getPlayerPOVHitResult is not working in this situation.
Here is exactly what I'm doing, if you know how to make this work properly your assistance would be highly appreciated:
BlockHitResult povHitResult = getPlayerPOVHitResult(level, player, ClipContext.Fluid.ANY);
if(!level.isClientSide && hand == InteractionHand.MAIN_HAND && !player.isCrouching() && mode == 6 && mode6) {
DescendingShellEntity descendingShell = new DescendingShellEntity(TMEntityTypes.DESCENDING_SHELL.get(), level);
descendingShell.setPos(povHitResult.getBlockPos().getX(), povHitResult.getBlockPos().getY() + 100, povHitResult.getBlockPos().getZ());
level.addFreshEntity(descendingShell);
Here's the GitHub repo if it helps: https://github.com/xCrazyFeline/Turtle-Magic-1.19.2-FORGE-