I am trying to prevent a vanilla block from being placed under certain circumstances. I have used BlockEvent#PlaceEvent and PlayerInteractEvent#RightClickBlock successfully; however, a brief image of the block always appears on the screen, then quickly disappears. I would prefer to cancel the block placement without this brief image flashing on the screen. Is there a way to intercept the placement earlier? I've looked over the available events and didn't find anything else that seemed like it would work, but perhaps I'm missing something.
I have also noticed that when canceling the block placement, the ItemStack size decreases, yet if I move the stack to a different inventory slot or log out and back in, it magically jumps back up to the original size—or even reappears from nothing if the stack was completely depleted. Anyone know what's up with that? Do I need to, like, manually modify the ItemStack to prevent that before canceling the event? Seems weird.