Mojang cannot be relied on ...

This commit is contained in:
Dylan K. Taylor
2022-05-13 20:50:38 +01:00
parent 643556a366
commit a75bc5d537
4 changed files with 22 additions and 45 deletions

View File

@ -70,13 +70,16 @@ final class BlockStateUpgradeSchema{
public int $maxVersionMajor,
public int $maxVersionMinor,
public int $maxVersionPatch,
public int $maxVersionRevision
public int $maxVersionRevision,
private int $priority
){}
public function getVersionId() : int{
return ($this->maxVersionMajor << 24) | ($this->maxVersionMinor << 16) | ($this->maxVersionPatch << 8) | $this->maxVersionRevision;
}
public function getPriority() : int{ return $this->priority; }
public function isEmpty() : bool{
foreach([
$this->renamedIds,
@ -93,22 +96,4 @@ final class BlockStateUpgradeSchema{
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;
}
}