* The notch client's packet sending is weird. Here's how it works: If the client is clicking a block not in range, sends a packet with x=-1,y=255,z=-1 If the client is clicking a block in
* range with an item in hand (id > 255) Sends both the normal block placement packet and a (-1,255,-1) one If the client is placing a block in range with a block in hand, only one normal
* packet is sent That is how it usually happens. Sometimes it doesn't happen like that. Therefore, a hacky workaround.
*/
final BlockFace clickedFace = message.getDirection();
Hunger hunger = player.add(Hunger.class);
if ((holdingMat instanceof Food && hunger.getHunger() != VanillaData.HUNGER.getDefaultValue()) || holdingMat instanceof Sword || (holdingMat instanceof PotionItem && !((PotionItem) holdingMat).isSplash())) {
player.get(Living.class).setEatingBlocking(true);
hunger.setEating(true, currentSlot);
return;
}
if (clickedFace == BlockFace.THIS) {
// Right clicked air with an item.
PlayerInteractBlockEvent event = Spout.getEventManager().callEvent(new PlayerInteractBlockEvent(player, null, null, clickedFace, Action.RIGHT_CLICK));