MinecraftForge/MinecraftForge — pull request #697 by copyboy (2013-07-30 03:56:59+00:00)
Title: Fire left click onPlayerInteract on client too

This is kind of a draft, but I'd love to get some feedback / opinions on these changes.

Until now, onPlayerInteract for LEFT_CLICK_BLOCK didn't fire on the client, and therefore there's no way of canceling it so trying to break a block would show no breaking animation. It works perfectly fine on the server, so blocks can for example be protected by doing this, but there's no way to make a block appear unbreakable, or make something different happen on the client by using the onPlayerInteract event.

I made these changes a day ago, so I'm not sure sure I can get everything together, but here's what this is supposed to change:

- **Server:** Left click fires in adventure mode, but currently no packet is sent from the client
*(Ideally, useItem = ALLOW would allow a block to be broken in adventure mode.)*
- **Server:** Block breaking can be cancelled in creative mode, as well as extinguishing fire.
- **Client:** Cancelling the event will prevent the block from being broken, and no packet will be sent to the server.
- **Client:** useItem = DENY will send a dig packet to the server, but won't start breaking the block (just like adventure mode).
- **Client:** useBlock = DENY will prevent onBlockClick from being fired, like on the server.

It doesn't quite work with adventure mode, as it won't send a dig packet to the server. I'd like to hear your input on the changes before tinkering with it even more, possibly doing something nobody wants. I will update the PR along the way, until hopefully everyone's happy with it.