Tidy up world version related things

I decided to scrap the max schema ID stuff, since it just adds extra places to forget updating. Instead, it's better to use minor version locks and version metadata, as we do for BedrockData and BedrockProtocol.
This commit is contained in:
Dylan K. Taylor 2023-03-14 23:27:16 +00:00
parent 10d22a55ec
commit 4ba4d556ed
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
3 changed files with 6 additions and 8 deletions

View File

@ -34,6 +34,7 @@ use pocketmine\data\bedrock\block\upgrade\BlockStateUpgradeSchemaUtils;
use pocketmine\data\bedrock\block\upgrade\LegacyBlockIdToStringIdMap;
use pocketmine\utils\Filesystem;
use Symfony\Component\Filesystem\Path;
use const PHP_INT_MAX;
use const pocketmine\BEDROCK_BLOCK_UPGRADE_SCHEMA_PATH;
/**
@ -43,8 +44,6 @@ use const pocketmine\BEDROCK_BLOCK_UPGRADE_SCHEMA_PATH;
* benefits for now.
*/
final class GlobalBlockStateHandlers{
public const MAX_BLOCKSTATE_UPGRADE_SCHEMA_ID = 171; //0171_1.19.60_to_1.9.70.26_beta.json
private static ?BlockObjectToStateSerializer $blockStateSerializer = null;
private static ?BlockStateToObjectDeserializer $blockStateDeserializer = null;
@ -65,7 +64,7 @@ final class GlobalBlockStateHandlers{
if(self::$blockDataUpgrader === null){
$blockStateUpgrader = new BlockStateUpgrader(BlockStateUpgradeSchemaUtils::loadSchemas(
Path::join(BEDROCK_BLOCK_UPGRADE_SCHEMA_PATH, 'nbt_upgrade_schema'),
self::MAX_BLOCKSTATE_UPGRADE_SCHEMA_ID
PHP_INT_MAX
));
self::$blockDataUpgrader = new BlockDataUpgrader(
BlockIdMetaUpgrader::loadFromString(

View File

@ -31,11 +31,10 @@ use pocketmine\data\bedrock\item\upgrade\ItemIdMetaUpgradeSchemaUtils;
use pocketmine\data\bedrock\item\upgrade\LegacyItemIdToStringIdMap;
use pocketmine\data\bedrock\item\upgrade\R12ItemIdToBlockIdMap;
use Symfony\Component\Filesystem\Path;
use const PHP_INT_MAX;
use const pocketmine\BEDROCK_ITEM_UPGRADE_SCHEMA_PATH;
final class GlobalItemDataHandlers{
public const MAX_ITEM_ID_UPGRADE_SCHEMA_ID = 91; //0091_1.19.60_to_1.19.70.26_beta.json
private static ?ItemSerializer $itemSerializer = null;
private static ?ItemDeserializer $itemDeserializer = null;
@ -52,7 +51,7 @@ final class GlobalItemDataHandlers{
public static function getUpgrader() : ItemDataUpgrader{
return self::$itemDataUpgrader ??= new ItemDataUpgrader(
new ItemIdMetaUpgrader(ItemIdMetaUpgradeSchemaUtils::loadSchemas(Path::join(BEDROCK_ITEM_UPGRADE_SCHEMA_PATH, 'id_meta_upgrade_schema'), self::MAX_ITEM_ID_UPGRADE_SCHEMA_ID)),
new ItemIdMetaUpgrader(ItemIdMetaUpgradeSchemaUtils::loadSchemas(Path::join(BEDROCK_ITEM_UPGRADE_SCHEMA_PATH, 'id_meta_upgrade_schema'), PHP_INT_MAX)),
LegacyItemIdToStringIdMap::getInstance(),
R12ItemIdToBlockIdMap::getInstance(),
GlobalBlockStateHandlers::getUpgrader()

View File

@ -49,11 +49,11 @@ use function time;
class BedrockWorldData extends BaseNbtWorldData{
public const CURRENT_STORAGE_VERSION = 10;
public const CURRENT_STORAGE_NETWORK_VERSION = 560;
public const CURRENT_STORAGE_NETWORK_VERSION = 575;
public const CURRENT_CLIENT_VERSION_TARGET = [
1, //major
19, //minor
50, //patch
70, //patch
0, //revision
0 //is beta
];