41 private static array $uniqueRawStates = [];
43 private string $rawStateProperties;
50 private string $stateName,
51 array $stateProperties,
55 $this->rawStateProperties = self::$uniqueRawStates[$rawStateProperties] ??= $rawStateProperties;
58 public function getStateName() : string{ return $this->stateName; }
60 public function getRawStateProperties() : string{ return $this->rawStateProperties; }
62 public function generateStateData() : BlockStateData{
63 return new BlockStateData(
65 self::decodeStateProperties($this->rawStateProperties),
66 BlockStateData::CURRENT_VERSION
70 public function getMeta() : int{ return $this->meta; }
76 if($rawProperties ===
""){
87 if(count($properties) === 0){
91 ksort($properties, SORT_STRING);
93 foreach(Utils::stringifyKeys($properties) as $k => $v){
96 return (
new LittleEndianNbtSerializer())->write(
new TreeRoot($tag));
static decodeStateProperties(string $rawProperties)
__construct(private string $stateName, array $stateProperties, private int $meta)
static encodeStateProperties(array $properties)