mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-02 16:23:04 +00:00
98 lines
2.4 KiB
PHP
98 lines
2.4 KiB
PHP
<?php
|
|
|
|
/*
|
|
*
|
|
* ____ _ _ __ __ _ __ __ ____
|
|
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
|
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
|
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* @author PocketMine Team
|
|
* @link http://www.pocketmine.net/
|
|
*
|
|
*
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace pocketmine\data\bedrock\blockstate\upgrade;
|
|
|
|
use pocketmine\data\bedrock\blockstate\upgrade\BlockStateUpgradeSchemaValueRemap as ValueRemap;
|
|
use pocketmine\nbt\tag\Tag;
|
|
use function count;
|
|
|
|
final class BlockStateUpgradeSchema{
|
|
/**
|
|
* @var string[]
|
|
* @phpstan-var array<string, string>
|
|
*/
|
|
public array $renamedIds = [];
|
|
|
|
/**
|
|
* @var Tag[][]
|
|
* @phpstan-var array<string, array<string, Tag>>
|
|
*/
|
|
public array $addedProperties = [];
|
|
|
|
/**
|
|
* @var string[][]
|
|
* @phpstan-var array<string, list<string>>
|
|
*/
|
|
public array $removedProperties = [];
|
|
|
|
/**
|
|
* @var string[][]
|
|
* @phpstan-var array<string, array<string, string>>
|
|
*/
|
|
public array $renamedProperties = [];
|
|
|
|
/**
|
|
* @var ValueRemap[][][]
|
|
* @phpstan-var array<string, array<string, list<ValueRemap>>>
|
|
*/
|
|
public array $remappedPropertyValues = [];
|
|
|
|
/**
|
|
* @var BlockStateUpgradeSchemaBlockRemap[][]
|
|
* @phpstan-var array<string, list<BlockStateUpgradeSchemaBlockRemap>>
|
|
*/
|
|
public array $remappedStates = [];
|
|
|
|
public function __construct(
|
|
public int $maxVersionMajor,
|
|
public int $maxVersionMinor,
|
|
public int $maxVersionPatch,
|
|
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,
|
|
$this->addedProperties,
|
|
$this->removedProperties,
|
|
$this->renamedProperties,
|
|
$this->remappedPropertyValues,
|
|
$this->remappedStates,
|
|
] as $list){
|
|
if(count($list) !== 0){
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|