I have a question about the PlayerInteractEvent, specifically the different behavior on the Client and Server threads when the player is right-clicking on a previously-placed ladder block while holding another ladder.
Given the following test code snippet:
@SubscribeEvent
public void clickOnLadder(PlayerInteractEvent event)
{
if (event.pos != null) {
System.out.println(event.pos.getX() + " " + event.pos.getY() + " " +event.pos.getZ());
System.out.println(event.world.getBlockState(event.pos).getBlock().getLocalizedName());
}
}
When right-clicking a placed ladder with an empty hand, I get:
[22:58:56] [Client thread/INFO] [sTDOUT]: -324 82 412
[22:58:56] [Client thread/INFO] [sTDOUT]: Ladder
[22:58:56] [server thread/INFO] [sTDOUT]: -324 82 412
[22:58:56] [server thread/INFO] [sTDOUT]: Ladder
When holding a ladder, I get:
[22:58:56] [Client thread/INFO] [sTDOUT]: -324 82 412
[22:58:56] [Client thread/INFO] [sTDOUT]: Ladder
[22:58:56] [server thread/INFO] [sTDOUT]: 0 0 0
[22:58:56] [server thread/INFO] [sTDOUT]: Stone
Is the client-side event somehow suppressing / not sending to the server as a result of holding a ladder? When holding a ladder, on the Server-side, this makes it impossible to get the coordinates of the clicked block. Could someone please explain why this would be?
Thanks!
Using Minecraft 1.8.9 with Forge 11.15.1.1902.