In 1.12.2 (for example) LeftClickBlock had a hitVec field:
private final Vec3d hitVec;
In 1.14.2 that field is gone and I cannot find it's equivalent in that class or any of the parent classes. There also is no ray trace result as far as I could see.
EntityInteractSpecific seems to have a localPos Vec3d which probably serves the same purpose but that's only fired when right clicking an entity (not a block)
The use case: I have a few situations where I have specific fine-grained control over what should happen when a player hits a certain part of a block. The hitVec as it was given in 1.12 was a local coordinate on the face where the player hit the block. I guess a mod like Chisel & Bits will also like to use something like this because it allows someone to hit specific parts of a block easily.
The LeftClickBlock event is called from one place only: PlayerInteractionManager.startDestroyBlock(). This in turn is called from ServerPlayNetHandler. Unfortunatelly the packet (CPlayerDiggingPacket) that initiates this no longer has this information so it may be hard to fix this.
as a workaround, you can just reperform the raytrace at the cost of a bit of performance
The data is not present in the places this event is needed to be fired. We were just performing the raytrace for you.
As stated on Discord, it may be worth it to add a helper getRayTrace() function that performance the trace lazily, so that it's not costly if nobody wants it. But it is still only ran once instead of by multiple consumers.
Most helpful comment
The data is not present in the places this event is needed to be fired. We were just performing the raytrace for you.
As stated on Discord, it may be worth it to add a helper getRayTrace() function that performance the trace lazily, so that it's not costly if nobody wants it. But it is still only ran once instead of by multiple consumers.