Refactored projectile handling, added Item->onClickAir()

This commit is contained in:
Dylan K. Taylor
2017-09-02 11:57:26 +01:00
parent 2603f5cc63
commit b071ce9c5a
4 changed files with 106 additions and 46 deletions

View File

@ -829,8 +829,22 @@ class Item implements ItemIds, \JsonSerializable{
return false;
}
/**
* Called when a player uses the item on air, for example throwing a projectile.
* Returns whether the item was changed, for example count decrease or durability change.
*
* @param Player $player
* @param Vector3 $directionVector
*
* @return bool
*/
public function onClickAir(Player $player, Vector3 $directionVector) : bool{
return false;
}
/**
* Called when a player is using this item and releases it. Used to handle bow shoot actions.
* Returns whether the item was changed, for example count decrease or durability change.
*
* @param Player $player
* @return bool