diff --git a/src/data/bedrock/block/upgrade/BlockStateUpgradeSchema.php b/src/data/bedrock/block/upgrade/BlockStateUpgradeSchema.php index 36960383e..6d280ecf7 100644 --- a/src/data/bedrock/block/upgrade/BlockStateUpgradeSchema.php +++ b/src/data/bedrock/block/upgrade/BlockStateUpgradeSchema.php @@ -64,20 +64,24 @@ final class BlockStateUpgradeSchema{ */ public array $remappedStates = []; + public readonly int $versionId; + public function __construct( - public int $maxVersionMajor, - public int $maxVersionMinor, - public int $maxVersionPatch, - public int $maxVersionRevision, + public readonly int $maxVersionMajor, + public readonly int $maxVersionMinor, + public readonly int $maxVersionPatch, + public readonly int $maxVersionRevision, private int $schemaId - ){} + ){ + $this->versionId = ($this->maxVersionMajor << 24) | ($this->maxVersionMinor << 16) | ($this->maxVersionPatch << 8) | $this->maxVersionRevision; + } /** * @deprecated This is defined by Mojang, and therefore cannot be relied on. Use getSchemaId() instead for * internal version management. */ public function getVersionId() : int{ - return ($this->maxVersionMajor << 24) | ($this->maxVersionMinor << 16) | ($this->maxVersionPatch << 8) | $this->maxVersionRevision; + return $this->versionId; } public function getSchemaId() : int{ return $this->schemaId; } diff --git a/src/data/bedrock/block/upgrade/BlockStateUpgrader.php b/src/data/bedrock/block/upgrade/BlockStateUpgrader.php index f8574d6a2..e91a5cf60 100644 --- a/src/data/bedrock/block/upgrade/BlockStateUpgrader.php +++ b/src/data/bedrock/block/upgrade/BlockStateUpgrader.php @@ -62,7 +62,7 @@ final class BlockStateUpgrader{ $version = $blockStateData->getVersion(); $highestVersion = $version; foreach($this->upgradeSchemas as $schema){ - $resultVersion = $schema->getVersionId(); + $resultVersion = $schema->versionId; $highestVersion = max($highestVersion, $resultVersion); if($version > $resultVersion){ //even if this is actually the same version, we have to apply it anyway because mojang are dumb and