mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 10:53:05 +00:00
Clean up ChestInventory handling
longer term I want to rip this crap out completely, but right now this provides minor maintainability benefits, while also making it slightly less nasty to deal with other containers which animate their blocks, such as barrels and shulker boxes.
This commit is contained in:
@ -26,9 +26,7 @@ namespace pocketmine\block\inventory;
|
||||
use pocketmine\inventory\BaseInventory;
|
||||
use pocketmine\inventory\InventoryHolder;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\player\Player;
|
||||
use pocketmine\world\Position;
|
||||
use function count;
|
||||
|
||||
class DoubleChestInventory extends ChestInventory implements InventoryHolder{
|
||||
/** @var ChestInventory */
|
||||
@ -74,19 +72,9 @@ class DoubleChestInventory extends ChestInventory implements InventoryHolder{
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function onOpen(Player $who) : void{
|
||||
parent::onOpen($who);
|
||||
|
||||
if(count($this->getViewers()) === 1 and $this->right->getHolder()->isValid()){
|
||||
$this->right->broadcastBlockEventPacket(true);
|
||||
}
|
||||
}
|
||||
|
||||
public function onClose(Player $who) : void{
|
||||
if(count($this->getViewers()) === 1 and $this->right->getHolder()->isValid()){
|
||||
$this->right->broadcastBlockEventPacket(false);
|
||||
}
|
||||
parent::onClose($who);
|
||||
protected function animateBlock(bool $isOpen) : void{
|
||||
$this->left->animateBlock($isOpen);
|
||||
$this->right->animateBlock($isOpen);
|
||||
}
|
||||
|
||||
public function getLeftSide() : ChestInventory{
|
||||
|
Reference in New Issue
Block a user