*/ public array $renamedIds = []; /** * @var Tag[][] * @phpstan-var array> */ public array $addedProperties = []; /** * @var string[][] * @phpstan-var array> */ public array $removedProperties = []; /** * @var string[][] * @phpstan-var array> */ public array $renamedProperties = []; /** * @var ValueRemap[][][] * @phpstan-var array>> */ public array $remappedPropertyValues = []; /** * @var BlockStateUpgradeSchemaBlockRemap[][] * @phpstan-var array> */ public array $remappedStates = []; private ?bool $backwardsCompatible = null; public function __construct( public int $maxVersionMajor, public int $maxVersionMinor, public int $maxVersionPatch, public int $maxVersionRevision ){} public function getVersionId() : int{ return ($this->maxVersionMajor << 24) | ($this->maxVersionMinor << 16) | ($this->maxVersionPatch << 8) | $this->maxVersionRevision; } public function isEmpty() : bool{ foreach([ $this->renamedIds, $this->addedProperties, $this->removedProperties, $this->renamedProperties, $this->remappedPropertyValues, $this->remappedStates, ] as $list){ if(count($list) !== 0){ return false; } } return true; } public function isBackwardsCompatible() : bool{ if($this->backwardsCompatible === null){ $this->backwardsCompatible = true; foreach([ $this->renamedIds, $this->removedProperties, $this->remappedPropertyValues, $this->remappedStates ] as $bcBreakingRules){ if(count($bcBreakingRules) !== 0){ $this->backwardsCompatible = false; } } } //schemas which only add properties are backwards compatible return $this->backwardsCompatible; } }