First look at loading 1.13+ worlds

This commit is contained in:
Dylan K. Taylor
2022-02-07 03:04:29 +00:00
parent dd3b79b142
commit e58b3ba46c
12 changed files with 321 additions and 68 deletions

View File

@ -34,6 +34,16 @@ final class BlockStateUpgrader{
/** @var BlockStateUpgradeSchema[][] */
private array $upgradeSchemas = [];
/**
* @param BlockStateUpgradeSchema[] $upgradeSchemas
* @phpstan-param array<int, BlockStateUpgradeSchema> $upgradeSchemas
*/
public function __construct(array $upgradeSchemas){
foreach($upgradeSchemas as $priority => $schema){
$this->addSchema($schema, $priority);
}
}
public function addSchema(BlockStateUpgradeSchema $schema, int $priority) : void{
if(isset($this->upgradeSchemas[$schema->getVersionId()][$priority])){
throw new \InvalidArgumentException("Another schema already has this priority");