PocketMine-MP 5.33.2 git-1133d49c924b4358c79d44eeb97dcbf56cb4d1eb
Loading...
Searching...
No Matches
tile/Barrel.php
1<?php
2
3/*
4 *
5 * ____ _ _ __ __ _ __ __ ____
6 * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7 * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8 * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9 * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10 *
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * @author PocketMine Team
17 * @link http://www.pocketmine.net/
18 *
19 *
20 */
21
22declare(strict_types=1);
23
24namespace pocketmine\block\tile;
25
31
32class Barrel extends Spawnable implements ContainerTile, Nameable{
33 use NameableTrait;
35
36 protected Inventory $inventory;
37
38 public function __construct(World $world, Vector3 $pos){
39 parent::__construct($world, $pos);
40 $this->inventory = new SimpleInventory(27);
41 }
42
43 public function readSaveData(CompoundTag $nbt) : void{
44 $this->loadName($nbt);
45 $this->loadItems($nbt);
46 }
47
48 protected function writeSaveData(CompoundTag $nbt) : void{
49 $this->saveName($nbt);
50 $this->saveItems($nbt);
51 }
52
53 public function close() : void{
54 if(!$this->closed){
55 $this->inventory->removeAllWindows();
56 parent::close();
57 }
58 }
59
60 public function getInventory() : Inventory{
61 return $this->inventory;
62 }
63
64 public function getRealInventory() : Inventory{
65 return $this->inventory;
66 }
67
68 public function getDefaultName() : string{
69 return "Barrel";
70 }
71}
writeSaveData(CompoundTag $nbt)