Skip to content

Vault 5.47.0 ​

class · pocketmine\block\tile\Vault · source

Extends Spawnable

Block entity of a vault: its config (VaultConfig: key item, loot table, ranges) and its state (VaultData: rewarded players, reward being ejected, item shown). The vault block runs it (see \pocketmine\block\Vault).

Saved like Bedrock: "config" and "data" compounds. Clients get the item shown and the players near the vault that it can reward ("display_item", "connected_players", "connected_particle_range"), like Bedrock sends them.

Constants ​

TAG_CONFIG ​

php
public const TAG_CONFIG = "config"

TAG_CONNECTED_PARTICLE_RANGE ​

php
public const TAG_CONNECTED_PARTICLE_RANGE = "connected_particle_range"

Network only: range of the particles flying to the connected players.

TAG_CONNECTED_PLAYERS ​

php
public const TAG_CONNECTED_PLAYERS = "connected_players"

Network only: entity IDs of the players near the vault that it can reward (particles fly to them).

TAG_DATA ​

php
public const TAG_DATA = "data"

TAG_DISPLAY_ITEM ​

php
public const TAG_DISPLAY_ITEM = \pocketmine\block\vault\VaultData::TAG_DISPLAY_ITEM

Network: the item shown inside the vault (an empty item for none).

Methods ​

__construct() ​

php
public function __construct(\pocketmine\world\World $world, \pocketmine\math\Vector3 $pos)

addAdditionalSpawnData() protected ​

php
protected function addAdditionalSpawnData(\pocketmine\nbt\tag\CompoundTag $nbt) : void

broadcastSharedData() ​

php
public function broadcastSharedData() : void

Sends the item shown and the connected players to the players who can see the vault.

getConfig() ​

php
public function getConfig() : \pocketmine\block\vault\VaultConfig

hasRewardedPlayer() ​

php
public function hasRewardedPlayer(\pocketmine\player\Player $player) : bool

Returns whether the vault rewarded the player already (each player may open a vault once).

readSaveData() ​

php
public function readSaveData(\pocketmine\nbt\tag\CompoundTag $nbt) : void

setConfig() ​

php
public function setConfig(\pocketmine\block\vault\VaultConfig $config) : void

Sets the key item, the loot table and the ranges of the vault.

writeSaveData() protected ​

php
protected function writeSaveData(\pocketmine\nbt\tag\CompoundTag $nbt) : void

VanillaMine is a fork of PocketMine-MP. Not affiliated with the PMMP team or Mojang.