Improved trees, improved inventory transactions, improved snowball/bow usage

This commit is contained in:
Shoghi Cervantes
2015-03-28 16:59:15 +01:00
parent 47de616ac5
commit 0a85ad0d1f
22 changed files with 363 additions and 360 deletions

View File

@ -24,6 +24,8 @@ namespace pocketmine\event\player;
use pocketmine\block\Block;
use pocketmine\event\Cancellable;
use pocketmine\item\Item;
use pocketmine\level\Position;
use pocketmine\math\Vector3;
use pocketmine\Player;
/**
@ -43,6 +45,8 @@ class PlayerInteractEvent extends PlayerEvent implements Cancellable{
*/
protected $blockTouched;
protected $touchVector;
/** @var int */
protected $blockFace;
@ -51,26 +55,51 @@ class PlayerInteractEvent extends PlayerEvent implements Cancellable{
protected $action;
public function __construct(Player $player, Item $item, Block $block, $face, $action = PlayerInteractEvent::RIGHT_CLICK){
$this->blockTouched = $block;
public function __construct(Player $player, Item $item, Vector3 $block, $face, $action = PlayerInteractEvent::RIGHT_CLICK_BLOCK){
if($block instanceof Block){
$this->blockTouched = $block;
$this->touchVector = new Vector3(0, 0, 0);
}else{
$this->touchVector = $block;
Block::get(0, 0, new Position(0, 0, 0, $player->level));
}
$this->player = $player;
$this->item = $item;
$this->blockFace = (int) $face;
$this->action = (int) $action;
}
/**
* @return int
*/
public function getAction(){
return $this->action;
}
/**
* @return Item
*/
public function getItem(){
return $this->item;
}
/**
* @return Block
*/
public function getBlock(){
return $this->blockTouched;
}
/**
* @return Vector3
*/
public function getTouchVector(){
return $this->touchVector;
}
/**
* @return int
*/
public function getFace(){
return $this->blockFace;
}