Shoulder Surfing Reloaded

Shoulder Surfing Reloaded

2M Downloads

[FEATURE] [1.20.1] Crosshair raycasting ignore tall grass

ZsoltMolnarrr opened this issue ยท 3 comments

commented

Describe your feature
The issue from the user perspective is trying to aim with a bow on a plains biome, where lots of tall grass is present.
Adaptive crosshair becomes a distraction instead of help, due to raycasting not ignoring blocks with zero hardness (such as tall grass), so the crosshair jumps around onto grass blocks instead of pointing at enemies behind the grass.

Recommended solution
If raycasting is based on vanilla functions, there is a raycasting mode that would better fit the adaptive crosshair.

Example (YARN):

var hit = caster.getWorld().raycast(new RaycastContext(start, end, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, caster));

The key part here is RaycastContext.ShapeType.COLLIDER

Using the official mappings, I think this can be translated like:
RaycastContext.ShapeType.COLLIDER -> ClipContext.Block.COLLIDER

commented

๐ŸŽ‰๐Ÿ™

commented

Tested, works perfectly, thank you!

commented

You're welcome! Sorry for the (potential) E-Mail spam i may have caused ๐Ÿ˜„.