Vault 5.47.0
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
public const TAG_CONFIG = "config"TAG_CONNECTED_PARTICLE_RANGE
public const TAG_CONNECTED_PARTICLE_RANGE = "connected_particle_range"Network only: range of the particles flying to the connected players.
TAG_CONNECTED_PLAYERS
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
public const TAG_DATA = "data"TAG_DISPLAY_ITEM
public const TAG_DISPLAY_ITEM = \pocketmine\block\vault\VaultData::TAG_DISPLAY_ITEMNetwork: the item shown inside the vault (an empty item for none).
Methods
__construct()
public function __construct(\pocketmine\world\World $world, \pocketmine\math\Vector3 $pos)addAdditionalSpawnData() protected
protected function addAdditionalSpawnData(\pocketmine\nbt\tag\CompoundTag $nbt) : voidbroadcastSharedData()
public function broadcastSharedData() : voidSends the item shown and the connected players to the players who can see the vault.
getConfig()
public function getConfig() : \pocketmine\block\vault\VaultConfighasRewardedPlayer()
public function hasRewardedPlayer(\pocketmine\player\Player $player) : boolReturns whether the vault rewarded the player already (each player may open a vault once).
readSaveData()
public function readSaveData(\pocketmine\nbt\tag\CompoundTag $nbt) : voidsetConfig()
public function setConfig(\pocketmine\block\vault\VaultConfig $config) : voidSets the key item, the loot table and the ranges of the vault.
writeSaveData() protected
protected function writeSaveData(\pocketmine\nbt\tag\CompoundTag $nbt) : void