mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Added support for compressing blockstate remaps using copiedState
this significantly reduces the size of schemas when state remaps are used (see pmmp/BedrockBlockUpgradeSchema@85b83b360e). in addition, this will likely offer a substantial performance and memory saving when walls get flattened, which will eventually happen.
This commit is contained in:
@ -157,6 +157,7 @@ final class BlockStateUpgradeSchemaUtils{
|
||||
array_map(fn(BlockStateUpgradeSchemaModelTag $tag) => self::jsonModelToTag($tag), $remap->oldState ?? []),
|
||||
$remap->newName,
|
||||
array_map(fn(BlockStateUpgradeSchemaModelTag $tag) => self::jsonModelToTag($tag), $remap->newState ?? []),
|
||||
$remap->copiedState ?? []
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -277,7 +278,11 @@ final class BlockStateUpgradeSchemaUtils{
|
||||
array_map(fn(Tag $tag) => self::tagToJsonModel($tag), $remap->oldState),
|
||||
$remap->newName,
|
||||
array_map(fn(Tag $tag) => self::tagToJsonModel($tag), $remap->newState),
|
||||
$remap->copiedState
|
||||
);
|
||||
if(count($modelRemap->copiedState) === 0){
|
||||
unset($modelRemap->copiedState); //avoid polluting the JSON
|
||||
}
|
||||
$key = json_encode($modelRemap);
|
||||
assert(!isset($keyedRemaps[$key]));
|
||||
if(isset($keyedRemaps[$key])){
|
||||
|
Reference in New Issue
Block a user