Added CustomInventory, StoneCutter inventory type, network IDs, fixed viewer list bugs

This commit is contained in:
Shoghi Cervantes
2014-05-24 01:30:58 +02:00
parent f9103772c3
commit 1fd7e0431b
5 changed files with 70 additions and 33 deletions

View File

@ -24,26 +24,22 @@ namespace pocketmine\inventory;
use pocketmine\network\protocol\ContainerClosePacket;
use pocketmine\network\protocol\ContainerOpenPacket;
use pocketmine\Player;
use pocketmine\tile\Chest;
use pocketmine\tile\Furnace;
use pocketmine\math\Vector3;
abstract class ContainerInventory extends BaseInventory{
/**
* @return Chest|Furnace
*/
public function getHolder(){
return $this->holder;
}
public function onOpen(Player $who){
$pk = new ContainerOpenPacket;
$pk->windowid = $who->getWindowId($this);
$pk->type = 0;
$pk->type = $this->getType()->getNetworkType();
$pk->slots = $this->getSize();
$pk->x = $this->getHolder()->getX();
$pk->y = $this->getHolder()->getY();
$pk->z = $this->getHolder()->getZ();
if($this->holder instanceof Vector3){
$pk->x = $this->holder->getX();
$pk->y = $this->holder->getY();
$pk->z = $this->holder->getZ();
}else{
$pk->x = $pk->y = $pk->z = 0;
}
$who->dataPacket($pk);
}