42    public const TAG_NAME = 
"name";
 
   43    public const TAG_STATES = 
"states";
 
   44    public const TAG_VERSION = 
"version";
 
   52        private array $states,
 
 
   60    public static function current(
string $name, array $states) : self{
 
   61        return new self($name, $states, self::CURRENT_VERSION);
 
 
   64    public function getName() : string{ return $this->name; }
 
   70    public function getStates() : array{ return $this->states; }
 
   72    public function getState(
string $name) : ?
Tag{
 
   73        return $this->states[$name] ?? null;
 
   76    public function getVersion() : int{ return $this->version; }
 
   78    public function getVersionAsString() : string{
 
   79        $major = ($this->version >> 24) & 0xff;
 
   80        $minor = ($this->version >> 16) & 0xff;
 
   81        $patch = ($this->version >> 8) & 0xff;
 
   82        $revision = $this->version & 0xff;
 
   83        return "$major.$minor.$patch.$revision";
 
   91            $name = $nbt->getString(self::TAG_NAME);
 
   93            $version = $nbt->getInt(self::TAG_VERSION, 0);
 
  100        unset($allKeys[self::TAG_NAME], $allKeys[self::TAG_STATES], $allKeys[self::TAG_VERSION], $allKeys[VersionInfo::TAG_WORLD_DATA_VERSION]);
 
  101        if(count($allKeys) !== 0){
 
  102            throw new BlockStateDeserializeException(
"Unexpected extra keys: " . implode(
", ", array_keys($allKeys)));
 
  105        return new self($name, $states->getValue(), $version);
 
 
  113        foreach(Utils::stringifyKeys($this->states) as $key => $value){
 
  114            $statesTag->setTag($key, $value);
 
  116        return CompoundTag::create()
 
  118            ->setInt(self::TAG_VERSION, $this->version)
 
  119            ->setTag(self::TAG_STATES, $statesTag);
 
 
  127        return $this->toVanillaNbt()
 
 
  131    public function equals(
self $that) : bool{
 
  132        if($this->name !== $that->name || count($this->states) !== count($that->states)){
 
  135        foreach(Utils::stringifyKeys($this->states) as $k => $v){
 
  136            if(!isset($that->states[$k]) || !$that->states[$k]->equals($v)){