PocketMine-MP 5.17.1 git-df4ada81e5d74a14046f27cf44a37dcee69d657e
pocketmine\data\bedrock\block\BlockStateData Class Reference
+ Collaboration diagram for pocketmine\data\bedrock\block\BlockStateData:

Public Member Functions

 __construct (private string $name, private array $states, private int $version)
 
 equals (self $that)
 
 getName ()
 
 getState (string $name)
 
 getStates ()
 
 getVersion ()
 
 getVersionAsString ()
 
 toNbt ()
 
 toVanillaNbt ()
 

Static Public Member Functions

static current (string $name, array $states)
 
static fromNbt (CompoundTag $nbt)
 

Public Attributes

const CURRENT_VERSION
 
const TAG_NAME = "name"
 
const TAG_STATES = "states"
 
const TAG_VERSION = "version"
 

Detailed Description

Contains the common information found in a serialized blockstate.

Definition at line 38 of file BlockStateData.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\data\bedrock\block\BlockStateData::__construct ( private string  $name,
private array  $states,
private int  $version 
)
Parameters
Tag[]$states@phpstan-param array<string, Tag> $states

Definition at line 59 of file BlockStateData.php.

Member Function Documentation

◆ current()

static pocketmine\data\bedrock\block\BlockStateData::current ( string  $name,
array  $states 
)
static
Parameters
Tag[]$states@phpstan-param array<string, Tag> $states

Definition at line 69 of file BlockStateData.php.

◆ equals()

pocketmine\data\bedrock\block\BlockStateData::equals ( self  $that)

Definition at line 140 of file BlockStateData.php.

◆ fromNbt()

static pocketmine\data\bedrock\block\BlockStateData::fromNbt ( CompoundTag  $nbt)
static
Exceptions
BlockStateDeserializeException

Definition at line 98 of file BlockStateData.php.

◆ getName()

pocketmine\data\bedrock\block\BlockStateData::getName ( )

Definition at line 73 of file BlockStateData.php.

◆ getState()

pocketmine\data\bedrock\block\BlockStateData::getState ( string  $name)

Definition at line 81 of file BlockStateData.php.

◆ getStates()

pocketmine\data\bedrock\block\BlockStateData::getStates ( )
Returns
Tag[] @phpstan-return array<string, Tag>

Definition at line 79 of file BlockStateData.php.

Referenced by pocketmine\network\mcpe\convert\BlockStateDictionary\lookupStateIdFromData().

+ Here is the caller graph for this function:

◆ getVersion()

pocketmine\data\bedrock\block\BlockStateData::getVersion ( )

Definition at line 85 of file BlockStateData.php.

◆ getVersionAsString()

pocketmine\data\bedrock\block\BlockStateData::getVersionAsString ( )

Definition at line 87 of file BlockStateData.php.

◆ toNbt()

pocketmine\data\bedrock\block\BlockStateData::toNbt ( )

Encodes the blockstate as a TAG_Compound, but with extra PM-specific metadata, used for fixing bugs in old saved data. This should be used for anything saved to disk.

Definition at line 135 of file BlockStateData.php.

◆ toVanillaNbt()

pocketmine\data\bedrock\block\BlockStateData::toVanillaNbt ( )

Encodes the blockstate as a TAG_Compound, exactly as it would be in vanilla Bedrock.

Definition at line 120 of file BlockStateData.php.

References pocketmine\nbt\tag\CompoundTag\setTag().

+ Here is the call graph for this function:

Member Data Documentation

◆ CURRENT_VERSION

const pocketmine\data\bedrock\block\BlockStateData::CURRENT_VERSION
Initial value:
=
(1 << 24) |
(21 << 16) |
(0 << 8) |
(3)

Bedrock version of the most recent backwards-incompatible change to blockstates.

This is not the same as current game version. It should match the numbers in the newest blockstate upgrade schema used in BedrockBlockUpgradeSchema.

Definition at line 45 of file BlockStateData.php.

◆ TAG_NAME

const pocketmine\data\bedrock\block\BlockStateData::TAG_NAME = "name"

Definition at line 51 of file BlockStateData.php.

◆ TAG_STATES

const pocketmine\data\bedrock\block\BlockStateData::TAG_STATES = "states"

Definition at line 52 of file BlockStateData.php.

◆ TAG_VERSION

const pocketmine\data\bedrock\block\BlockStateData::TAG_VERSION = "version"

Definition at line 53 of file BlockStateData.php.


The documentation for this class was generated from the following file: