PocketMine-MP 5.42.1 git-d77520d210fcb967a02bc11817ad625393c8ebc6
Loading...
Searching...
No Matches
pocketmine\network\mcpe\convert\BlockStateDictionary Class Reference
+ Collaboration diagram for pocketmine\network\mcpe\convert\BlockStateDictionary:

Public Member Functions

 __construct (private array $states)
 
 generateDataFromStateId (int $networkRuntimeId)
 
 getMetaFromStateId (int $networkRuntimeId)
 
 getStates ()
 
 lookupStateIdFromData (BlockStateData $data)
 
 lookupStateIdFromIdMeta (string $id, int $meta)
 

Static Public Member Functions

static loadFromString (string $blockPaletteContents, string $metaMapContents)
 
static loadPaletteFromString (string $blockPaletteContents)
 

Detailed Description

Handles translation of network block runtime IDs into blockstate data, and vice versa

Definition at line 45 of file BlockStateDictionary.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\network\mcpe\convert\BlockStateDictionary::__construct ( private array $states)
Parameters
BlockStateDictionaryEntry[]$states

@phpstan-param list<BlockStateDictionaryEntry> $states

Definition at line 63 of file BlockStateDictionary.php.

Member Function Documentation

◆ generateDataFromStateId()

pocketmine\network\mcpe\convert\BlockStateDictionary::generateDataFromStateId ( int $networkRuntimeId)

Definition at line 108 of file BlockStateDictionary.php.

◆ getMetaFromStateId()

pocketmine\network\mcpe\convert\BlockStateDictionary::getMetaFromStateId ( int $networkRuntimeId)

Returns the blockstate meta value associated with the given blockstate runtime ID. This is used for serializing crafting recipe inputs.

Definition at line 131 of file BlockStateDictionary.php.

◆ getStates()

pocketmine\network\mcpe\convert\BlockStateDictionary::getStates ( )

Returns an array mapping runtime ID => blockstate data.

Returns
BlockStateDictionaryEntry[] @phpstan-return array<int, BlockStateDictionaryEntry>

Definition at line 153 of file BlockStateDictionary.php.

◆ loadFromString()

static pocketmine\network\mcpe\convert\BlockStateDictionary::loadFromString ( string $blockPaletteContents,
string $metaMapContents )
static

Definition at line 168 of file BlockStateDictionary.php.

◆ loadPaletteFromString()

static pocketmine\network\mcpe\convert\BlockStateDictionary::loadPaletteFromString ( string $blockPaletteContents)
static
Returns
BlockStateData[] @phpstan-return list<BlockStateData>
Exceptions
NbtDataException

Definition at line 161 of file BlockStateDictionary.php.

◆ lookupStateIdFromData()

pocketmine\network\mcpe\convert\BlockStateDictionary::lookupStateIdFromData ( BlockStateData $data)

Searches for the appropriate state ID which matches the given blockstate NBT. Returns null if there were no matches.

Definition at line 116 of file BlockStateDictionary.php.

References pocketmine\data\bedrock\block\BlockStateData\getStates().

+ Here is the call graph for this function:

◆ lookupStateIdFromIdMeta()

pocketmine\network\mcpe\convert\BlockStateDictionary::lookupStateIdFromIdMeta ( string $id,
int $meta )

Returns the blockstate data associated with the given block ID and meta value. This is used for deserializing crafting recipe inputs.

Definition at line 139 of file BlockStateDictionary.php.


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