PocketMine-MP 5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
Loading...
Searching...
No Matches
BlockStateUpgradeSchema.php
1<?php
2
3/*
4 *
5 * ____ _ _ __ __ _ __ __ ____
6 * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7 * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8 * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9 * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10 *
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * @author PocketMine Team
17 * @link http://www.pocketmine.net/
18 *
19 *
20 */
21
22declare(strict_types=1);
23
24namespace pocketmine\data\bedrock\block\upgrade;
25
29use function count;
30
36 public array $renamedIds = [];
37
42 public array $addedProperties = [];
43
48 public array $removedProperties = [];
49
54 public array $renamedProperties = [];
55
60 public array $remappedPropertyValues = [];
61
66 public array $flattenedProperties = [];
67
72 public array $remappedStates = [];
73
74 public readonly int $versionId;
75
76 public function __construct(
77 public readonly int $maxVersionMajor,
78 public readonly int $maxVersionMinor,
79 public readonly int $maxVersionPatch,
80 public readonly int $maxVersionRevision,
81 private int $schemaId
82 ){
83 $this->versionId = ($this->maxVersionMajor << 24) | ($this->maxVersionMinor << 16) | ($this->maxVersionPatch << 8) | $this->maxVersionRevision;
84 }
85
90 public function getVersionId() : int{
91 return $this->versionId;
92 }
93
94 public function getSchemaId() : int{ return $this->schemaId; }
95
96 public function isEmpty() : bool{
97 foreach([
98 $this->renamedIds,
99 $this->addedProperties,
100 $this->removedProperties,
101 $this->renamedProperties,
102 $this->remappedPropertyValues,
103 $this->flattenedProperties,
104 $this->remappedStates,
105 ] as $list){
106 if(count($list) !== 0){
107 return false;
108 }
109 }
110
111 return true;
112 }
113}