Exopandora / ShoulderSurfing

Shoulder Surfing Reloaded is a highly configurable third person camera mod for minecraft.
MIT License
48 stars 9 forks source link

[FEATURE] [1.20.1] Crosshair raycasting ignore tall grass #140

Closed ZsoltMolnarrr closed 7 months ago

ZsoltMolnarrr commented 7 months ago

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

ZsoltMolnarrr commented 7 months ago

🎉🙏

ZsoltMolnarrr commented 7 months ago

Tested, works perfectly, thank you!

Exopandora commented 7 months ago

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